remove FIPS module code from crypto/evp
[openssl.git] / e_os.h
diff --git a/e_os.h b/e_os.h
index 9a260a4141efaca097e82dbcf26aae1fcbaeeaa2..d0217f1863cfb85e9e5f714a03f086da859e052e 100644 (file)
--- a/e_os.h
+++ b/e_os.h
@@ -94,20 +94,6 @@ extern "C" {
 #  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
-#  endif
-#  define NO_SYS_PARAM_H
-#  define NO_CHMOD
-#  define NO_SYSLOG
-#  undef  DEVRANDOM
-#  define GETPID_IS_MEANINGLESS
-# endif
-#endif
-
 /********************************************************************
  The Microsoft section
  ********************************************************************/
@@ -150,12 +136,13 @@ extern "C" {
 #define clear_socket_error()   WSASetLastError(0)
 #define readsocket(s,b,n)      recv((s),(b),(n),0)
 #define writesocket(s,b,n)     send((s),(b),(n),0)
-#elif defined(MAC_OS_pre_X)
+#elif defined(__DJGPP__)
+#define WATT32
 #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))
+#define closesocket(s)         close_s(s)
+#define readsocket(s,b,n)      read_s(s,b,n)
+#define writesocket(s,b,n)     send(s,b,n,0)
 #elif defined(OPENSSL_SYS_VMS)
 #define get_last_socket_error() errno
 #define clear_socket_error()    errno=0
@@ -220,6 +207,19 @@ extern "C" {
 
 #if (defined(WINDOWS) || defined(MSDOS))
 
+#  ifdef __DJGPP__
+#    include <unistd.h>
+#    include <sys/stat.h>
+#    include <sys/socket.h>
+#    include <tcp.h>
+#    include <netdb.h>
+#    define _setmode setmode
+#    define _O_TEXT O_TEXT
+#    define _O_BINARY O_BINARY
+#    undef DEVRANDOM
+#    define DEVRANDOM "/dev/urandom\x24"
+#  endif /* __DJGPP__ */
+
 #  ifndef S_IFDIR
 #    define S_IFDIR    _S_IFDIR
 #  endif
@@ -228,7 +228,7 @@ extern "C" {
 #    define S_IFMT     _S_IFMT
 #  endif
 
-#  if !defined(WINNT)
+#  if !defined(WINNT) && !defined(__DJGPP__)
 #    define NO_SYSLOG
 #  endif
 #  define NO_DIRENT
@@ -274,7 +274,7 @@ extern "C" {
 #    ifdef _WIN64
 #      define strlen(s) _strlen31(s)
 /* cut strings to 2GB */
-static unsigned int _strlen31(const char *str)
+static __inline unsigned int _strlen31(const char *str)
        {
        unsigned int len=0;
        while (*str && len<0x80000000U) str++, len++;
@@ -316,10 +316,8 @@ static unsigned int _strlen31(const char *str)
 #      endif
 #    endif
 #  endif
-#  if !defined(OPENSSL_FIPSCANISTER)
 #    include <io.h>
 #    include <fcntl.h>
-#  endif
 
 #  ifdef OPENSSL_SYS_WINCE
 #    define OPENSSL_NO_POSIX_IO
@@ -359,7 +357,7 @@ static unsigned int _strlen31(const char *str)
 #  define check_winnt() (1)
 #else
 #  define check_winnt() (GetVersion() < 0x80000000)
-#endif 
+#endif
 
 #else /* The non-microsoft world */
 
@@ -470,6 +468,10 @@ static unsigned int _strlen31(const char *str)
 
 /*************/
 
+#if defined(OPENSSL_NO_SOCK) && !defined(OPENSSL_NO_DGRAM)
+#  define OPENSSL_NO_DGRAM
+#endif
+
 #ifdef USE_SOCKETS
 #  if defined(WINDOWS) || defined(MSDOS)
       /* windows world */
@@ -479,7 +481,7 @@ static unsigned int _strlen31(const char *str)
 #      define SSLeay_Read(a,b,c)       (-1)
 #      define SHUTDOWN(fd)             close(fd)
 #      define SHUTDOWN2(fd)            close(fd)
-#    else
+#    elif !defined(__DJGPP__)
 #      if defined(_WIN32_WCE) && _WIN32_WCE<410
 #        define getservbyname _masked_declaration_getservbyname
 #      endif
@@ -506,16 +508,13 @@ static unsigned int _strlen31(const char *str)
 #      define SSLeay_Read(a,b,c)       recv((a),(b),(c),0)
 #      define SHUTDOWN(fd)             { shutdown((fd),0); closesocket(fd); }
 #      define SHUTDOWN2(fd)            { shutdown((fd),2); closesocket(fd); }
+#    else
+#      define SSLeay_Write(a,b,c)      write_s(a,b,c,0)
+#      define SSLeay_Read(a,b,c)       read_s(a,b,c)
+#      define SHUTDOWN(fd)             close_s(fd)
+#      define SHUTDOWN2(fd)            close_s(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)
-
 #  elif defined(OPENSSL_SYS_NETWARE)
          /* NetWare uses the WinSock2 interfaces by default, but can be configured for BSD
          */
@@ -723,10 +722,25 @@ struct servent *getservbyname(const char *name, const char *proto);
 #include <OS.h>
 #endif
 
+#if !defined(inline) && !defined(__cplusplus)
+# if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
+   /* do nothing, inline works */
+# elif defined(__GNUC__) && __GNUC__>=2
+#  define inline __inline__
+# elif defined(_MSC_VER)
+  /*
+   * Visual Studio: inline is available in C++ only, however
+   * __inline is available for C, see
+   * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
+   */
+#  define inline __inline
+# else
+#  define inline
+# endif
+#endif
 
 #ifdef  __cplusplus
 }
 #endif
 
 #endif
-