X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=e_os.h;h=0bb2bfa69323672cd1e894ba7da0ab1a02a65da8;hp=7f5f62d113372fa0b17d22fc4ed56cdd18882ec0;hb=85b7b80434d4468ed95f5c0360ebb445a96b4943;hpb=4a56f7493c883ea220c47a0c394cec4eff498af1 diff --git a/e_os.h b/e_os.h index 7f5f62d113..0bb2bfa693 100644 --- a/e_os.h +++ b/e_os.h @@ -77,16 +77,29 @@ extern "C" { #endif #ifndef DEVRANDOM -/* set this to your 'random' device if you have one. - * My default, we will try to read this file */ -#define DEVRANDOM "/dev/urandom" +/* set this to a comma-separated list of 'random' device files to try out. + * My default, we will try to read at least one of these files */ +#define DEVRANDOM "/dev/urandom","/dev/random","/dev/srandom" +#endif +#ifndef DEVRANDOM_EGD +/* set this to a comma-seperated list of 'egd' sockets to try out. These + * sockets will be tried in the order listed in case accessing the device files + * listed in DEVRANDOM did not return enough entropy. */ +#define DEVRANDOM_EGD "/var/run/egd-pool","/dev/egd-pool","/etc/egd-pool","/etc/entropy" #endif -#if defined(__MWERKS__) && defined(macintosh) +#if defined(OPENSSL_SYS_VXWORKS) +# define NO_SYS_PARAM_H +# define NO_CHMOD +# define NO_SYSLOG +#endif + +#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) # if macintosh==1 # ifndef MAC_OS_GUSI_SOURCE # define MAC_OS_pre_X # define NO_SYS_TYPES_H + typedef long ssize_t; # endif # define NO_SYS_PARAM_H # define NO_CHMOD @@ -101,23 +114,23 @@ extern "C" { ********************************************************************/ /* The following is used becaue of the small stack in some * Microsoft operating systems */ -#if defined(WIN16) || defined(MSDOS) +#if defined(OPENSSL_SYS_MSDOS) # define MS_STATIC static #else # define MS_STATIC #endif -#if defined(_WIN32) && !defined(WIN32) +#if defined(OPENSSL_SYS_WIN32) && !defined(WIN32) # define WIN32 #endif - -#if defined(WIN32) || defined(WIN16) -# ifndef WINDOWS -# define WINDOWS -# endif -# ifndef MSDOS -# define MSDOS -# endif +#if defined(OPENSSL_SYS_WIN16) && !defined(WIN16) +# define WIN16 +#endif +#if defined(OPENSSL_SYS_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(OPENSSL_SYS_MSDOS) && !defined(MSDOS) +# define MSDOS #endif #if defined(MSDOS) && !defined(GETPID_IS_MEANINGLESS) @@ -135,7 +148,7 @@ extern "C" { #define clear_sys_error() errno=0 #endif -#ifdef WINDOWS +#if defined(WINDOWS) #define get_last_socket_error() WSAGetLastError() #define clear_socket_error() WSASetLastError(0) #define readsocket(s,b,n) recv((s),(b),(n),0) @@ -157,7 +170,7 @@ extern "C" { #endif #ifdef WIN16 -# define NO_FP_API +# define OPENSSL_NO_FP_API # define MS_CALLBACK _far _loadds # define MS_FAR _far #else @@ -165,11 +178,11 @@ extern "C" { # define MS_FAR #endif -#ifdef NO_STDIO -# define NO_FP_API +#ifdef OPENSSL_NO_STDIO +# define OPENSSL_NO_FP_API #endif -#if defined(WINDOWS) || defined(MSDOS) +#if (defined(WINDOWS) || defined(MSDOS)) # ifndef S_IFDIR # define S_IFDIR _S_IFDIR @@ -194,9 +207,7 @@ extern "C" { # include # include -# ifdef __MINGW32__ -# define ssize_t long -# endif +# define ssize_t long # if defined (__BORLANDC__) # define _setmode setmode @@ -225,14 +236,12 @@ extern "C" { # define SSLEAY_CONF OPENSSL_CONF # define NUL_DEV "nul" # define RFILE ".rnd" +# define DEFAULT_HOME "C:" #else /* The non-microsoft world world */ -# if defined(__VMS) && !defined(VMS) -# define VMS 1 -# endif - -# ifdef VMS +# ifdef OPENSSL_SYS_VMS +# define VMS 1 /* some programs don't include stdlib, so exit() and others give implicit function warnings */ # include @@ -246,22 +255,41 @@ extern "C" { # define RFILE ".rnd" # define LIST_SEPARATOR_CHAR ',' # define NUL_DEV "NLA0:" - /* We need to do this, because DEC C converts exit code 0 to 1, but not 1 - to 0. We will convert 1 to 3! Also, add the inhibit message bit... */ -# ifndef MONOLITH + /* We don't have any well-defined random devices on VMS, yet... */ +# undef DEVRANDOM + /* We need to do this since VMS has the following coding on status codes: + + Bits 0-2: status type: 0 = warning, 1 = success, 2 = error, 3 = info ... + The important thing to know is that odd numbers are considered + good, while even ones are considered errors. + Bits 3-15: actual status number + Bits 16-27: facility number. 0 is considered "unknown" + Bits 28-31: control bits. If bit 28 is set, the shell won't try to + output the message (which, for random codes, just looks ugly) + + So, what we do here is to change 0 to 1 to get the default success status, + and everything else is shifted up to fit into the status number field, and + the status is tagged as an error, which I believe is what is wanted here. + -- Richard Levitte + */ +# if !defined(MONOLITH) || defined(OPENSSL_C) # define EXIT(n) do { int __VMS_EXIT = n; \ - if (__VMS_EXIT == 1) __VMS_EXIT = 3; \ + if (__VMS_EXIT == 0) \ + __VMS_EXIT = 1; \ + else \ + __VMS_EXIT = (n << 3) | 2; \ __VMS_EXIT |= 0x10000000; \ - exit(n); return(n); } while(0) + exit(__VMS_EXIT); \ + return(__VMS_EXIT); } while(0) # else -# define EXIT(n) do { int __VMS_EXIT = n; \ - if (__VMS_EXIT == 1) __VMS_EXIT = 3; \ - __VMS_EXIT |= 0x10000000; \ - return(n); } while(0) +# define EXIT(n) return(n) # endif # define NO_SYS_PARAM_H # else /* !defined VMS */ +# ifdef OPENSSL_SYS_MPE +# define NO_SYS_PARAM_H +# endif # ifdef OPENSSL_UNISTD # include OPENSSL_UNISTD # else @@ -270,12 +298,16 @@ extern "C" { # ifndef NO_SYS_TYPES_H # include # endif -# ifdef NeXT +# if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) # define pid_t int /* pid_t is missing on NEXTSTEP/OPENSTEP * (unless when compiling with -D_POSIX_SOURCE, * which doesn't work for us) */ # define ssize_t int /* ditto */ # endif +# ifdef OPENSSL_SYS_NEWS4 /* setvbuf is missing on mips-sony-bsd */ +# define setvbuf(a, b, c, d) setbuffer((a), (b), (d)) + typedef unsigned long clock_t; +# endif # define OPENSSL_CONF "openssl.cnf" # define SSLEAY_CONF OPENSSL_CONF @@ -300,7 +332,7 @@ extern "C" { # if defined(WINDOWS) || defined(MSDOS) /* windows world */ -# ifdef NO_SOCK +# ifdef OPENSSL_NO_SOCK # define SSLeay_Write(a,b,c) (-1) # define SSLeay_Read(a,b,c) (-1) # define SHUTDOWN(fd) close(fd) @@ -327,18 +359,24 @@ extern HINSTANCE _hInstance; # ifndef NO_SYS_PARAM_H # include # endif -# include /* Needed under linux for FD_XXX */ +# ifdef OPENSSL_SYS_VXWORKS +# include +# elif !defined(OPENSSL_SYS_MPE) +# include /* Needed under linux for FD_XXX */ +# endif # include -# if defined(VMS) && !defined(__DECC) +# if defined(OPENSSL_SYS_VMS_NODECC) # include # include +# include # else # include # ifdef FILIO_H # include /* Added for FIONBIO under unixware */ # endif # include +# include # endif # if defined(NeXT) || defined(_NEXT_SOURCE) @@ -346,7 +384,11 @@ extern HINSTANCE _hInstance; # include # endif -# ifdef AIX +# ifdef OPENSSL_SYS_AIX +# include +# endif + +# ifdef __QNX__ # include # endif @@ -378,10 +420,22 @@ extern HINSTANCE _hInstance; # endif #endif -#if defined(THREADS) || defined(sun) -#ifndef _REENTRANT -#define _REENTRANT +#if defined(__ultrix) +# ifndef ssize_t +# define ssize_t int +# endif #endif + +#if defined(sun) && !defined(__svr4__) && !defined(__SVR4) + /* include headers first, so our defines don't break it */ +#include +#include + /* bcopy can handle overlapping moves according to SunOS 4.1.4 manpage */ +# define memmove(s1,s2,n) bcopy((s2),(s1),(n)) +# define strtoul(s,e,b) ((unsigned long int)strtol((s),(e),(b))) +extern char *sys_errlist[]; extern int sys_nerr; +# define strerror(errnum) \ + (((errnum)<0 || (errnum)>=sys_nerr) ? NULL : sys_errlist[errnum]) #endif /***********************************************/ @@ -403,21 +457,15 @@ extern HINSTANCE _hInstance; #ifdef sgi #define IRIX_CC_BUG /* all version of IRIX I've tested (4.* 5.*) */ #endif -#ifdef SNI +#ifdef OPENSSL_SYS_SNI #define IRIX_CC_BUG /* CDS++ up to V2.0Bsomething suffered from the same bug.*/ #endif -#ifdef NO_MD2 -#define MD2_Init MD2Init -#define MD2_Update MD2Update -#define MD2_Final MD2Final -#define MD2_DIGEST_LENGTH 16 -#endif -#ifdef NO_MD5 -#define MD5_Init MD5Init -#define MD5_Update MD5Update -#define MD5_Final MD5Final -#define MD5_DIGEST_LENGTH 16 +#if defined(OPENSSL_SYS_OS2) && defined(__EMX__) +# include +# include +# define NO_SYSLOG +# define strcasecmp stricmp #endif #ifdef __cplusplus