Eneboo - Documentación para desarrolladores
|
00001 /* e_os.h */ 00002 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 00003 * All rights reserved. 00004 * 00005 * This package is an SSL implementation written 00006 * by Eric Young (eay@cryptsoft.com). 00007 * The implementation was written so as to conform with Netscapes SSL. 00008 * 00009 * This library is free for commercial and non-commercial use as long as 00010 * the following conditions are aheared to. The following conditions 00011 * apply to all code found in this distribution, be it the RC4, RSA, 00012 * lhash, DES, etc., code; not just the SSL code. The SSL documentation 00013 * included with this distribution is covered by the same copyright terms 00014 * except that the holder is Tim Hudson (tjh@cryptsoft.com). 00015 * 00016 * Copyright remains Eric Young's, and as such any Copyright notices in 00017 * the code are not to be removed. 00018 * If this package is used in a product, Eric Young should be given attribution 00019 * as the author of the parts of the library used. 00020 * This can be in the form of a textual message at program startup or 00021 * in documentation (online or textual) provided with the package. 00022 * 00023 * Redistribution and use in source and binary forms, with or without 00024 * modification, are permitted provided that the following conditions 00025 * are met: 00026 * 1. Redistributions of source code must retain the copyright 00027 * notice, this list of conditions and the following disclaimer. 00028 * 2. Redistributions in binary form must reproduce the above copyright 00029 * notice, this list of conditions and the following disclaimer in the 00030 * documentation and/or other materials provided with the distribution. 00031 * 3. All advertising materials mentioning features or use of this software 00032 * must display the following acknowledgement: 00033 * "This product includes cryptographic software written by 00034 * Eric Young (eay@cryptsoft.com)" 00035 * The word 'cryptographic' can be left out if the rouines from the library 00036 * being used are not cryptographic related :-). 00037 * 4. If you include any Windows specific code (or a derivative thereof) from 00038 * the apps directory (application code) you must include an acknowledgement: 00039 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 00040 * 00041 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 00042 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00043 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00044 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 00045 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00046 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00047 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00048 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00049 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00050 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00051 * SUCH DAMAGE. 00052 * 00053 * The licence and distribution terms for any publically available version or 00054 * derivative of this code cannot be changed. i.e. this code cannot simply be 00055 * copied and put under another distribution licence 00056 * [including the GNU Public Licence.] 00057 */ 00058 00059 #ifndef HEADER_E_OS_H 00060 #define HEADER_E_OS_H 00061 00062 #include <openssl/opensslconf.h> 00063 00064 #include <openssl/e_os2.h> 00065 /* <openssl/e_os2.h> contains what we can justify to make visible 00066 * to the outside; this file e_os.h is not part of the exported 00067 * interface. */ 00068 00069 #ifdef __cplusplus 00070 extern "C" { 00071 #endif 00072 00073 /* Used to checking reference counts, most while doing perl5 stuff :-) */ 00074 #ifdef REF_PRINT 00075 #undef REF_PRINT 00076 #define REF_PRINT(a,b) fprintf(stderr,"%08X:%4d:%s\n",(int)b,b->references,a) 00077 #endif 00078 00079 #ifndef DEVRANDOM 00080 /* set this to a comma-separated list of 'random' device files to try out. 00081 * My default, we will try to read at least one of these files */ 00082 #define DEVRANDOM "/dev/urandom","/dev/random","/dev/srandom" 00083 #endif 00084 #ifndef DEVRANDOM_EGD 00085 /* set this to a comma-seperated list of 'egd' sockets to try out. These 00086 * sockets will be tried in the order listed in case accessing the device files 00087 * listed in DEVRANDOM did not return enough entropy. */ 00088 #define DEVRANDOM_EGD "/var/run/egd-pool","/dev/egd-pool","/etc/egd-pool","/etc/entropy" 00089 #endif 00090 00091 #if defined(OPENSSL_SYS_VXWORKS) 00092 # define NO_SYS_PARAM_H 00093 # define NO_CHMOD 00094 # define NO_SYSLOG 00095 #endif 00096 00097 #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) 00098 # if macintosh==1 00099 # ifndef MAC_OS_GUSI_SOURCE 00100 # define MAC_OS_pre_X 00101 # define NO_SYS_TYPES_H 00102 typedef long ssize_t; 00103 # endif 00104 # define NO_SYS_PARAM_H 00105 # define NO_CHMOD 00106 # define NO_SYSLOG 00107 # undef DEVRANDOM 00108 # define GETPID_IS_MEANINGLESS 00109 # endif 00110 #endif 00111 00112 /******************************************************************** 00113 The Microsoft section 00114 ********************************************************************/ 00115 /* The following is used becaue of the small stack in some 00116 * Microsoft operating systems */ 00117 #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYSNAME_WIN32) 00118 # define MS_STATIC static 00119 #else 00120 # define MS_STATIC 00121 #endif 00122 00123 #if defined(OPENSSL_SYS_WIN32) && !defined(WIN32) 00124 # define WIN32 00125 #endif 00126 #if defined(OPENSSL_SYS_WIN16) && !defined(WIN16) 00127 # define WIN16 00128 #endif 00129 #if defined(OPENSSL_SYS_WINDOWS) && !defined(WINDOWS) 00130 # define WINDOWS 00131 #endif 00132 #if defined(OPENSSL_SYS_MSDOS) && !defined(MSDOS) 00133 # define MSDOS 00134 #endif 00135 00136 #if defined(MSDOS) && !defined(GETPID_IS_MEANINGLESS) 00137 # define GETPID_IS_MEANINGLESS 00138 #endif 00139 00140 #ifdef WIN32 00141 #define get_last_sys_error() GetLastError() 00142 #define clear_sys_error() SetLastError(0) 00143 #if !defined(WINNT) 00144 #define WIN_CONSOLE_BUG 00145 #endif 00146 #else 00147 #define get_last_sys_error() errno 00148 #define clear_sys_error() errno=0 00149 #endif 00150 00151 #if defined(WINDOWS) 00152 #define get_last_socket_error() WSAGetLastError() 00153 #define clear_socket_error() WSASetLastError(0) 00154 #define readsocket(s,b,n) recv((s),(b),(n),0) 00155 #define writesocket(s,b,n) send((s),(b),(n),0) 00156 #elif defined(__DJGPP__) 00157 #define WATT32 00158 #define get_last_socket_error() errno 00159 #define clear_socket_error() errno=0 00160 #define closesocket(s) close_s(s) 00161 #define readsocket(s,b,n) read_s(s,b,n) 00162 #define writesocket(s,b,n) send(s,b,n,0) 00163 #elif defined(MAC_OS_pre_X) 00164 #define get_last_socket_error() errno 00165 #define clear_socket_error() errno=0 00166 #define closesocket(s) MacSocket_close(s) 00167 #define readsocket(s,b,n) MacSocket_recv((s),(b),(n),true) 00168 #define writesocket(s,b,n) MacSocket_send((s),(b),(n)) 00169 #elif defined(OPENSSL_SYS_VMS) 00170 #define get_last_socket_error() errno 00171 #define clear_socket_error() errno=0 00172 #define ioctlsocket(a,b,c) ioctl(a,b,c) 00173 #define closesocket(s) close(s) 00174 #define readsocket(s,b,n) recv((s),(b),(n),0) 00175 #define writesocket(s,b,n) send((s),(b),(n),0) 00176 #elif defined(OPENSSL_SYS_VXWORKS) 00177 #define get_last_socket_error() errno 00178 #define clear_socket_error() errno=0 00179 #define ioctlsocket(a,b,c) ioctl((a),(b),(int)(c)) 00180 #define closesocket(s) close(s) 00181 #define readsocket(s,b,n) read((s),(b),(n)) 00182 #define writesocket(s,b,n) write((s),(char *)(b),(n)) 00183 #elif defined(OPENSSL_SYS_NETWARE) 00184 #if defined(NETWARE_BSDSOCK) 00185 #define get_last_socket_error() errno 00186 #define clear_socket_error() errno=0 00187 #define closesocket(s) close(s) 00188 #define ioctlsocket(a,b,c) ioctl(a,b,c) 00189 #if defined(NETWARE_LIBC) 00190 #define readsocket(s,b,n) recv((s),(b),(n),0) 00191 #define writesocket(s,b,n) send((s),(b),(n),0) 00192 #else 00193 #define readsocket(s,b,n) recv((s),(char*)(b),(n),0) 00194 #define writesocket(s,b,n) send((s),(char*)(b),(n),0) 00195 #endif 00196 #else 00197 #define get_last_socket_error() WSAGetLastError() 00198 #define clear_socket_error() WSASetLastError(0) 00199 #define readsocket(s,b,n) recv((s),(b),(n),0) 00200 #define writesocket(s,b,n) send((s),(b),(n),0) 00201 #endif 00202 #else 00203 #define get_last_socket_error() errno 00204 #define clear_socket_error() errno=0 00205 #define ioctlsocket(a,b,c) ioctl(a,b,c) 00206 #define closesocket(s) close(s) 00207 #define readsocket(s,b,n) read((s),(b),(n)) 00208 #define writesocket(s,b,n) write((s),(b),(n)) 00209 #endif 00210 00211 #ifdef WIN16 00212 # define MS_CALLBACK _far _loadds 00213 # define MS_FAR _far 00214 #else 00215 # define MS_CALLBACK 00216 # define MS_FAR 00217 #endif 00218 00219 #ifdef OPENSSL_NO_STDIO 00220 # undef OPENSSL_NO_FP_API 00221 # define OPENSSL_NO_FP_API 00222 #endif 00223 00224 #if (defined(WINDOWS) || defined(MSDOS)) 00225 00226 # ifdef __DJGPP__ 00227 # include <unistd.h> 00228 # include <sys/stat.h> 00229 # include <sys/socket.h> 00230 # include <tcp.h> 00231 # include <netdb.h> 00232 # define _setmode setmode 00233 # define _O_TEXT O_TEXT 00234 # define _O_BINARY O_BINARY 00235 # undef DEVRANDOM 00236 # define DEVRANDOM "/dev/urandom\x24" 00237 # endif /* __DJGPP__ */ 00238 00239 # ifndef S_IFDIR 00240 # define S_IFDIR _S_IFDIR 00241 # endif 00242 00243 # ifndef S_IFMT 00244 # define S_IFMT _S_IFMT 00245 # endif 00246 00247 # if !defined(WINNT) && !defined(__DJGPP__) 00248 # define NO_SYSLOG 00249 # endif 00250 # define NO_DIRENT 00251 00252 # ifdef WINDOWS 00253 # if !defined(_WIN32_WCE) && !defined(_WIN32_WINNT) 00254 /* 00255 * Defining _WIN32_WINNT here in e_os.h implies certain "discipline." 00256 * Most notably we ought to check for availability of each specific 00257 * routine with GetProcAddress() and/or quard NT-specific calls with 00258 * GetVersion() < 0x80000000. One can argue that in latter "or" case 00259 * we ought to /DELAYLOAD some .DLLs in order to protect ourselves 00260 * against run-time link errors. This doesn't seem to be necessary, 00261 * because it turned out that already Windows 95, first non-NT Win32 00262 * implementation, is equipped with at least NT 3.51 stubs, dummy 00263 * routines with same name, but which do nothing. Meaning that it's 00264 * apparently appropriate to guard generic NT calls with GetVersion 00265 * alone, while NT 4.0 and above calls ought to be additionally 00266 * checked upon with GetProcAddress. 00267 */ 00268 # define _WIN32_WINNT 0x0400 00269 # endif 00270 # include <windows.h> 00271 # include <stdio.h> 00272 # include <stddef.h> 00273 # include <errno.h> 00274 # include <string.h> 00275 # ifdef _WIN64 00276 # define strlen(s) _strlen31(s) 00277 /* cut strings to 2GB */ 00278 static unsigned int _strlen31(const char *str) 00279 { 00280 unsigned int len=0; 00281 while (*str && len<0x80000000U) str++, len++; 00282 return len&0x7FFFFFFF; 00283 } 00284 # endif 00285 # include <malloc.h> 00286 # if defined(_MSC_VER) && _MSC_VER<=1200 && defined(_MT) && defined(isspace) 00287 /* compensate for bug in VC6 ctype.h */ 00288 # undef isspace 00289 # undef isdigit 00290 # undef isalnum 00291 # undef isupper 00292 # undef isxdigit 00293 # endif 00294 # if defined(_MSC_VER) && !defined(_DLL) && defined(stdin) 00295 # if _MSC_VER>=1300 00296 # undef stdin 00297 # undef stdout 00298 # undef stderr 00299 FILE *__iob_func(); 00300 # define stdin (&__iob_func()[0]) 00301 # define stdout (&__iob_func()[1]) 00302 # define stderr (&__iob_func()[2]) 00303 # elif defined(I_CAN_LIVE_WITH_LNK4049) 00304 # undef stdin 00305 # undef stdout 00306 # undef stderr 00307 /* pre-1300 has __p__iob(), but it's available only in msvcrt.lib, 00308 * or in other words with /MD. Declaring implicit import, i.e. 00309 * with _imp_ prefix, works correctly with all compiler options, 00310 * but without /MD results in LINK warning LNK4049: 00311 * 'locally defined symbol "__iob" imported'. 00312 */ 00313 extern FILE *_imp___iob; 00314 # define stdin (&_imp___iob[0]) 00315 # define stdout (&_imp___iob[1]) 00316 # define stderr (&_imp___iob[2]) 00317 # endif 00318 # endif 00319 # endif 00320 # include <io.h> 00321 # include <fcntl.h> 00322 00323 # ifdef OPENSSL_SYS_WINCE 00324 # include <winsock_extras.h> 00325 # endif 00326 00327 # define ssize_t long 00328 00329 # if defined (__BORLANDC__) 00330 # define _setmode setmode 00331 # define _O_TEXT O_TEXT 00332 # define _O_BINARY O_BINARY 00333 # define _int64 __int64 00334 # define _kbhit kbhit 00335 # endif 00336 00337 # if defined(WIN16) && defined(SSLEAY) && defined(_WINEXITNOPERSIST) 00338 # define EXIT(n) _wsetexit(_WINEXITNOPERSIST) 00339 # define OPENSSL_EXIT(n) do { if (n == 0) EXIT(n); return(n); } while(0) 00340 # else 00341 # define EXIT(n) exit(n) 00342 # endif 00343 # define LIST_SEPARATOR_CHAR ';' 00344 # ifndef X_OK 00345 # define X_OK 0 00346 # endif 00347 # ifndef W_OK 00348 # define W_OK 2 00349 # endif 00350 # ifndef R_OK 00351 # define R_OK 4 00352 # endif 00353 # define OPENSSL_CONF "openssl.cnf" 00354 # define SSLEAY_CONF OPENSSL_CONF 00355 # define NUL_DEV "nul" 00356 # define RFILE ".rnd" 00357 # ifdef OPENSSL_SYS_WINCE 00358 # define DEFAULT_HOME "" 00359 # else 00360 # define DEFAULT_HOME "C:" 00361 # endif 00362 00363 #else /* The non-microsoft world world */ 00364 00365 # ifdef OPENSSL_SYS_VMS 00366 # define VMS 1 00367 /* some programs don't include stdlib, so exit() and others give implicit 00368 function warnings */ 00369 # include <stdlib.h> 00370 # if defined(__DECC) 00371 # include <unistd.h> 00372 # else 00373 # include <unixlib.h> 00374 # endif 00375 # define OPENSSL_CONF "openssl.cnf" 00376 # define SSLEAY_CONF OPENSSL_CONF 00377 # define RFILE ".rnd" 00378 # define LIST_SEPARATOR_CHAR ',' 00379 # define NUL_DEV "NLA0:" 00380 /* We don't have any well-defined random devices on VMS, yet... */ 00381 # undef DEVRANDOM 00382 /* We need to do this since VMS has the following coding on status codes: 00383 00384 Bits 0-2: status type: 0 = warning, 1 = success, 2 = error, 3 = info ... 00385 The important thing to know is that odd numbers are considered 00386 good, while even ones are considered errors. 00387 Bits 3-15: actual status number 00388 Bits 16-27: facility number. 0 is considered "unknown" 00389 Bits 28-31: control bits. If bit 28 is set, the shell won't try to 00390 output the message (which, for random codes, just looks ugly) 00391 00392 So, what we do here is to change 0 to 1 to get the default success status, 00393 and everything else is shifted up to fit into the status number field, and 00394 the status is tagged as an error, which I believe is what is wanted here. 00395 -- Richard Levitte 00396 */ 00397 # define EXIT(n) do { int __VMS_EXIT = n; \ 00398 if (__VMS_EXIT == 0) \ 00399 __VMS_EXIT = 1; \ 00400 else \ 00401 __VMS_EXIT = (n << 3) | 2; \ 00402 __VMS_EXIT |= 0x10000000; \ 00403 exit(__VMS_EXIT); } while(0) 00404 # define NO_SYS_PARAM_H 00405 00406 # elif defined(OPENSSL_SYS_NETWARE) 00407 # include <fcntl.h> 00408 # include <unistd.h> 00409 # define NO_SYS_TYPES_H 00410 # undef DEVRANDOM 00411 # ifdef NETWARE_CLIB 00412 # define getpid GetThreadID 00413 extern int GetThreadID(void); 00414 /* # include <conio.h> */ 00415 extern int kbhit(void); 00416 extern void delay(unsigned milliseconds); 00417 # else 00418 # include <screen.h> 00419 # endif 00420 # define NO_SYSLOG 00421 # define _setmode setmode 00422 # define _kbhit kbhit 00423 # define _O_TEXT O_TEXT 00424 # define _O_BINARY O_BINARY 00425 # define OPENSSL_CONF "openssl.cnf" 00426 # define SSLEAY_CONF OPENSSL_CONF 00427 # define RFILE ".rnd" 00428 # define LIST_SEPARATOR_CHAR ';' 00429 # define EXIT(n) { if (n) printf("ERROR: %d\n", (int)n); exit(n); } 00430 00431 # else 00432 /* !defined VMS */ 00433 # ifdef OPENSSL_SYS_MPE 00434 # define NO_SYS_PARAM_H 00435 # endif 00436 # ifdef OPENSSL_UNISTD 00437 # include OPENSSL_UNISTD 00438 # else 00439 # include <unistd.h> 00440 # endif 00441 # ifndef NO_SYS_TYPES_H 00442 # include <sys/types.h> 00443 # endif 00444 # if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) 00445 # define pid_t int /* pid_t is missing on NEXTSTEP/OPENSTEP 00446 * (unless when compiling with -D_POSIX_SOURCE, 00447 * which doesn't work for us) */ 00448 # endif 00449 # if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS) 00450 # define ssize_t int /* ditto */ 00451 # endif 00452 # ifdef OPENSSL_SYS_NEWS4 /* setvbuf is missing on mips-sony-bsd */ 00453 # define setvbuf(a, b, c, d) setbuffer((a), (b), (d)) 00454 typedef unsigned long clock_t; 00455 # endif 00456 00457 # define OPENSSL_CONF "openssl.cnf" 00458 # define SSLEAY_CONF OPENSSL_CONF 00459 # define RFILE ".rnd" 00460 # define LIST_SEPARATOR_CHAR ':' 00461 # define NUL_DEV "/dev/null" 00462 # define EXIT(n) exit(n) 00463 # endif 00464 00465 # define SSLeay_getpid() getpid() 00466 00467 #endif 00468 00469 00470 /*************/ 00471 00472 #ifdef USE_SOCKETS 00473 # if defined(WINDOWS) || defined(MSDOS) 00474 /* windows world */ 00475 00476 # ifdef OPENSSL_NO_SOCK 00477 # define SSLeay_Write(a,b,c) (-1) 00478 # define SSLeay_Read(a,b,c) (-1) 00479 # define SHUTDOWN(fd) close(fd) 00480 # define SHUTDOWN2(fd) close(fd) 00481 # elif !defined(__DJGPP__) 00482 # include <winsock.h> 00483 extern HINSTANCE _hInstance; 00484 # ifdef _WIN64 00485 /* 00486 * Even though sizeof(SOCKET) is 8, it's safe to cast it to int, because 00487 * the value constitutes an index in per-process table of limited size 00488 * and not a real pointer. 00489 */ 00490 # define socket(d,t,p) ((int)socket(d,t,p)) 00491 # define accept(s,f,l) ((int)accept(s,f,l)) 00492 # endif 00493 # define SSLeay_Write(a,b,c) send((a),(b),(c),0) 00494 # define SSLeay_Read(a,b,c) recv((a),(b),(c),0) 00495 # define SHUTDOWN(fd) { shutdown((fd),0); closesocket(fd); } 00496 # define SHUTDOWN2(fd) { shutdown((fd),2); closesocket(fd); } 00497 # else 00498 # define SSLeay_Write(a,b,c) write_s(a,b,c,0) 00499 # define SSLeay_Read(a,b,c) read_s(a,b,c) 00500 # define SHUTDOWN(fd) close_s(fd) 00501 # define SHUTDOWN2(fd) close_s(fd) 00502 # endif 00503 00504 # elif defined(MAC_OS_pre_X) 00505 00506 # include "MacSocket.h" 00507 # define SSLeay_Write(a,b,c) MacSocket_send((a),(b),(c)) 00508 # define SSLeay_Read(a,b,c) MacSocket_recv((a),(b),(c),true) 00509 # define SHUTDOWN(fd) MacSocket_close(fd) 00510 # define SHUTDOWN2(fd) MacSocket_close(fd) 00511 00512 # elif defined(OPENSSL_SYS_NETWARE) 00513 /* NetWare uses the WinSock2 interfaces by default, but can be configured for BSD 00514 */ 00515 # if defined(NETWARE_BSDSOCK) 00516 # include <sys/socket.h> 00517 # include <netinet/in.h> 00518 # include <sys/time.h> 00519 # if defined(NETWARE_CLIB) 00520 # include <sys/bsdskt.h> 00521 # else 00522 # include <sys/select.h> 00523 # endif 00524 # define INVALID_SOCKET (int)(~0) 00525 # else 00526 # include <novsock2.h> 00527 # endif 00528 # define SSLeay_Write(a,b,c) send((a),(b),(c),0) 00529 # define SSLeay_Read(a,b,c) recv((a),(b),(c),0) 00530 # define SHUTDOWN(fd) { shutdown((fd),0); closesocket(fd); } 00531 # define SHUTDOWN2(fd) { shutdown((fd),2); closesocket(fd); } 00532 00533 # else 00534 00535 # ifndef NO_SYS_PARAM_H 00536 # include <sys/param.h> 00537 # endif 00538 # ifdef OPENSSL_SYS_VXWORKS 00539 # include <time.h> 00540 # elif !defined(OPENSSL_SYS_MPE) 00541 # include <sys/time.h> /* Needed under linux for FD_XXX */ 00542 # endif 00543 00544 # include <netdb.h> 00545 # if defined(OPENSSL_SYS_VMS_NODECC) 00546 # include <socket.h> 00547 # include <in.h> 00548 # include <inet.h> 00549 # else 00550 # include <sys/socket.h> 00551 # ifdef FILIO_H 00552 # include <sys/filio.h> /* Added for FIONBIO under unixware */ 00553 # endif 00554 # include <netinet/in.h> 00555 # include <arpa/inet.h> 00556 # endif 00557 00558 # if defined(NeXT) || defined(_NEXT_SOURCE) 00559 # include <sys/fcntl.h> 00560 # include <sys/types.h> 00561 # endif 00562 00563 # ifdef OPENSSL_SYS_AIX 00564 # include <sys/select.h> 00565 # endif 00566 00567 # ifdef __QNX__ 00568 # include <sys/select.h> 00569 # endif 00570 00571 # if defined(sun) 00572 # include <sys/filio.h> 00573 # else 00574 # ifndef VMS 00575 # include <sys/ioctl.h> 00576 # else 00577 /* ioctl is only in VMS > 7.0 and when socketshr is not used */ 00578 # if !defined(TCPIP_TYPE_SOCKETSHR) && defined(__VMS_VER) && (__VMS_VER > 70000000) 00579 # include <sys/ioctl.h> 00580 # endif 00581 # endif 00582 # endif 00583 00584 # ifdef VMS 00585 # include <unixio.h> 00586 # if defined(TCPIP_TYPE_SOCKETSHR) 00587 # include <socketshr.h> 00588 # endif 00589 # endif 00590 00591 # define SSLeay_Read(a,b,c) read((a),(b),(c)) 00592 # define SSLeay_Write(a,b,c) write((a),(b),(c)) 00593 # define SHUTDOWN(fd) { shutdown((fd),0); closesocket((fd)); } 00594 # define SHUTDOWN2(fd) { shutdown((fd),2); closesocket((fd)); } 00595 # ifndef INVALID_SOCKET 00596 # define INVALID_SOCKET (-1) 00597 # endif /* INVALID_SOCKET */ 00598 # endif 00599 #endif 00600 00601 #if defined(__ultrix) 00602 # ifndef ssize_t 00603 # define ssize_t int 00604 # endif 00605 #endif 00606 00607 #if defined(sun) && !defined(__svr4__) && !defined(__SVR4) 00608 /* include headers first, so our defines don't break it */ 00609 #include <stdlib.h> 00610 #include <string.h> 00611 /* bcopy can handle overlapping moves according to SunOS 4.1.4 manpage */ 00612 # define memmove(s1,s2,n) bcopy((s2),(s1),(n)) 00613 # define strtoul(s,e,b) ((unsigned long int)strtol((s),(e),(b))) 00614 extern char *sys_errlist[]; extern int sys_nerr; 00615 # define strerror(errnum) \ 00616 (((errnum)<0 || (errnum)>=sys_nerr) ? NULL : sys_errlist[errnum]) 00617 /* Being signed SunOS 4.x memcpy breaks ASN1_OBJECT table lookup */ 00618 #include "crypto/o_str.h" 00619 # define memcmp OPENSSL_memcmp 00620 #endif 00621 00622 #ifndef OPENSSL_EXIT 00623 # if defined(MONOLITH) && !defined(OPENSSL_C) 00624 # define OPENSSL_EXIT(n) return(n) 00625 # else 00626 # define OPENSSL_EXIT(n) do { EXIT(n); return(n); } while(0) 00627 # endif 00628 #endif 00629 00630 /***********************************************/ 00631 00632 /* do we need to do this for getenv. 00633 * Just define getenv for use under windows */ 00634 00635 #ifdef WIN16 00636 /* How to do this needs to be thought out a bit more.... */ 00637 /*char *GETENV(char *); 00638 #define Getenv GETENV*/ 00639 #define Getenv getenv 00640 #else 00641 #define Getenv getenv 00642 #endif 00643 00644 #define DG_GCC_BUG /* gcc < 2.6.3 on DGUX */ 00645 00646 #ifdef sgi 00647 #define IRIX_CC_BUG /* all version of IRIX I've tested (4.* 5.*) */ 00648 #endif 00649 #ifdef OPENSSL_SYS_SNI 00650 #define IRIX_CC_BUG /* CDS++ up to V2.0Bsomething suffered from the same bug.*/ 00651 #endif 00652 00653 #if defined(OPENSSL_SYS_WINDOWS) 00654 # define strcasecmp _stricmp 00655 # define strncasecmp _strnicmp 00656 #elif defined(OPENSSL_SYS_VMS) 00657 /* VMS below version 7.0 doesn't have strcasecmp() */ 00658 # include "o_str.h" 00659 # define strcasecmp OPENSSL_strcasecmp 00660 # define strncasecmp OPENSSL_strncasecmp 00661 # define OPENSSL_IMPLEMENTS_strncasecmp 00662 #elif defined(OPENSSL_SYS_OS2) && defined(__EMX__) 00663 # define strcasecmp stricmp 00664 # define strncasecmp strnicmp 00665 #elif defined(OPENSSL_SYS_NETWARE) 00666 # include <string.h> 00667 # if defined(NETWARE_CLIB) 00668 # define strcasecmp stricmp 00669 # define strncasecmp strnicmp 00670 # endif /* NETWARE_CLIB */ 00671 #endif 00672 00673 #if defined(OPENSSL_SYS_OS2) && defined(__EMX__) 00674 # include <io.h> 00675 # include <fcntl.h> 00676 # define NO_SYSLOG 00677 #endif 00678 00679 /* vxworks */ 00680 #if defined(OPENSSL_SYS_VXWORKS) 00681 #include <ioLib.h> 00682 #include <tickLib.h> 00683 #include <sysLib.h> 00684 00685 #define TTY_STRUCT int 00686 00687 #define sleep(a) taskDelay((a) * sysClkRateGet()) 00688 00689 #include <vxWorks.h> 00690 #include <sockLib.h> 00691 #include <taskLib.h> 00692 00693 #define getpid taskIdSelf 00694 00695 /* NOTE: these are implemented by helpers in database app! 00696 * if the database is not linked, we need to implement them 00697 * elswhere */ 00698 struct hostent *gethostbyname(const char *name); 00699 struct hostent *gethostbyaddr(const char *addr, int length, int type); 00700 struct servent *getservbyname(const char *name, const char *proto); 00701 00702 #endif 00703 /* end vxworks */ 00704 00705 #ifdef __cplusplus 00706 } 00707 #endif 00708 00709 #endif 00710