Initial support for MacOS.
This will soon be complemented with MacOS specific source code files and INSTALL.MacOS. I (Andy) have decided to get rid of a number of #include <sys/types.h>. I've verified it's ok (both by examining /usr/include/*.h and compiling) on a number of Unix platforms. Unfortunately I don't have Windows box to verify this on. I really appreciate if somebody could try to compile it and contact me a.s.a.p. in case a problem occurs. Submitted by: Roy Wood <roy@centricsystems.ca> Reviewed by: Andy Polyakov <appro@fy.chalmers.se>
This commit is contained in:
parent
5bdae1675c
commit
17f389bbbf
18 changed files with 91 additions and 35 deletions
|
@ -58,10 +58,13 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "cryptlib.h"
|
||||
|
||||
#ifndef NO_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/x509.h>
|
||||
|
|
|
@ -58,10 +58,13 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "cryptlib.h"
|
||||
|
||||
#ifndef NO_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
|
|
|
@ -58,10 +58,13 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "cryptlib.h"
|
||||
|
||||
#ifndef NO_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/objects.h>
|
||||
|
|
|
@ -163,8 +163,7 @@ static int fd_free(BIO *a)
|
|||
if (a->init)
|
||||
{
|
||||
#ifndef BIO_FD
|
||||
shutdown(a->num,2);
|
||||
closesocket(a->num);
|
||||
SHUTDOWN2(a->num);
|
||||
#else /* BIO_FD */
|
||||
close(a->num);
|
||||
#endif
|
||||
|
|
|
@ -147,7 +147,7 @@ int des_enc_read(int fd, void *buf, int len, des_key_schedule sched,
|
|||
/* first - get the length */
|
||||
while (net_num < HDRSIZE)
|
||||
{
|
||||
i=read(fd,&(net[net_num]),HDRSIZE-net_num);
|
||||
i=read(fd,(void *)&(net[net_num]),HDRSIZE-net_num);
|
||||
#ifdef EINTR
|
||||
if ((i == -1) && (errno == EINTR)) continue;
|
||||
#endif
|
||||
|
@ -169,7 +169,7 @@ int des_enc_read(int fd, void *buf, int len, des_key_schedule sched,
|
|||
net_num=0;
|
||||
while (net_num < rnum)
|
||||
{
|
||||
i=read(fd,&(net[net_num]),rnum-net_num);
|
||||
i=read(fd,(void *)&(net[net_num]),rnum-net_num);
|
||||
#ifdef EINTR
|
||||
if ((i == -1) && (errno == EINTR)) continue;
|
||||
#endif
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
#undef SGTTY
|
||||
#endif
|
||||
|
||||
#if !defined(TERMIO) && !defined(TERMIOS) && !defined(VMS) && !defined(MSDOS)
|
||||
#if !defined(TERMIO) && !defined(TERMIOS) && !defined(VMS) && !defined(MSDOS) && !defined(MAC_OS_pre_X)
|
||||
#undef TERMIOS
|
||||
#undef TERMIO
|
||||
#define SGTTY
|
||||
|
@ -153,7 +153,7 @@
|
|||
#define TTY_set(tty,data) ioctl(tty,TIOCSETP,data)
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBC) && !defined(MSDOS) && !defined(VMS)
|
||||
#if !defined(_LIBC) && !defined(MSDOS) && !defined(VMS) && !defined(MAC_OS_pre_X)
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
|
@ -174,6 +174,15 @@ struct IOSB {
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef MAC_OS_pre_X
|
||||
/*
|
||||
* This one needs work. As a matter of fact the code is unoperational
|
||||
* and this is only a trick to get it compiled.
|
||||
* <appro@fy.chalmers.se>
|
||||
*/
|
||||
#define TTY_STRUCT int
|
||||
#endif
|
||||
|
||||
#ifndef NX509_SIG
|
||||
#define NX509_SIG 32
|
||||
#endif
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
|
|
|
@ -60,12 +60,18 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "openssl/e_os.h"
|
||||
|
||||
#ifndef NO_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef MAC_OS_pre_X
|
||||
# include <stat.h>
|
||||
#else
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#undef BUFSIZE
|
||||
|
@ -116,19 +122,25 @@ int RAND_write_file(const char *file)
|
|||
FILE *out;
|
||||
int n;
|
||||
|
||||
/* Under VMS, fopen(file, "wb") will craete a new version of the
|
||||
/* Under VMS, fopen(file, "wb") will create a new version of the
|
||||
same file. This is not good, so let's try updating an existing
|
||||
one, and create file only if it doesn't already exist. This
|
||||
should be completely harmless on system that have no file
|
||||
versions. -- Richard Levitte */
|
||||
out=fopen(file,"rb+");
|
||||
if (out == NULL && errno == ENOENT)
|
||||
if (out == NULL
|
||||
#ifdef ENOENT
|
||||
&& errno == ENOENT
|
||||
#endif
|
||||
)
|
||||
{
|
||||
errno = 0;
|
||||
out=fopen(file,"wb");
|
||||
}
|
||||
if (out == NULL) goto err;
|
||||
#ifndef NO_CHMOD
|
||||
chmod(file,0600);
|
||||
#endif
|
||||
n=RAND_DATA;
|
||||
for (;;)
|
||||
{
|
||||
|
|
|
@ -59,10 +59,18 @@
|
|||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "cryptlib.h"
|
||||
|
||||
#ifndef NO_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef MAC_OS_pre_X
|
||||
# include <stat.h>
|
||||
#else
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include <openssl/lhash.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
|
|
|
@ -59,8 +59,6 @@
|
|||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/lhash.h>
|
||||
|
|
|
@ -57,8 +57,6 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/objects.h>
|
||||
|
|
|
@ -57,8 +57,6 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/x509.h>
|
||||
|
|
|
@ -57,8 +57,6 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/x509.h>
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/lhash.h>
|
||||
|
|
|
@ -59,11 +59,9 @@
|
|||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/lhash.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/evp.h>
|
||||
|
|
22
e_os.h
22
e_os.h
|
@ -82,6 +82,15 @@ extern "C" {
|
|||
#define DEVRANDOM "/dev/urandom"
|
||||
#endif
|
||||
|
||||
#if defined(__MWERKS__) && defined(macintosh)
|
||||
# if macintosh==1
|
||||
# define MAC_OS_pre_X
|
||||
# define NO_SYS_TYPES_H
|
||||
# define NO_CHMOD
|
||||
# define NO_SYSLOG
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/********************************************************************
|
||||
The Microsoft section
|
||||
********************************************************************/
|
||||
|
@ -119,6 +128,12 @@ extern "C" {
|
|||
#define readsocket(s,b,n) recv((s),(b),(n),0)
|
||||
#define writesocket(s,b,n) send((s),(b),(n),0)
|
||||
#define EADDRINUSE WSAEADDRINUSE
|
||||
#elif MAC_OS_pre_X
|
||||
#define get_last_socket_error() errno
|
||||
#define clear_socket_error() errno=0
|
||||
#define closesocket(s) MacSocket_close(s)
|
||||
#define readsocket(s,b,n) MacSocket_recv((s),(b),(n),true)
|
||||
#define writesocket(s,b,n) MacSocket_send((s),(b),(n))
|
||||
#else
|
||||
#define get_last_socket_error() errno
|
||||
#define clear_socket_error() errno=0
|
||||
|
@ -268,6 +283,13 @@ extern HINSTANCE _hInstance;
|
|||
# define SHUTDOWN2(fd) { shutdown((fd),2); closesocket(fd); }
|
||||
# endif
|
||||
|
||||
# elif defined(MAC_OS_pre_X)
|
||||
|
||||
# include "MacSocket.h"
|
||||
# define SSLeay_Write(a,b,c) MacSocket_send((a),(b),(c))
|
||||
# define SSLeay_Read(a,b,c) MacSocket_recv((a),(b),(c),true)
|
||||
# define SHUTDOWN(fd) MacSocket_close(fd)
|
||||
# define SHUTDOWN2(fd) MacSocket_close(fd)
|
||||
|
||||
# else
|
||||
|
||||
|
|
|
@ -105,14 +105,22 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#if !defined(WIN32) && !defined(VSM) && !defined(NeXT)
|
||||
|
||||
#include "openssl/e_os.h"
|
||||
|
||||
#ifndef NO_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if !defined(WIN32) && !defined(VSM) && !defined(NeXT) && !defined(MAC_OS_pre_X)
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#ifdef NeXT
|
||||
#include <sys/dir.h>
|
||||
#define dirent direct
|
||||
#endif
|
||||
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/pem.h>
|
||||
|
@ -671,6 +679,7 @@ err:
|
|||
|
||||
#ifndef WIN32
|
||||
#ifndef VMS /* XXXX This may be fixed in the future */
|
||||
#ifndef MAC_OS_pre_X
|
||||
|
||||
int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
|
||||
const char *dir)
|
||||
|
@ -714,3 +723,4 @@ err:
|
|||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue