diff options
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/bio/b_sock.c | 269 | ||||
-rw-r--r-- | lib/libcrypto/bio/bio.h | 9 | ||||
-rw-r--r-- | lib/libcrypto/bio/bio_cb.c | 2 | ||||
-rw-r--r-- | lib/libcrypto/bio/bio_lcl.h | 1 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_acpt.c | 9 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_conn.c | 10 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_dgram.c | 10 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_file.c | 87 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_log.c | 199 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_sock.c | 6 |
10 files changed, 4 insertions, 598 deletions
diff --git a/lib/libcrypto/bio/b_sock.c b/lib/libcrypto/bio/b_sock.c index cd62f889abd..3ccebf77f43 100644 --- a/lib/libcrypto/bio/b_sock.c +++ b/lib/libcrypto/bio/b_sock.c @@ -184,14 +184,7 @@ BIO_get_port(const char *str, unsigned short *port_ptr) *port_ptr = (unsigned short)i; else { CRYPTO_w_lock(CRYPTO_LOCK_GETSERVBYNAME); - /* Note: under VMS with SOCKETSHR, it seems like the first - * parameter is 'char *', instead of 'const char *' - */ -#ifndef CONST_STRICT - s = getservbyname((char *)str, "tcp"); -#else s = getservbyname(str, "tcp"); -#endif if (s != NULL) *port_ptr = ntohs((unsigned short)s->s_port); CRYPTO_w_unlock(CRYPTO_LOCK_GETSERVBYNAME); @@ -247,260 +240,24 @@ BIO_sock_error(int sock) return (j); } -#if 0 -long -BIO_ghbn_ctrl(int cmd, int iarg, char *parg) -{ - int i; - char **p; - - switch (cmd) { - case BIO_GHBN_CTRL_HITS: - return (BIO_ghbn_hits); - /* break; */ - case BIO_GHBN_CTRL_MISSES: - return (BIO_ghbn_miss); - /* break; */ - case BIO_GHBN_CTRL_CACHE_SIZE: - return (GHBN_NUM); - /* break; */ - case BIO_GHBN_CTRL_GET_ENTRY: - if ((iarg >= 0) && (iarg < GHBN_NUM) && - (ghbn_cache[iarg].order > 0)) { - p = (char **)parg; - if (p == NULL) - return (0); - *p = ghbn_cache[iarg].name; - ghbn_cache[iarg].name[128] = '\0'; - return (1); - } - return (0); - /* break; */ - case BIO_GHBN_CTRL_FLUSH: - for (i = 0; i < GHBN_NUM; i++) - ghbn_cache[i].order = 0; - break; - default: - return (0); - } - return (1); -} -#endif - -#if 0 -static struct hostent -*ghbn_dup(struct hostent *a) +struct hostent * +BIO_gethostbyname(const char *name) { - struct hostent *ret; - int i, j; - - MemCheck_off(); - ret = (struct hostent *)OPENSSL_malloc(sizeof(struct hostent)); - if (ret == NULL) - return (NULL); - memset(ret, 0, sizeof(struct hostent)); - - for (i = 0; a->h_aliases[i] != NULL; i++) - ; - i++; - ret->h_aliases = (char **)OPENSSL_malloc(i*sizeof(char *)); - if (ret->h_aliases == NULL) - goto err; - memset(ret->h_aliases, 0, i*sizeof(char *)); - - for (i = 0; a->h_addr_list[i] != NULL; i++) - ; - i++; - ret->h_addr_list = (char **)OPENSSL_malloc(i*sizeof(char *)); - if (ret->h_addr_list == NULL) - goto err; - memset(ret->h_addr_list, 0, i*sizeof(char *)); - - j = strlen(a->h_name) + 1; - if ((ret->h_name = OPENSSL_malloc(j)) == NULL) - goto err; - memcpy((char *)ret->h_name, a->h_name, j); - for (i = 0; a->h_aliases[i] != NULL; i++) { - j = strlen(a->h_aliases[i]) + 1; - if ((ret->h_aliases[i] = OPENSSL_malloc(j)) == NULL) - goto err; - memcpy(ret->h_aliases[i], a->h_aliases[i], j); - } - ret->h_length = a->h_length; - ret->h_addrtype = a->h_addrtype; - for (i = 0; a->h_addr_list[i] != NULL; i++) { - if ((ret->h_addr_list[i] = OPENSSL_malloc(a->h_length)) == NULL) - goto err; - memcpy(ret->h_addr_list[i], a->h_addr_list[i], a->h_length); - } - if (0) { -err: - if (ret != NULL) - ghbn_free(ret); - ret = NULL; - } - MemCheck_on(); - return (ret); -} - -static void -ghbn_free(struct hostent *a) -{ - int i; - - if (a == NULL) - return; - - if (a->h_aliases != NULL) { - for (i = 0; a->h_aliases[i] != NULL; i++) - OPENSSL_free(a->h_aliases[i]); - OPENSSL_free(a->h_aliases); - } - if (a->h_addr_list != NULL) { - for (i = 0; a->h_addr_list[i] != NULL; i++) - OPENSSL_free(a->h_addr_list[i]); - OPENSSL_free(a->h_addr_list); - } - if (a->h_name != NULL) - OPENSSL_free(a->h_name); - OPENSSL_free(a); -} - -#endif - -struct hostent -*BIO_gethostbyname(const char *name) -{ -#if 1 - /* Caching gethostbyname() results forever is wrong, - * so we have to let the true gethostbyname() worry about this */ -#if (defined(NETWARE_BSDSOCK) && !defined(__NOVELL_LIBC__)) - return gethostbyname((char*)name); -#else return gethostbyname(name); -#endif -#else - struct hostent *ret; - int i, lowi = 0, j; - unsigned long low = (unsigned long) - 1; - - -# if 0 - /* It doesn't make sense to use locking here: The function interface - * is not thread-safe, because threads can never be sure when - * some other thread destroys the data they were given a pointer to. - */ - CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); -# endif - j = strlen(name); - if (j < 128) { - for (i = 0; i < GHBN_NUM; i++) { - if (low > ghbn_cache[i].order) { - low = ghbn_cache[i].order; - lowi = i; - } - if (ghbn_cache[i].order > 0) { - if (strncmp(name, ghbn_cache[i].name, 128) == 0) - break; - } - } - } else - i = GHBN_NUM; - - if (i == GHBN_NUM) /* no hit*/ - { - BIO_ghbn_miss++; - /* Note: under VMS with SOCKETSHR, it seems like the first - * parameter is 'char *', instead of 'const char *' - */ -# ifndef CONST_STRICT - ret = gethostbyname((char *)name); -# else - ret = gethostbyname(name); -# endif - - if (ret == NULL) - goto end; - if (j > 128) /* too big to cache */ - { -# if 0 - /* If we were trying to make this function thread-safe (which - * is bound to fail), we'd have to give up in this case - * (or allocate more memory). */ - ret = NULL; -# endif - goto end; - } - - /* else add to cache */ - if (ghbn_cache[lowi].ent != NULL) - ghbn_free(ghbn_cache[lowi].ent); /* XXX not thread-safe */ - ghbn_cache[lowi].name[0] = '\0'; - - if ((ret = ghbn_cache[lowi].ent = ghbn_dup(ret)) == NULL) { - BIOerr(BIO_F_BIO_GETHOSTBYNAME, ERR_R_MALLOC_FAILURE); - goto end; - } - strncpy(ghbn_cache[lowi].name, name, 128); - ghbn_cache[lowi].order = BIO_ghbn_miss + BIO_ghbn_hits; - } else { - BIO_ghbn_hits++; - ret = ghbn_cache[i].ent; - ghbn_cache[i].order = BIO_ghbn_miss + BIO_ghbn_hits; - } -end: -# if 0 - CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME); -# endif - return (ret); -#endif } int BIO_sock_init(void) { -#ifdef WATT32 - extern int _watt_do_exit; - _watt_do_exit = 0; - /* don't make sock_init() call exit() */ - if (sock_init()) - return (-1); -#endif - -#if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) - WORD wVerReq; - WSADATA wsaData; - int err; - - if (!wsa_init_done) { - wsa_init_done = 1; - wVerReq = MAKEWORD( 2, 0 ); - err = WSAStartup(wVerReq, &wsaData); - if (err != 0) { - SYSerr(SYS_F_WSASTARTUP, err); - BIOerr(BIO_F_BIO_SOCK_INIT, BIO_R_WSASTARTUP); - return (-1); - } - } -#endif - return (1); } void BIO_sock_cleanup(void) { -#if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) - if (wsa_init_done) { - wsa_init_done = 0; - WSACleanup(); - } -#endif } -#if !defined(OPENSSL_SYS_VMS) || __VMS_VER >= 70000000 - int BIO_socket_ioctl(int fd, long type, void *arg) { @@ -509,28 +266,7 @@ BIO_socket_ioctl(int fd, long type, void *arg) #ifdef __DJGPP__ i = ioctl(fd, type, (char *)arg); #else -# if defined(OPENSSL_SYS_VMS) - /* 2011-02-18 SMS. - * VMS ioctl() can't tolerate a 64-bit "void *arg", but we - * observe that all the consumers pass in an "unsigned long *", - * so we arrange a local copy with a short pointer, and use - * that, instead. - */ -# if __INITIAL_POINTER_SIZE == 64 -# define ARG arg_32p -# pragma pointer_size save -# pragma pointer_size 32 - unsigned long arg_32; - unsigned long *arg_32p; -# pragma pointer_size restore - arg_32p = &arg_32; - arg_32 = *((unsigned long *) arg); -# else /* __INITIAL_POINTER_SIZE == 64 */ -# define ARG arg -# endif /* __INITIAL_POINTER_SIZE == 64 [else] */ -# else /* defined(OPENSSL_SYS_VMS) */ # define ARG arg -# endif /* defined(OPENSSL_SYS_VMS) [else] */ i = ioctl(fd, type, ARG); #endif /* __DJGPP__ */ @@ -538,7 +274,6 @@ BIO_socket_ioctl(int fd, long type, void *arg) SYSerr(SYS_F_IOCTLSOCKET, errno); return (i); } -#endif /* __VMS_VER */ /* The reason I have implemented this instead of using sscanf is because * Visual C 1.52c gives an unresolved external when linking a DLL :-( */ diff --git a/lib/libcrypto/bio/bio.h b/lib/libcrypto/bio/bio.h index 4f1d02ada5a..9bae034daa9 100644 --- a/lib/libcrypto/bio/bio.h +++ b/lib/libcrypto/bio/bio.h @@ -69,11 +69,7 @@ #include <openssl/crypto.h> #ifndef OPENSSL_NO_SCTP -# ifndef OPENSSL_SYS_VMS # include <stdint.h> -# else -# include <inttypes.h> -# endif #endif #ifdef __cplusplus @@ -671,16 +667,11 @@ BIO_METHOD *BIO_s_socket(void); BIO_METHOD *BIO_s_connect(void); BIO_METHOD *BIO_s_accept(void); BIO_METHOD *BIO_s_fd(void); -#ifndef OPENSSL_SYS_OS2 BIO_METHOD *BIO_s_log(void); -#endif BIO_METHOD *BIO_s_bio(void); BIO_METHOD *BIO_s_null(void); BIO_METHOD *BIO_f_null(void); BIO_METHOD *BIO_f_buffer(void); -#ifdef OPENSSL_SYS_VMS -BIO_METHOD *BIO_f_linebuffer(void); -#endif BIO_METHOD *BIO_f_nbio_test(void); #ifndef OPENSSL_NO_DGRAM BIO_METHOD *BIO_s_datagram(void); diff --git a/lib/libcrypto/bio/bio_cb.c b/lib/libcrypto/bio/bio_cb.c index 00f41b1de1e..a272bf969a9 100644 --- a/lib/libcrypto/bio/bio_cb.c +++ b/lib/libcrypto/bio/bio_cb.c @@ -139,7 +139,7 @@ BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, b = (BIO *)bio->cb_arg; if (b != NULL) BIO_write(b, buf, strlen(buf)); -#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) +#if !defined(OPENSSL_NO_STDIO) else fputs(buf, stderr); #endif diff --git a/lib/libcrypto/bio/bio_lcl.h b/lib/libcrypto/bio/bio_lcl.h index dba2919d430..cc89c1bf2dc 100644 --- a/lib/libcrypto/bio/bio_lcl.h +++ b/lib/libcrypto/bio/bio_lcl.h @@ -19,7 +19,6 @@ #define UP_fflush fflush #define UP_ferror ferror #define UP_fileno fileno - #define UP_open open #define UP_read read #define UP_write write diff --git a/lib/libcrypto/bio/bss_acpt.c b/lib/libcrypto/bio/bss_acpt.c index d772515d64b..d7c151eaaaa 100644 --- a/lib/libcrypto/bio/bss_acpt.c +++ b/lib/libcrypto/bio/bss_acpt.c @@ -64,16 +64,7 @@ #ifndef OPENSSL_NO_SOCK -#ifdef OPENSSL_SYS_WIN16 -#define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ -#else #define SOCKET_PROTOCOL IPPROTO_TCP -#endif - -#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000) -/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ -#undef FIONBIO -#endif typedef struct bio_accept_st { int state; diff --git a/lib/libcrypto/bio/bss_conn.c b/lib/libcrypto/bio/bss_conn.c index df34c49a4ad..db877b140be 100644 --- a/lib/libcrypto/bio/bss_conn.c +++ b/lib/libcrypto/bio/bss_conn.c @@ -64,17 +64,7 @@ #ifndef OPENSSL_NO_SOCK -#ifdef OPENSSL_SYS_WIN16 -#define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ -#else #define SOCKET_PROTOCOL IPPROTO_TCP -#endif - -#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000) -/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ -#undef FIONBIO -#endif - typedef struct bio_connect_st { int state; diff --git a/lib/libcrypto/bio/bss_dgram.c b/lib/libcrypto/bio/bss_dgram.c index 9219fffc8d0..478c7653998 100644 --- a/lib/libcrypto/bio/bss_dgram.c +++ b/lib/libcrypto/bio/bss_dgram.c @@ -66,10 +66,6 @@ #include <openssl/bio.h> #ifndef OPENSSL_NO_DGRAM -#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) -#include <sys/timeb.h> -#endif - #ifndef OPENSSL_NO_SCTP #include <netinet/sctp.h> #include <fcntl.h> @@ -91,12 +87,6 @@ ((a)->s6_addr32[2] == htonl(0x0000ffff))) #endif -#ifdef WATT32 -#define sock_write SockWrite /* Watt-32 uses same names */ -#define sock_read SockRead -#define sock_puts SockPuts -#endif - static int dgram_write(BIO *h, const char *buf, int num); static int dgram_read(BIO *h, char *buf, int size); static int dgram_puts(BIO *h, const char *str); diff --git a/lib/libcrypto/bio/bss_file.c b/lib/libcrypto/bio/bss_file.c index 982317b34a5..59e48e66590 100644 --- a/lib/libcrypto/bio/bss_file.c +++ b/lib/libcrypto/bio/bss_file.c @@ -89,10 +89,6 @@ #include "bio_lcl.h" #include <openssl/err.h> -#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) -#include <nwfileio.h> -#endif - #if !defined(OPENSSL_NO_STDIO) static int file_write(BIO *h, const char *buf, int num); @@ -122,46 +118,8 @@ BIO BIO *ret; FILE *file = NULL; -#if defined(_WIN32) && defined(CP_UTF8) - int sz, len_0 = (int)strlen(filename) + 1; - DWORD flags; - - /* - * Basically there are three cases to cover: a) filename is - * pure ASCII string; b) actual UTF-8 encoded string and - * c) locale-ized string, i.e. one containing 8-bit - * characters that are meaningful in current system locale. - * If filename is pure ASCII or real UTF-8 encoded string, - * MultiByteToWideChar succeeds and _wfopen works. If - * filename is locale-ized string, chances are that - * MultiByteToWideChar fails reporting - * ERROR_NO_UNICODE_TRANSLATION, in which case we fall - * back to fopen... - */ - if ((sz = MultiByteToWideChar(CP_UTF8,(flags = MB_ERR_INVALID_CHARS), - filename, len_0, NULL, 0)) > 0 || - (GetLastError() == ERROR_INVALID_FLAGS && - (sz = MultiByteToWideChar(CP_UTF8,(flags = 0), - filename, len_0, NULL, 0)) > 0)) { - WCHAR wmode[8]; - WCHAR *wfilename = _alloca(sz*sizeof(WCHAR)); - - if (MultiByteToWideChar(CP_UTF8, flags, filename, len_0, - wfilename, sz) && MultiByteToWideChar(CP_UTF8, 0, mode, - strlen(mode) + 1, wmode, - sizeof(wmode) / sizeof(wmode[0])) && - (file = _wfopen(wfilename, wmode)) == NULL && - (errno == ENOENT || errno == EBADF) - ) /* UTF - 8 decode succeeded, but no file, filename - * could still have been locale-ized... */ - file = fopen(filename, mode); - } else if (GetLastError() == ERROR_NO_UNICODE_TRANSLATION) { - file = fopen(filename, mode); - } -#else file = fopen(filename, mode); -#endif if (file == NULL) { SYSerr(SYS_F_FOPEN, errno); ERR_add_error_data(5, "fopen('", filename, "', '", mode, "')"); @@ -304,9 +262,6 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) b->ptr = ptr; b->init = 1; #if BIO_FLAGS_UPLINK!=0 -#if defined(__MINGW32__) && defined(__MSVCRT__) && !defined(_IOB_ENTRIES) -#define _IOB_ENTRIES 20 -#endif #if defined(_IOB_ENTRIES) /* Safety net to catch purely internal BIO_set_fp calls */ if ((size_t)ptr >= (size_t)stdin && @@ -317,37 +272,7 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) #ifdef UP_fsetmod if (b->flags&BIO_FLAGS_UPLINK) UP_fsetmod(b->ptr,(char)((num&BIO_FP_TEXT)?'t':'b')); - else #endif - { -#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) - int fd = fileno((FILE*)ptr); - /* Under CLib there are differences in file modes */ - if (num & BIO_FP_TEXT) - setmode(fd, O_TEXT); - else - setmode(fd, O_BINARY); -#elif defined(OPENSSL_SYS_MSDOS) - int fd = fileno((FILE*)ptr); - /* Set correct text/binary mode */ - if (num & BIO_FP_TEXT) - _setmode(fd, _O_TEXT); - /* Dangerous to set stdin/stdout to raw (unless redirected) */ - else { - if (fd == STDIN_FILENO || fd == STDOUT_FILENO) { - if (isatty(fd) <= 0) - _setmode(fd, _O_BINARY); - } else - _setmode(fd, _O_BINARY); - } -#elif defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_WIN32_CYGWIN) - int fd = fileno((FILE*)ptr); - if (num & BIO_FP_TEXT) - setmode(fd, O_TEXT); - else - setmode(fd, O_BINARY); -#endif - } break; case BIO_C_SET_FILENAME: file_free(b); @@ -367,18 +292,6 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) ret = 0; break; } -#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_WIN32_CYGWIN) - if (!(num & BIO_FP_TEXT)) - strcat(p, "b"); - else - strcat(p, "t"); -#endif -#if defined(OPENSSL_SYS_NETWARE) - if (!(num & BIO_FP_TEXT)) - strcat(p, "b"); - else - strcat(p, "t"); -#endif fp = fopen(ptr, p); if (fp == NULL) { SYSerr(SYS_F_FOPEN, errno); diff --git a/lib/libcrypto/bio/bss_log.c b/lib/libcrypto/bio/bss_log.c index 9225af4df2b..5a79f72673e 100644 --- a/lib/libcrypto/bio/bss_log.c +++ b/lib/libcrypto/bio/bss_log.c @@ -68,59 +68,13 @@ #include "cryptlib.h" -#if defined(OPENSSL_SYS_WINCE) -#elif defined(OPENSSL_SYS_WIN32) -#elif defined(OPENSSL_SYS_VMS) -# include <opcdef.h> -# include <descrip.h> -# include <lib$routines.h> -# include <starlet.h> -/* Some compiler options may mask the declaration of "_malloc32". */ -# if __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE -# if __INITIAL_POINTER_SIZE == 64 -# pragma pointer_size save -# pragma pointer_size 32 -void * _malloc32 (__size_t); -# pragma pointer_size restore -# endif /* __INITIAL_POINTER_SIZE == 64 */ -# endif /* __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE */ -#elif defined(__ultrix) -# include <sys/syslog.h> -#elif defined(OPENSSL_SYS_NETWARE) -# define NO_SYSLOG -#elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG) -# include <syslog.h> -#endif +#include <syslog.h> #include <openssl/buffer.h> #include <openssl/err.h> #ifndef NO_SYSLOG -#if defined(OPENSSL_SYS_WIN32) -#define LOG_EMERG 0 -#define LOG_ALERT 1 -#define LOG_CRIT 2 -#define LOG_ERR 3 -#define LOG_WARNING 4 -#define LOG_NOTICE 5 -#define LOG_INFO 6 -#define LOG_DEBUG 7 - -#define LOG_DAEMON (3<<3) -#elif defined(OPENSSL_SYS_VMS) -/* On VMS, we don't really care about these, but we need them to compile */ -#define LOG_EMERG 0 -#define LOG_ALERT 1 -#define LOG_CRIT 2 -#define LOG_ERR 3 -#define LOG_WARNING 4 -#define LOG_NOTICE 5 -#define LOG_INFO 6 -#define LOG_DEBUG 7 - -#define LOG_DAEMON OPC$M_NM_NTWORK -#endif static int slg_write(BIO *h, const char *buf, int num); static int slg_puts(BIO *h, const char *str); @@ -245,161 +199,11 @@ slg_puts(BIO *bp, const char *str) return (ret); } -#if defined(OPENSSL_SYS_WIN32) - -static void -xopenlog(BIO* bp, char* name, int level) -{ - if (check_winnt()) - bp->ptr = RegisterEventSourceA(NULL, name); - else - bp->ptr = NULL; -} - -static void -xsyslog(BIO *bp, int priority, const char *string) -{ - LPCSTR lpszStrings[2]; - WORD evtype = EVENTLOG_ERROR_TYPE; - char pidbuf[DECIMAL_SIZE(DWORD) + 4]; - - if (bp->ptr == NULL) - return; - - switch (priority) { - case LOG_EMERG: - case LOG_ALERT: - case LOG_CRIT: - case LOG_ERR: - evtype = EVENTLOG_ERROR_TYPE; - break; - case LOG_WARNING: - evtype = EVENTLOG_WARNING_TYPE; - break; - case LOG_NOTICE: - case LOG_INFO: - case LOG_DEBUG: - evtype = EVENTLOG_INFORMATION_TYPE; - break; - default: /* Should never happen, but set it - as error anyway. */ - evtype = EVENTLOG_ERROR_TYPE; - break; - } - - sprintf(pidbuf, "[%u] ", GetCurrentProcessId()); - lpszStrings[0] = pidbuf; - lpszStrings[1] = string; - - ReportEventA(bp->ptr, evtype, 0, 1024, NULL, 2, 0, - lpszStrings, NULL); -} - -static void -xcloselog(BIO* bp) -{ - if (bp->ptr) - DeregisterEventSource((HANDLE)(bp->ptr)); - bp->ptr = NULL; -} - -#elif defined(OPENSSL_SYS_VMS) - -static int VMS_OPC_target = LOG_DAEMON; - -static void -xopenlog(BIO* bp, char* name, int level) -{ - VMS_OPC_target = level; - -} - -static void -xsyslog(BIO *bp, int priority, const char *string) -{ - struct dsc$descriptor_s opc_dsc; - -/* Arrange 32-bit pointer to opcdef buffer and malloc(), if needed. */ -#if __INITIAL_POINTER_SIZE == 64 -# pragma pointer_size save -# pragma pointer_size 32 -# define OPCDEF_TYPE __char_ptr32 -# define OPCDEF_MALLOC _malloc32 -#else /* __INITIAL_POINTER_SIZE == 64 */ -# define OPCDEF_TYPE char * -# define OPCDEF_MALLOC OPENSSL_malloc -#endif /* __INITIAL_POINTER_SIZE == 64 [else] */ - - struct opcdef *opcdef_p; - -#if __INITIAL_POINTER_SIZE == 64 -# pragma pointer_size restore -#endif /* __INITIAL_POINTER_SIZE == 64 */ - - char buf[10240]; - unsigned int len; - struct dsc$descriptor_s buf_dsc; - $DESCRIPTOR(fao_cmd, "!AZ: !AZ"); - char *priority_tag; - - switch (priority) { - case LOG_EMERG: - priority_tag = "Emergency"; break; - case LOG_ALERT: - priority_tag = "Alert"; break; - case LOG_CRIT: - priority_tag = "Critical"; break; - case LOG_ERR: - priority_tag = "Error"; break; - case LOG_WARNING: - priority_tag = "Warning"; break; - case LOG_NOTICE: - priority_tag = "Notice"; break; - case LOG_INFO: - priority_tag = "Info"; break; - case LOG_DEBUG: - priority_tag = "DEBUG"; break; - } - - buf_dsc.dsc$b_dtype = DSC$K_DTYPE_T; - buf_dsc.dsc$b_class = DSC$K_CLASS_S; - buf_dsc.dsc$a_pointer = buf; - buf_dsc.dsc$w_length = sizeof(buf) - 1; - - lib$sys_fao(&fao_cmd, &len, &buf_dsc, priority_tag, string); - - /* We know there's an 8-byte header. That's documented. */ - opcdef_p = OPCDEF_MALLOC( 8 + len); - opcdef_p->opc$b_ms_type = OPC$_RQ_RQST; - memcpy(opcdef_p->opc$z_ms_target_classes, &VMS_OPC_target, 3); - opcdef_p->opc$l_ms_rqstid = 0; - memcpy(&opcdef_p->opc$l_ms_text, buf, len); - - opc_dsc.dsc$b_dtype = DSC$K_DTYPE_T; - opc_dsc.dsc$b_class = DSC$K_CLASS_S; - opc_dsc.dsc$a_pointer = (OPCDEF_TYPE) opcdef_p; - opc_dsc.dsc$w_length = len + 8; - - sys$sndopr(opc_dsc, 0); - - OPENSSL_free(opcdef_p); -} - -static void -xcloselog(BIO* bp) -{ -} - -#else /* Unix/Watt32 */ static void xopenlog(BIO* bp, char* name, int level) { -#ifdef WATT32 /* djgpp/DOS */ - openlog(name, LOG_PID|LOG_CONS|LOG_NDELAY, level); -#else openlog(name, LOG_PID|LOG_CONS, level); -#endif } static void @@ -414,6 +218,5 @@ xcloselog(BIO* bp) closelog(); } -#endif /* Unix */ #endif /* NO_SYSLOG */ diff --git a/lib/libcrypto/bio/bss_sock.c b/lib/libcrypto/bio/bss_sock.c index c05b8d37f1d..b9cf817a0c4 100644 --- a/lib/libcrypto/bio/bss_sock.c +++ b/lib/libcrypto/bio/bss_sock.c @@ -65,12 +65,6 @@ #include <openssl/bio.h> -#ifdef WATT32 -#define sock_write SockWrite /* Watt-32 uses same names */ -#define sock_read SockRead -#define sock_puts SockPuts -#endif - static int sock_write(BIO *h, const char *buf, int num); static int sock_read(BIO *h, char *buf, int size); static int sock_puts(BIO *h, const char *str); |