diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/bio/b_sock.c | 269 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio.h | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio_cb.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio_lcl.h | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_acpt.c | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_conn.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_dgram.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_file.c | 87 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_log.c | 199 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_sock.c | 6 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/b_sock.c | 269 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/bio.h | 9 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/bio_cb.c | 2 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/bio_lcl.h | 9 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/bss_acpt.c | 9 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/bss_conn.c | 10 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/bss_dgram.c | 10 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/bss_file.c | 87 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/bss_log.c | 199 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/bss_sock.c | 6 |
20 files changed, 8 insertions, 1212 deletions
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index cd62f889ab..3ccebf77f4 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
@@ -184,14 +184,7 @@ BIO_get_port(const char *str, unsigned short *port_ptr) | |||
184 | *port_ptr = (unsigned short)i; | 184 | *port_ptr = (unsigned short)i; |
185 | else { | 185 | else { |
186 | CRYPTO_w_lock(CRYPTO_LOCK_GETSERVBYNAME); | 186 | CRYPTO_w_lock(CRYPTO_LOCK_GETSERVBYNAME); |
187 | /* Note: under VMS with SOCKETSHR, it seems like the first | ||
188 | * parameter is 'char *', instead of 'const char *' | ||
189 | */ | ||
190 | #ifndef CONST_STRICT | ||
191 | s = getservbyname((char *)str, "tcp"); | ||
192 | #else | ||
193 | s = getservbyname(str, "tcp"); | 187 | s = getservbyname(str, "tcp"); |
194 | #endif | ||
195 | if (s != NULL) | 188 | if (s != NULL) |
196 | *port_ptr = ntohs((unsigned short)s->s_port); | 189 | *port_ptr = ntohs((unsigned short)s->s_port); |
197 | CRYPTO_w_unlock(CRYPTO_LOCK_GETSERVBYNAME); | 190 | CRYPTO_w_unlock(CRYPTO_LOCK_GETSERVBYNAME); |
@@ -247,260 +240,24 @@ BIO_sock_error(int sock) | |||
247 | return (j); | 240 | return (j); |
248 | } | 241 | } |
249 | 242 | ||
250 | #if 0 | 243 | struct hostent * |
251 | long | 244 | BIO_gethostbyname(const char *name) |
252 | BIO_ghbn_ctrl(int cmd, int iarg, char *parg) | ||
253 | { | ||
254 | int i; | ||
255 | char **p; | ||
256 | |||
257 | switch (cmd) { | ||
258 | case BIO_GHBN_CTRL_HITS: | ||
259 | return (BIO_ghbn_hits); | ||
260 | /* break; */ | ||
261 | case BIO_GHBN_CTRL_MISSES: | ||
262 | return (BIO_ghbn_miss); | ||
263 | /* break; */ | ||
264 | case BIO_GHBN_CTRL_CACHE_SIZE: | ||
265 | return (GHBN_NUM); | ||
266 | /* break; */ | ||
267 | case BIO_GHBN_CTRL_GET_ENTRY: | ||
268 | if ((iarg >= 0) && (iarg < GHBN_NUM) && | ||
269 | (ghbn_cache[iarg].order > 0)) { | ||
270 | p = (char **)parg; | ||
271 | if (p == NULL) | ||
272 | return (0); | ||
273 | *p = ghbn_cache[iarg].name; | ||
274 | ghbn_cache[iarg].name[128] = '\0'; | ||
275 | return (1); | ||
276 | } | ||
277 | return (0); | ||
278 | /* break; */ | ||
279 | case BIO_GHBN_CTRL_FLUSH: | ||
280 | for (i = 0; i < GHBN_NUM; i++) | ||
281 | ghbn_cache[i].order = 0; | ||
282 | break; | ||
283 | default: | ||
284 | return (0); | ||
285 | } | ||
286 | return (1); | ||
287 | } | ||
288 | #endif | ||
289 | |||
290 | #if 0 | ||
291 | static struct hostent | ||
292 | *ghbn_dup(struct hostent *a) | ||
293 | { | 245 | { |
294 | struct hostent *ret; | ||
295 | int i, j; | ||
296 | |||
297 | MemCheck_off(); | ||
298 | ret = (struct hostent *)OPENSSL_malloc(sizeof(struct hostent)); | ||
299 | if (ret == NULL) | ||
300 | return (NULL); | ||
301 | memset(ret, 0, sizeof(struct hostent)); | ||
302 | |||
303 | for (i = 0; a->h_aliases[i] != NULL; i++) | ||
304 | ; | ||
305 | i++; | ||
306 | ret->h_aliases = (char **)OPENSSL_malloc(i*sizeof(char *)); | ||
307 | if (ret->h_aliases == NULL) | ||
308 | goto err; | ||
309 | memset(ret->h_aliases, 0, i*sizeof(char *)); | ||
310 | |||
311 | for (i = 0; a->h_addr_list[i] != NULL; i++) | ||
312 | ; | ||
313 | i++; | ||
314 | ret->h_addr_list = (char **)OPENSSL_malloc(i*sizeof(char *)); | ||
315 | if (ret->h_addr_list == NULL) | ||
316 | goto err; | ||
317 | memset(ret->h_addr_list, 0, i*sizeof(char *)); | ||
318 | |||
319 | j = strlen(a->h_name) + 1; | ||
320 | if ((ret->h_name = OPENSSL_malloc(j)) == NULL) | ||
321 | goto err; | ||
322 | memcpy((char *)ret->h_name, a->h_name, j); | ||
323 | for (i = 0; a->h_aliases[i] != NULL; i++) { | ||
324 | j = strlen(a->h_aliases[i]) + 1; | ||
325 | if ((ret->h_aliases[i] = OPENSSL_malloc(j)) == NULL) | ||
326 | goto err; | ||
327 | memcpy(ret->h_aliases[i], a->h_aliases[i], j); | ||
328 | } | ||
329 | ret->h_length = a->h_length; | ||
330 | ret->h_addrtype = a->h_addrtype; | ||
331 | for (i = 0; a->h_addr_list[i] != NULL; i++) { | ||
332 | if ((ret->h_addr_list[i] = OPENSSL_malloc(a->h_length)) == NULL) | ||
333 | goto err; | ||
334 | memcpy(ret->h_addr_list[i], a->h_addr_list[i], a->h_length); | ||
335 | } | ||
336 | if (0) { | ||
337 | err: | ||
338 | if (ret != NULL) | ||
339 | ghbn_free(ret); | ||
340 | ret = NULL; | ||
341 | } | ||
342 | MemCheck_on(); | ||
343 | return (ret); | ||
344 | } | ||
345 | |||
346 | static void | ||
347 | ghbn_free(struct hostent *a) | ||
348 | { | ||
349 | int i; | ||
350 | |||
351 | if (a == NULL) | ||
352 | return; | ||
353 | |||
354 | if (a->h_aliases != NULL) { | ||
355 | for (i = 0; a->h_aliases[i] != NULL; i++) | ||
356 | OPENSSL_free(a->h_aliases[i]); | ||
357 | OPENSSL_free(a->h_aliases); | ||
358 | } | ||
359 | if (a->h_addr_list != NULL) { | ||
360 | for (i = 0; a->h_addr_list[i] != NULL; i++) | ||
361 | OPENSSL_free(a->h_addr_list[i]); | ||
362 | OPENSSL_free(a->h_addr_list); | ||
363 | } | ||
364 | if (a->h_name != NULL) | ||
365 | OPENSSL_free(a->h_name); | ||
366 | OPENSSL_free(a); | ||
367 | } | ||
368 | |||
369 | #endif | ||
370 | |||
371 | struct hostent | ||
372 | *BIO_gethostbyname(const char *name) | ||
373 | { | ||
374 | #if 1 | ||
375 | /* Caching gethostbyname() results forever is wrong, | ||
376 | * so we have to let the true gethostbyname() worry about this */ | ||
377 | #if (defined(NETWARE_BSDSOCK) && !defined(__NOVELL_LIBC__)) | ||
378 | return gethostbyname((char*)name); | ||
379 | #else | ||
380 | return gethostbyname(name); | 246 | return gethostbyname(name); |
381 | #endif | ||
382 | #else | ||
383 | struct hostent *ret; | ||
384 | int i, lowi = 0, j; | ||
385 | unsigned long low = (unsigned long) - 1; | ||
386 | |||
387 | |||
388 | # if 0 | ||
389 | /* It doesn't make sense to use locking here: The function interface | ||
390 | * is not thread-safe, because threads can never be sure when | ||
391 | * some other thread destroys the data they were given a pointer to. | ||
392 | */ | ||
393 | CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); | ||
394 | # endif | ||
395 | j = strlen(name); | ||
396 | if (j < 128) { | ||
397 | for (i = 0; i < GHBN_NUM; i++) { | ||
398 | if (low > ghbn_cache[i].order) { | ||
399 | low = ghbn_cache[i].order; | ||
400 | lowi = i; | ||
401 | } | ||
402 | if (ghbn_cache[i].order > 0) { | ||
403 | if (strncmp(name, ghbn_cache[i].name, 128) == 0) | ||
404 | break; | ||
405 | } | ||
406 | } | ||
407 | } else | ||
408 | i = GHBN_NUM; | ||
409 | |||
410 | if (i == GHBN_NUM) /* no hit*/ | ||
411 | { | ||
412 | BIO_ghbn_miss++; | ||
413 | /* Note: under VMS with SOCKETSHR, it seems like the first | ||
414 | * parameter is 'char *', instead of 'const char *' | ||
415 | */ | ||
416 | # ifndef CONST_STRICT | ||
417 | ret = gethostbyname((char *)name); | ||
418 | # else | ||
419 | ret = gethostbyname(name); | ||
420 | # endif | ||
421 | |||
422 | if (ret == NULL) | ||
423 | goto end; | ||
424 | if (j > 128) /* too big to cache */ | ||
425 | { | ||
426 | # if 0 | ||
427 | /* If we were trying to make this function thread-safe (which | ||
428 | * is bound to fail), we'd have to give up in this case | ||
429 | * (or allocate more memory). */ | ||
430 | ret = NULL; | ||
431 | # endif | ||
432 | goto end; | ||
433 | } | ||
434 | |||
435 | /* else add to cache */ | ||
436 | if (ghbn_cache[lowi].ent != NULL) | ||
437 | ghbn_free(ghbn_cache[lowi].ent); /* XXX not thread-safe */ | ||
438 | ghbn_cache[lowi].name[0] = '\0'; | ||
439 | |||
440 | if ((ret = ghbn_cache[lowi].ent = ghbn_dup(ret)) == NULL) { | ||
441 | BIOerr(BIO_F_BIO_GETHOSTBYNAME, ERR_R_MALLOC_FAILURE); | ||
442 | goto end; | ||
443 | } | ||
444 | strncpy(ghbn_cache[lowi].name, name, 128); | ||
445 | ghbn_cache[lowi].order = BIO_ghbn_miss + BIO_ghbn_hits; | ||
446 | } else { | ||
447 | BIO_ghbn_hits++; | ||
448 | ret = ghbn_cache[i].ent; | ||
449 | ghbn_cache[i].order = BIO_ghbn_miss + BIO_ghbn_hits; | ||
450 | } | ||
451 | end: | ||
452 | # if 0 | ||
453 | CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME); | ||
454 | # endif | ||
455 | return (ret); | ||
456 | #endif | ||
457 | } | 247 | } |
458 | 248 | ||
459 | 249 | ||
460 | int | 250 | int |
461 | BIO_sock_init(void) | 251 | BIO_sock_init(void) |
462 | { | 252 | { |
463 | #ifdef WATT32 | ||
464 | extern int _watt_do_exit; | ||
465 | _watt_do_exit = 0; | ||
466 | /* don't make sock_init() call exit() */ | ||
467 | if (sock_init()) | ||
468 | return (-1); | ||
469 | #endif | ||
470 | |||
471 | #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) | ||
472 | WORD wVerReq; | ||
473 | WSADATA wsaData; | ||
474 | int err; | ||
475 | |||
476 | if (!wsa_init_done) { | ||
477 | wsa_init_done = 1; | ||
478 | wVerReq = MAKEWORD( 2, 0 ); | ||
479 | err = WSAStartup(wVerReq, &wsaData); | ||
480 | if (err != 0) { | ||
481 | SYSerr(SYS_F_WSASTARTUP, err); | ||
482 | BIOerr(BIO_F_BIO_SOCK_INIT, BIO_R_WSASTARTUP); | ||
483 | return (-1); | ||
484 | } | ||
485 | } | ||
486 | #endif | ||
487 | |||
488 | return (1); | 253 | return (1); |
489 | } | 254 | } |
490 | 255 | ||
491 | void | 256 | void |
492 | BIO_sock_cleanup(void) | 257 | BIO_sock_cleanup(void) |
493 | { | 258 | { |
494 | #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) | ||
495 | if (wsa_init_done) { | ||
496 | wsa_init_done = 0; | ||
497 | WSACleanup(); | ||
498 | } | ||
499 | #endif | ||
500 | } | 259 | } |
501 | 260 | ||
502 | #if !defined(OPENSSL_SYS_VMS) || __VMS_VER >= 70000000 | ||
503 | |||
504 | int | 261 | int |
505 | BIO_socket_ioctl(int fd, long type, void *arg) | 262 | BIO_socket_ioctl(int fd, long type, void *arg) |
506 | { | 263 | { |
@@ -509,28 +266,7 @@ BIO_socket_ioctl(int fd, long type, void *arg) | |||
509 | #ifdef __DJGPP__ | 266 | #ifdef __DJGPP__ |
510 | i = ioctl(fd, type, (char *)arg); | 267 | i = ioctl(fd, type, (char *)arg); |
511 | #else | 268 | #else |
512 | # if defined(OPENSSL_SYS_VMS) | ||
513 | /* 2011-02-18 SMS. | ||
514 | * VMS ioctl() can't tolerate a 64-bit "void *arg", but we | ||
515 | * observe that all the consumers pass in an "unsigned long *", | ||
516 | * so we arrange a local copy with a short pointer, and use | ||
517 | * that, instead. | ||
518 | */ | ||
519 | # if __INITIAL_POINTER_SIZE == 64 | ||
520 | # define ARG arg_32p | ||
521 | # pragma pointer_size save | ||
522 | # pragma pointer_size 32 | ||
523 | unsigned long arg_32; | ||
524 | unsigned long *arg_32p; | ||
525 | # pragma pointer_size restore | ||
526 | arg_32p = &arg_32; | ||
527 | arg_32 = *((unsigned long *) arg); | ||
528 | # else /* __INITIAL_POINTER_SIZE == 64 */ | ||
529 | # define ARG arg | ||
530 | # endif /* __INITIAL_POINTER_SIZE == 64 [else] */ | ||
531 | # else /* defined(OPENSSL_SYS_VMS) */ | ||
532 | # define ARG arg | 269 | # define ARG arg |
533 | # endif /* defined(OPENSSL_SYS_VMS) [else] */ | ||
534 | 270 | ||
535 | i = ioctl(fd, type, ARG); | 271 | i = ioctl(fd, type, ARG); |
536 | #endif /* __DJGPP__ */ | 272 | #endif /* __DJGPP__ */ |
@@ -538,7 +274,6 @@ BIO_socket_ioctl(int fd, long type, void *arg) | |||
538 | SYSerr(SYS_F_IOCTLSOCKET, errno); | 274 | SYSerr(SYS_F_IOCTLSOCKET, errno); |
539 | return (i); | 275 | return (i); |
540 | } | 276 | } |
541 | #endif /* __VMS_VER */ | ||
542 | 277 | ||
543 | /* The reason I have implemented this instead of using sscanf is because | 278 | /* The reason I have implemented this instead of using sscanf is because |
544 | * Visual C 1.52c gives an unresolved external when linking a DLL :-( */ | 279 | * Visual C 1.52c gives an unresolved external when linking a DLL :-( */ |
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index 4f1d02ada5..9bae034daa 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
@@ -69,11 +69,7 @@ | |||
69 | #include <openssl/crypto.h> | 69 | #include <openssl/crypto.h> |
70 | 70 | ||
71 | #ifndef OPENSSL_NO_SCTP | 71 | #ifndef OPENSSL_NO_SCTP |
72 | # ifndef OPENSSL_SYS_VMS | ||
73 | # include <stdint.h> | 72 | # include <stdint.h> |
74 | # else | ||
75 | # include <inttypes.h> | ||
76 | # endif | ||
77 | #endif | 73 | #endif |
78 | 74 | ||
79 | #ifdef __cplusplus | 75 | #ifdef __cplusplus |
@@ -671,16 +667,11 @@ BIO_METHOD *BIO_s_socket(void); | |||
671 | BIO_METHOD *BIO_s_connect(void); | 667 | BIO_METHOD *BIO_s_connect(void); |
672 | BIO_METHOD *BIO_s_accept(void); | 668 | BIO_METHOD *BIO_s_accept(void); |
673 | BIO_METHOD *BIO_s_fd(void); | 669 | BIO_METHOD *BIO_s_fd(void); |
674 | #ifndef OPENSSL_SYS_OS2 | ||
675 | BIO_METHOD *BIO_s_log(void); | 670 | BIO_METHOD *BIO_s_log(void); |
676 | #endif | ||
677 | BIO_METHOD *BIO_s_bio(void); | 671 | BIO_METHOD *BIO_s_bio(void); |
678 | BIO_METHOD *BIO_s_null(void); | 672 | BIO_METHOD *BIO_s_null(void); |
679 | BIO_METHOD *BIO_f_null(void); | 673 | BIO_METHOD *BIO_f_null(void); |
680 | BIO_METHOD *BIO_f_buffer(void); | 674 | BIO_METHOD *BIO_f_buffer(void); |
681 | #ifdef OPENSSL_SYS_VMS | ||
682 | BIO_METHOD *BIO_f_linebuffer(void); | ||
683 | #endif | ||
684 | BIO_METHOD *BIO_f_nbio_test(void); | 675 | BIO_METHOD *BIO_f_nbio_test(void); |
685 | #ifndef OPENSSL_NO_DGRAM | 676 | #ifndef OPENSSL_NO_DGRAM |
686 | BIO_METHOD *BIO_s_datagram(void); | 677 | BIO_METHOD *BIO_s_datagram(void); |
diff --git a/src/lib/libcrypto/bio/bio_cb.c b/src/lib/libcrypto/bio/bio_cb.c index 00f41b1de1..a272bf969a 100644 --- a/src/lib/libcrypto/bio/bio_cb.c +++ b/src/lib/libcrypto/bio/bio_cb.c | |||
@@ -139,7 +139,7 @@ BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, | |||
139 | b = (BIO *)bio->cb_arg; | 139 | b = (BIO *)bio->cb_arg; |
140 | if (b != NULL) | 140 | if (b != NULL) |
141 | BIO_write(b, buf, strlen(buf)); | 141 | BIO_write(b, buf, strlen(buf)); |
142 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) | 142 | #if !defined(OPENSSL_NO_STDIO) |
143 | else | 143 | else |
144 | fputs(buf, stderr); | 144 | fputs(buf, stderr); |
145 | #endif | 145 | #endif |
diff --git a/src/lib/libcrypto/bio/bio_lcl.h b/src/lib/libcrypto/bio/bio_lcl.h index e7f7ec8d8b..cc89c1bf2d 100644 --- a/src/lib/libcrypto/bio/bio_lcl.h +++ b/src/lib/libcrypto/bio/bio_lcl.h | |||
@@ -18,14 +18,6 @@ | |||
18 | #define UP_ftell ftell | 18 | #define UP_ftell ftell |
19 | #define UP_fflush fflush | 19 | #define UP_fflush fflush |
20 | #define UP_ferror ferror | 20 | #define UP_ferror ferror |
21 | #ifdef _WIN32 | ||
22 | #define UP_fileno _fileno | ||
23 | #define UP_open _open | ||
24 | #define UP_read _read | ||
25 | #define UP_write _write | ||
26 | #define UP_lseek _lseek | ||
27 | #define UP_close _close | ||
28 | #else | ||
29 | #define UP_fileno fileno | 21 | #define UP_fileno fileno |
30 | #define UP_open open | 22 | #define UP_open open |
31 | #define UP_read read | 23 | #define UP_read read |
@@ -33,4 +25,3 @@ | |||
33 | #define UP_lseek lseek | 25 | #define UP_lseek lseek |
34 | #define UP_close close | 26 | #define UP_close close |
35 | #endif | 27 | #endif |
36 | #endif | ||
diff --git a/src/lib/libcrypto/bio/bss_acpt.c b/src/lib/libcrypto/bio/bss_acpt.c index d772515d64..d7c151eaaa 100644 --- a/src/lib/libcrypto/bio/bss_acpt.c +++ b/src/lib/libcrypto/bio/bss_acpt.c | |||
@@ -64,16 +64,7 @@ | |||
64 | 64 | ||
65 | #ifndef OPENSSL_NO_SOCK | 65 | #ifndef OPENSSL_NO_SOCK |
66 | 66 | ||
67 | #ifdef OPENSSL_SYS_WIN16 | ||
68 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ | ||
69 | #else | ||
70 | #define SOCKET_PROTOCOL IPPROTO_TCP | 67 | #define SOCKET_PROTOCOL IPPROTO_TCP |
71 | #endif | ||
72 | |||
73 | #if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000) | ||
74 | /* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ | ||
75 | #undef FIONBIO | ||
76 | #endif | ||
77 | 68 | ||
78 | typedef struct bio_accept_st { | 69 | typedef struct bio_accept_st { |
79 | int state; | 70 | int state; |
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c index df34c49a4a..db877b140b 100644 --- a/src/lib/libcrypto/bio/bss_conn.c +++ b/src/lib/libcrypto/bio/bss_conn.c | |||
@@ -64,17 +64,7 @@ | |||
64 | 64 | ||
65 | #ifndef OPENSSL_NO_SOCK | 65 | #ifndef OPENSSL_NO_SOCK |
66 | 66 | ||
67 | #ifdef OPENSSL_SYS_WIN16 | ||
68 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ | ||
69 | #else | ||
70 | #define SOCKET_PROTOCOL IPPROTO_TCP | 67 | #define SOCKET_PROTOCOL IPPROTO_TCP |
71 | #endif | ||
72 | |||
73 | #if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000) | ||
74 | /* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ | ||
75 | #undef FIONBIO | ||
76 | #endif | ||
77 | |||
78 | 68 | ||
79 | typedef struct bio_connect_st { | 69 | typedef struct bio_connect_st { |
80 | int state; | 70 | int state; |
diff --git a/src/lib/libcrypto/bio/bss_dgram.c b/src/lib/libcrypto/bio/bss_dgram.c index 9219fffc8d..478c765399 100644 --- a/src/lib/libcrypto/bio/bss_dgram.c +++ b/src/lib/libcrypto/bio/bss_dgram.c | |||
@@ -66,10 +66,6 @@ | |||
66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
67 | #ifndef OPENSSL_NO_DGRAM | 67 | #ifndef OPENSSL_NO_DGRAM |
68 | 68 | ||
69 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) | ||
70 | #include <sys/timeb.h> | ||
71 | #endif | ||
72 | |||
73 | #ifndef OPENSSL_NO_SCTP | 69 | #ifndef OPENSSL_NO_SCTP |
74 | #include <netinet/sctp.h> | 70 | #include <netinet/sctp.h> |
75 | #include <fcntl.h> | 71 | #include <fcntl.h> |
@@ -91,12 +87,6 @@ | |||
91 | ((a)->s6_addr32[2] == htonl(0x0000ffff))) | 87 | ((a)->s6_addr32[2] == htonl(0x0000ffff))) |
92 | #endif | 88 | #endif |
93 | 89 | ||
94 | #ifdef WATT32 | ||
95 | #define sock_write SockWrite /* Watt-32 uses same names */ | ||
96 | #define sock_read SockRead | ||
97 | #define sock_puts SockPuts | ||
98 | #endif | ||
99 | |||
100 | static int dgram_write(BIO *h, const char *buf, int num); | 90 | static int dgram_write(BIO *h, const char *buf, int num); |
101 | static int dgram_read(BIO *h, char *buf, int size); | 91 | static int dgram_read(BIO *h, char *buf, int size); |
102 | static int dgram_puts(BIO *h, const char *str); | 92 | static int dgram_puts(BIO *h, const char *str); |
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c index 982317b34a..59e48e6659 100644 --- a/src/lib/libcrypto/bio/bss_file.c +++ b/src/lib/libcrypto/bio/bss_file.c | |||
@@ -89,10 +89,6 @@ | |||
89 | #include "bio_lcl.h" | 89 | #include "bio_lcl.h" |
90 | #include <openssl/err.h> | 90 | #include <openssl/err.h> |
91 | 91 | ||
92 | #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) | ||
93 | #include <nwfileio.h> | ||
94 | #endif | ||
95 | |||
96 | #if !defined(OPENSSL_NO_STDIO) | 92 | #if !defined(OPENSSL_NO_STDIO) |
97 | 93 | ||
98 | static int file_write(BIO *h, const char *buf, int num); | 94 | static int file_write(BIO *h, const char *buf, int num); |
@@ -122,46 +118,8 @@ BIO | |||
122 | BIO *ret; | 118 | BIO *ret; |
123 | FILE *file = NULL; | 119 | FILE *file = NULL; |
124 | 120 | ||
125 | #if defined(_WIN32) && defined(CP_UTF8) | ||
126 | int sz, len_0 = (int)strlen(filename) + 1; | ||
127 | DWORD flags; | ||
128 | |||
129 | /* | ||
130 | * Basically there are three cases to cover: a) filename is | ||
131 | * pure ASCII string; b) actual UTF-8 encoded string and | ||
132 | * c) locale-ized string, i.e. one containing 8-bit | ||
133 | * characters that are meaningful in current system locale. | ||
134 | * If filename is pure ASCII or real UTF-8 encoded string, | ||
135 | * MultiByteToWideChar succeeds and _wfopen works. If | ||
136 | * filename is locale-ized string, chances are that | ||
137 | * MultiByteToWideChar fails reporting | ||
138 | * ERROR_NO_UNICODE_TRANSLATION, in which case we fall | ||
139 | * back to fopen... | ||
140 | */ | ||
141 | if ((sz = MultiByteToWideChar(CP_UTF8,(flags = MB_ERR_INVALID_CHARS), | ||
142 | filename, len_0, NULL, 0)) > 0 || | ||
143 | (GetLastError() == ERROR_INVALID_FLAGS && | ||
144 | (sz = MultiByteToWideChar(CP_UTF8,(flags = 0), | ||
145 | filename, len_0, NULL, 0)) > 0)) { | ||
146 | WCHAR wmode[8]; | ||
147 | WCHAR *wfilename = _alloca(sz*sizeof(WCHAR)); | ||
148 | |||
149 | if (MultiByteToWideChar(CP_UTF8, flags, filename, len_0, | ||
150 | wfilename, sz) && MultiByteToWideChar(CP_UTF8, 0, mode, | ||
151 | strlen(mode) + 1, wmode, | ||
152 | sizeof(wmode) / sizeof(wmode[0])) && | ||
153 | (file = _wfopen(wfilename, wmode)) == NULL && | ||
154 | (errno == ENOENT || errno == EBADF) | ||
155 | ) /* UTF - 8 decode succeeded, but no file, filename | ||
156 | * could still have been locale-ized... */ | ||
157 | file = fopen(filename, mode); | ||
158 | } else if (GetLastError() == ERROR_NO_UNICODE_TRANSLATION) { | ||
159 | file = fopen(filename, mode); | ||
160 | } | ||
161 | #else | ||
162 | file = fopen(filename, mode); | 121 | file = fopen(filename, mode); |
163 | 122 | ||
164 | #endif | ||
165 | if (file == NULL) { | 123 | if (file == NULL) { |
166 | SYSerr(SYS_F_FOPEN, errno); | 124 | SYSerr(SYS_F_FOPEN, errno); |
167 | ERR_add_error_data(5, "fopen('", filename, "', '", mode, "')"); | 125 | ERR_add_error_data(5, "fopen('", filename, "', '", mode, "')"); |
@@ -304,9 +262,6 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
304 | b->ptr = ptr; | 262 | b->ptr = ptr; |
305 | b->init = 1; | 263 | b->init = 1; |
306 | #if BIO_FLAGS_UPLINK!=0 | 264 | #if BIO_FLAGS_UPLINK!=0 |
307 | #if defined(__MINGW32__) && defined(__MSVCRT__) && !defined(_IOB_ENTRIES) | ||
308 | #define _IOB_ENTRIES 20 | ||
309 | #endif | ||
310 | #if defined(_IOB_ENTRIES) | 265 | #if defined(_IOB_ENTRIES) |
311 | /* Safety net to catch purely internal BIO_set_fp calls */ | 266 | /* Safety net to catch purely internal BIO_set_fp calls */ |
312 | if ((size_t)ptr >= (size_t)stdin && | 267 | if ((size_t)ptr >= (size_t)stdin && |
@@ -317,37 +272,7 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
317 | #ifdef UP_fsetmod | 272 | #ifdef UP_fsetmod |
318 | if (b->flags&BIO_FLAGS_UPLINK) | 273 | if (b->flags&BIO_FLAGS_UPLINK) |
319 | UP_fsetmod(b->ptr,(char)((num&BIO_FP_TEXT)?'t':'b')); | 274 | UP_fsetmod(b->ptr,(char)((num&BIO_FP_TEXT)?'t':'b')); |
320 | else | ||
321 | #endif | 275 | #endif |
322 | { | ||
323 | #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) | ||
324 | int fd = fileno((FILE*)ptr); | ||
325 | /* Under CLib there are differences in file modes */ | ||
326 | if (num & BIO_FP_TEXT) | ||
327 | setmode(fd, O_TEXT); | ||
328 | else | ||
329 | setmode(fd, O_BINARY); | ||
330 | #elif defined(OPENSSL_SYS_MSDOS) | ||
331 | int fd = fileno((FILE*)ptr); | ||
332 | /* Set correct text/binary mode */ | ||
333 | if (num & BIO_FP_TEXT) | ||
334 | _setmode(fd, _O_TEXT); | ||
335 | /* Dangerous to set stdin/stdout to raw (unless redirected) */ | ||
336 | else { | ||
337 | if (fd == STDIN_FILENO || fd == STDOUT_FILENO) { | ||
338 | if (isatty(fd) <= 0) | ||
339 | _setmode(fd, _O_BINARY); | ||
340 | } else | ||
341 | _setmode(fd, _O_BINARY); | ||
342 | } | ||
343 | #elif defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_WIN32_CYGWIN) | ||
344 | int fd = fileno((FILE*)ptr); | ||
345 | if (num & BIO_FP_TEXT) | ||
346 | setmode(fd, O_TEXT); | ||
347 | else | ||
348 | setmode(fd, O_BINARY); | ||
349 | #endif | ||
350 | } | ||
351 | break; | 276 | break; |
352 | case BIO_C_SET_FILENAME: | 277 | case BIO_C_SET_FILENAME: |
353 | file_free(b); | 278 | file_free(b); |
@@ -367,18 +292,6 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
367 | ret = 0; | 292 | ret = 0; |
368 | break; | 293 | break; |
369 | } | 294 | } |
370 | #if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_WIN32_CYGWIN) | ||
371 | if (!(num & BIO_FP_TEXT)) | ||
372 | strcat(p, "b"); | ||
373 | else | ||
374 | strcat(p, "t"); | ||
375 | #endif | ||
376 | #if defined(OPENSSL_SYS_NETWARE) | ||
377 | if (!(num & BIO_FP_TEXT)) | ||
378 | strcat(p, "b"); | ||
379 | else | ||
380 | strcat(p, "t"); | ||
381 | #endif | ||
382 | fp = fopen(ptr, p); | 295 | fp = fopen(ptr, p); |
383 | if (fp == NULL) { | 296 | if (fp == NULL) { |
384 | SYSerr(SYS_F_FOPEN, errno); | 297 | SYSerr(SYS_F_FOPEN, errno); |
diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c index 9225af4df2..5a79f72673 100644 --- a/src/lib/libcrypto/bio/bss_log.c +++ b/src/lib/libcrypto/bio/bss_log.c | |||
@@ -68,59 +68,13 @@ | |||
68 | 68 | ||
69 | #include "cryptlib.h" | 69 | #include "cryptlib.h" |
70 | 70 | ||
71 | #if defined(OPENSSL_SYS_WINCE) | 71 | #include <syslog.h> |
72 | #elif defined(OPENSSL_SYS_WIN32) | ||
73 | #elif defined(OPENSSL_SYS_VMS) | ||
74 | # include <opcdef.h> | ||
75 | # include <descrip.h> | ||
76 | # include <lib$routines.h> | ||
77 | # include <starlet.h> | ||
78 | /* Some compiler options may mask the declaration of "_malloc32". */ | ||
79 | # if __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE | ||
80 | # if __INITIAL_POINTER_SIZE == 64 | ||
81 | # pragma pointer_size save | ||
82 | # pragma pointer_size 32 | ||
83 | void * _malloc32 (__size_t); | ||
84 | # pragma pointer_size restore | ||
85 | # endif /* __INITIAL_POINTER_SIZE == 64 */ | ||
86 | # endif /* __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE */ | ||
87 | #elif defined(__ultrix) | ||
88 | # include <sys/syslog.h> | ||
89 | #elif defined(OPENSSL_SYS_NETWARE) | ||
90 | # define NO_SYSLOG | ||
91 | #elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG) | ||
92 | # include <syslog.h> | ||
93 | #endif | ||
94 | 72 | ||
95 | #include <openssl/buffer.h> | 73 | #include <openssl/buffer.h> |
96 | #include <openssl/err.h> | 74 | #include <openssl/err.h> |
97 | 75 | ||
98 | #ifndef NO_SYSLOG | 76 | #ifndef NO_SYSLOG |
99 | 77 | ||
100 | #if defined(OPENSSL_SYS_WIN32) | ||
101 | #define LOG_EMERG 0 | ||
102 | #define LOG_ALERT 1 | ||
103 | #define LOG_CRIT 2 | ||
104 | #define LOG_ERR 3 | ||
105 | #define LOG_WARNING 4 | ||
106 | #define LOG_NOTICE 5 | ||
107 | #define LOG_INFO 6 | ||
108 | #define LOG_DEBUG 7 | ||
109 | |||
110 | #define LOG_DAEMON (3<<3) | ||
111 | #elif defined(OPENSSL_SYS_VMS) | ||
112 | /* On VMS, we don't really care about these, but we need them to compile */ | ||
113 | #define LOG_EMERG 0 | ||
114 | #define LOG_ALERT 1 | ||
115 | #define LOG_CRIT 2 | ||
116 | #define LOG_ERR 3 | ||
117 | #define LOG_WARNING 4 | ||
118 | #define LOG_NOTICE 5 | ||
119 | #define LOG_INFO 6 | ||
120 | #define LOG_DEBUG 7 | ||
121 | |||
122 | #define LOG_DAEMON OPC$M_NM_NTWORK | ||
123 | #endif | ||
124 | 78 | ||
125 | static int slg_write(BIO *h, const char *buf, int num); | 79 | static int slg_write(BIO *h, const char *buf, int num); |
126 | static int slg_puts(BIO *h, const char *str); | 80 | static int slg_puts(BIO *h, const char *str); |
@@ -245,161 +199,11 @@ slg_puts(BIO *bp, const char *str) | |||
245 | return (ret); | 199 | return (ret); |
246 | } | 200 | } |
247 | 201 | ||
248 | #if defined(OPENSSL_SYS_WIN32) | ||
249 | |||
250 | static void | ||
251 | xopenlog(BIO* bp, char* name, int level) | ||
252 | { | ||
253 | if (check_winnt()) | ||
254 | bp->ptr = RegisterEventSourceA(NULL, name); | ||
255 | else | ||
256 | bp->ptr = NULL; | ||
257 | } | ||
258 | |||
259 | static void | ||
260 | xsyslog(BIO *bp, int priority, const char *string) | ||
261 | { | ||
262 | LPCSTR lpszStrings[2]; | ||
263 | WORD evtype = EVENTLOG_ERROR_TYPE; | ||
264 | char pidbuf[DECIMAL_SIZE(DWORD) + 4]; | ||
265 | |||
266 | if (bp->ptr == NULL) | ||
267 | return; | ||
268 | |||
269 | switch (priority) { | ||
270 | case LOG_EMERG: | ||
271 | case LOG_ALERT: | ||
272 | case LOG_CRIT: | ||
273 | case LOG_ERR: | ||
274 | evtype = EVENTLOG_ERROR_TYPE; | ||
275 | break; | ||
276 | case LOG_WARNING: | ||
277 | evtype = EVENTLOG_WARNING_TYPE; | ||
278 | break; | ||
279 | case LOG_NOTICE: | ||
280 | case LOG_INFO: | ||
281 | case LOG_DEBUG: | ||
282 | evtype = EVENTLOG_INFORMATION_TYPE; | ||
283 | break; | ||
284 | default: /* Should never happen, but set it | ||
285 | as error anyway. */ | ||
286 | evtype = EVENTLOG_ERROR_TYPE; | ||
287 | break; | ||
288 | } | ||
289 | |||
290 | sprintf(pidbuf, "[%u] ", GetCurrentProcessId()); | ||
291 | lpszStrings[0] = pidbuf; | ||
292 | lpszStrings[1] = string; | ||
293 | |||
294 | ReportEventA(bp->ptr, evtype, 0, 1024, NULL, 2, 0, | ||
295 | lpszStrings, NULL); | ||
296 | } | ||
297 | |||
298 | static void | ||
299 | xcloselog(BIO* bp) | ||
300 | { | ||
301 | if (bp->ptr) | ||
302 | DeregisterEventSource((HANDLE)(bp->ptr)); | ||
303 | bp->ptr = NULL; | ||
304 | } | ||
305 | |||
306 | #elif defined(OPENSSL_SYS_VMS) | ||
307 | |||
308 | static int VMS_OPC_target = LOG_DAEMON; | ||
309 | |||
310 | static void | ||
311 | xopenlog(BIO* bp, char* name, int level) | ||
312 | { | ||
313 | VMS_OPC_target = level; | ||
314 | |||
315 | } | ||
316 | |||
317 | static void | ||
318 | xsyslog(BIO *bp, int priority, const char *string) | ||
319 | { | ||
320 | struct dsc$descriptor_s opc_dsc; | ||
321 | |||
322 | /* Arrange 32-bit pointer to opcdef buffer and malloc(), if needed. */ | ||
323 | #if __INITIAL_POINTER_SIZE == 64 | ||
324 | # pragma pointer_size save | ||
325 | # pragma pointer_size 32 | ||
326 | # define OPCDEF_TYPE __char_ptr32 | ||
327 | # define OPCDEF_MALLOC _malloc32 | ||
328 | #else /* __INITIAL_POINTER_SIZE == 64 */ | ||
329 | # define OPCDEF_TYPE char * | ||
330 | # define OPCDEF_MALLOC OPENSSL_malloc | ||
331 | #endif /* __INITIAL_POINTER_SIZE == 64 [else] */ | ||
332 | |||
333 | struct opcdef *opcdef_p; | ||
334 | |||
335 | #if __INITIAL_POINTER_SIZE == 64 | ||
336 | # pragma pointer_size restore | ||
337 | #endif /* __INITIAL_POINTER_SIZE == 64 */ | ||
338 | |||
339 | char buf[10240]; | ||
340 | unsigned int len; | ||
341 | struct dsc$descriptor_s buf_dsc; | ||
342 | $DESCRIPTOR(fao_cmd, "!AZ: !AZ"); | ||
343 | char *priority_tag; | ||
344 | |||
345 | switch (priority) { | ||
346 | case LOG_EMERG: | ||
347 | priority_tag = "Emergency"; break; | ||
348 | case LOG_ALERT: | ||
349 | priority_tag = "Alert"; break; | ||
350 | case LOG_CRIT: | ||
351 | priority_tag = "Critical"; break; | ||
352 | case LOG_ERR: | ||
353 | priority_tag = "Error"; break; | ||
354 | case LOG_WARNING: | ||
355 | priority_tag = "Warning"; break; | ||
356 | case LOG_NOTICE: | ||
357 | priority_tag = "Notice"; break; | ||
358 | case LOG_INFO: | ||
359 | priority_tag = "Info"; break; | ||
360 | case LOG_DEBUG: | ||
361 | priority_tag = "DEBUG"; break; | ||
362 | } | ||
363 | |||
364 | buf_dsc.dsc$b_dtype = DSC$K_DTYPE_T; | ||
365 | buf_dsc.dsc$b_class = DSC$K_CLASS_S; | ||
366 | buf_dsc.dsc$a_pointer = buf; | ||
367 | buf_dsc.dsc$w_length = sizeof(buf) - 1; | ||
368 | |||
369 | lib$sys_fao(&fao_cmd, &len, &buf_dsc, priority_tag, string); | ||
370 | |||
371 | /* We know there's an 8-byte header. That's documented. */ | ||
372 | opcdef_p = OPCDEF_MALLOC( 8 + len); | ||
373 | opcdef_p->opc$b_ms_type = OPC$_RQ_RQST; | ||
374 | memcpy(opcdef_p->opc$z_ms_target_classes, &VMS_OPC_target, 3); | ||
375 | opcdef_p->opc$l_ms_rqstid = 0; | ||
376 | memcpy(&opcdef_p->opc$l_ms_text, buf, len); | ||
377 | |||
378 | opc_dsc.dsc$b_dtype = DSC$K_DTYPE_T; | ||
379 | opc_dsc.dsc$b_class = DSC$K_CLASS_S; | ||
380 | opc_dsc.dsc$a_pointer = (OPCDEF_TYPE) opcdef_p; | ||
381 | opc_dsc.dsc$w_length = len + 8; | ||
382 | |||
383 | sys$sndopr(opc_dsc, 0); | ||
384 | |||
385 | OPENSSL_free(opcdef_p); | ||
386 | } | ||
387 | |||
388 | static void | ||
389 | xcloselog(BIO* bp) | ||
390 | { | ||
391 | } | ||
392 | |||
393 | #else /* Unix/Watt32 */ | ||
394 | 202 | ||
395 | static void | 203 | static void |
396 | xopenlog(BIO* bp, char* name, int level) | 204 | xopenlog(BIO* bp, char* name, int level) |
397 | { | 205 | { |
398 | #ifdef WATT32 /* djgpp/DOS */ | ||
399 | openlog(name, LOG_PID|LOG_CONS|LOG_NDELAY, level); | ||
400 | #else | ||
401 | openlog(name, LOG_PID|LOG_CONS, level); | 206 | openlog(name, LOG_PID|LOG_CONS, level); |
402 | #endif | ||
403 | } | 207 | } |
404 | 208 | ||
405 | static void | 209 | static void |
@@ -414,6 +218,5 @@ xcloselog(BIO* bp) | |||
414 | closelog(); | 218 | closelog(); |
415 | } | 219 | } |
416 | 220 | ||
417 | #endif /* Unix */ | ||
418 | 221 | ||
419 | #endif /* NO_SYSLOG */ | 222 | #endif /* NO_SYSLOG */ |
diff --git a/src/lib/libcrypto/bio/bss_sock.c b/src/lib/libcrypto/bio/bss_sock.c index c05b8d37f1..b9cf817a0c 100644 --- a/src/lib/libcrypto/bio/bss_sock.c +++ b/src/lib/libcrypto/bio/bss_sock.c | |||
@@ -65,12 +65,6 @@ | |||
65 | 65 | ||
66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
67 | 67 | ||
68 | #ifdef WATT32 | ||
69 | #define sock_write SockWrite /* Watt-32 uses same names */ | ||
70 | #define sock_read SockRead | ||
71 | #define sock_puts SockPuts | ||
72 | #endif | ||
73 | |||
74 | static int sock_write(BIO *h, const char *buf, int num); | 68 | static int sock_write(BIO *h, const char *buf, int num); |
75 | static int sock_read(BIO *h, char *buf, int size); | 69 | static int sock_read(BIO *h, char *buf, int size); |
76 | static int sock_puts(BIO *h, const char *str); | 70 | static int sock_puts(BIO *h, const char *str); |
diff --git a/src/lib/libssl/src/crypto/bio/b_sock.c b/src/lib/libssl/src/crypto/bio/b_sock.c index cd62f889ab..3ccebf77f4 100644 --- a/src/lib/libssl/src/crypto/bio/b_sock.c +++ b/src/lib/libssl/src/crypto/bio/b_sock.c | |||
@@ -184,14 +184,7 @@ BIO_get_port(const char *str, unsigned short *port_ptr) | |||
184 | *port_ptr = (unsigned short)i; | 184 | *port_ptr = (unsigned short)i; |
185 | else { | 185 | else { |
186 | CRYPTO_w_lock(CRYPTO_LOCK_GETSERVBYNAME); | 186 | CRYPTO_w_lock(CRYPTO_LOCK_GETSERVBYNAME); |
187 | /* Note: under VMS with SOCKETSHR, it seems like the first | ||
188 | * parameter is 'char *', instead of 'const char *' | ||
189 | */ | ||
190 | #ifndef CONST_STRICT | ||
191 | s = getservbyname((char *)str, "tcp"); | ||
192 | #else | ||
193 | s = getservbyname(str, "tcp"); | 187 | s = getservbyname(str, "tcp"); |
194 | #endif | ||
195 | if (s != NULL) | 188 | if (s != NULL) |
196 | *port_ptr = ntohs((unsigned short)s->s_port); | 189 | *port_ptr = ntohs((unsigned short)s->s_port); |
197 | CRYPTO_w_unlock(CRYPTO_LOCK_GETSERVBYNAME); | 190 | CRYPTO_w_unlock(CRYPTO_LOCK_GETSERVBYNAME); |
@@ -247,260 +240,24 @@ BIO_sock_error(int sock) | |||
247 | return (j); | 240 | return (j); |
248 | } | 241 | } |
249 | 242 | ||
250 | #if 0 | 243 | struct hostent * |
251 | long | 244 | BIO_gethostbyname(const char *name) |
252 | BIO_ghbn_ctrl(int cmd, int iarg, char *parg) | ||
253 | { | ||
254 | int i; | ||
255 | char **p; | ||
256 | |||
257 | switch (cmd) { | ||
258 | case BIO_GHBN_CTRL_HITS: | ||
259 | return (BIO_ghbn_hits); | ||
260 | /* break; */ | ||
261 | case BIO_GHBN_CTRL_MISSES: | ||
262 | return (BIO_ghbn_miss); | ||
263 | /* break; */ | ||
264 | case BIO_GHBN_CTRL_CACHE_SIZE: | ||
265 | return (GHBN_NUM); | ||
266 | /* break; */ | ||
267 | case BIO_GHBN_CTRL_GET_ENTRY: | ||
268 | if ((iarg >= 0) && (iarg < GHBN_NUM) && | ||
269 | (ghbn_cache[iarg].order > 0)) { | ||
270 | p = (char **)parg; | ||
271 | if (p == NULL) | ||
272 | return (0); | ||
273 | *p = ghbn_cache[iarg].name; | ||
274 | ghbn_cache[iarg].name[128] = '\0'; | ||
275 | return (1); | ||
276 | } | ||
277 | return (0); | ||
278 | /* break; */ | ||
279 | case BIO_GHBN_CTRL_FLUSH: | ||
280 | for (i = 0; i < GHBN_NUM; i++) | ||
281 | ghbn_cache[i].order = 0; | ||
282 | break; | ||
283 | default: | ||
284 | return (0); | ||
285 | } | ||
286 | return (1); | ||
287 | } | ||
288 | #endif | ||
289 | |||
290 | #if 0 | ||
291 | static struct hostent | ||
292 | *ghbn_dup(struct hostent *a) | ||
293 | { | 245 | { |
294 | struct hostent *ret; | ||
295 | int i, j; | ||
296 | |||
297 | MemCheck_off(); | ||
298 | ret = (struct hostent *)OPENSSL_malloc(sizeof(struct hostent)); | ||
299 | if (ret == NULL) | ||
300 | return (NULL); | ||
301 | memset(ret, 0, sizeof(struct hostent)); | ||
302 | |||
303 | for (i = 0; a->h_aliases[i] != NULL; i++) | ||
304 | ; | ||
305 | i++; | ||
306 | ret->h_aliases = (char **)OPENSSL_malloc(i*sizeof(char *)); | ||
307 | if (ret->h_aliases == NULL) | ||
308 | goto err; | ||
309 | memset(ret->h_aliases, 0, i*sizeof(char *)); | ||
310 | |||
311 | for (i = 0; a->h_addr_list[i] != NULL; i++) | ||
312 | ; | ||
313 | i++; | ||
314 | ret->h_addr_list = (char **)OPENSSL_malloc(i*sizeof(char *)); | ||
315 | if (ret->h_addr_list == NULL) | ||
316 | goto err; | ||
317 | memset(ret->h_addr_list, 0, i*sizeof(char *)); | ||
318 | |||
319 | j = strlen(a->h_name) + 1; | ||
320 | if ((ret->h_name = OPENSSL_malloc(j)) == NULL) | ||
321 | goto err; | ||
322 | memcpy((char *)ret->h_name, a->h_name, j); | ||
323 | for (i = 0; a->h_aliases[i] != NULL; i++) { | ||
324 | j = strlen(a->h_aliases[i]) + 1; | ||
325 | if ((ret->h_aliases[i] = OPENSSL_malloc(j)) == NULL) | ||
326 | goto err; | ||
327 | memcpy(ret->h_aliases[i], a->h_aliases[i], j); | ||
328 | } | ||
329 | ret->h_length = a->h_length; | ||
330 | ret->h_addrtype = a->h_addrtype; | ||
331 | for (i = 0; a->h_addr_list[i] != NULL; i++) { | ||
332 | if ((ret->h_addr_list[i] = OPENSSL_malloc(a->h_length)) == NULL) | ||
333 | goto err; | ||
334 | memcpy(ret->h_addr_list[i], a->h_addr_list[i], a->h_length); | ||
335 | } | ||
336 | if (0) { | ||
337 | err: | ||
338 | if (ret != NULL) | ||
339 | ghbn_free(ret); | ||
340 | ret = NULL; | ||
341 | } | ||
342 | MemCheck_on(); | ||
343 | return (ret); | ||
344 | } | ||
345 | |||
346 | static void | ||
347 | ghbn_free(struct hostent *a) | ||
348 | { | ||
349 | int i; | ||
350 | |||
351 | if (a == NULL) | ||
352 | return; | ||
353 | |||
354 | if (a->h_aliases != NULL) { | ||
355 | for (i = 0; a->h_aliases[i] != NULL; i++) | ||
356 | OPENSSL_free(a->h_aliases[i]); | ||
357 | OPENSSL_free(a->h_aliases); | ||
358 | } | ||
359 | if (a->h_addr_list != NULL) { | ||
360 | for (i = 0; a->h_addr_list[i] != NULL; i++) | ||
361 | OPENSSL_free(a->h_addr_list[i]); | ||
362 | OPENSSL_free(a->h_addr_list); | ||
363 | } | ||
364 | if (a->h_name != NULL) | ||
365 | OPENSSL_free(a->h_name); | ||
366 | OPENSSL_free(a); | ||
367 | } | ||
368 | |||
369 | #endif | ||
370 | |||
371 | struct hostent | ||
372 | *BIO_gethostbyname(const char *name) | ||
373 | { | ||
374 | #if 1 | ||
375 | /* Caching gethostbyname() results forever is wrong, | ||
376 | * so we have to let the true gethostbyname() worry about this */ | ||
377 | #if (defined(NETWARE_BSDSOCK) && !defined(__NOVELL_LIBC__)) | ||
378 | return gethostbyname((char*)name); | ||
379 | #else | ||
380 | return gethostbyname(name); | 246 | return gethostbyname(name); |
381 | #endif | ||
382 | #else | ||
383 | struct hostent *ret; | ||
384 | int i, lowi = 0, j; | ||
385 | unsigned long low = (unsigned long) - 1; | ||
386 | |||
387 | |||
388 | # if 0 | ||
389 | /* It doesn't make sense to use locking here: The function interface | ||
390 | * is not thread-safe, because threads can never be sure when | ||
391 | * some other thread destroys the data they were given a pointer to. | ||
392 | */ | ||
393 | CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); | ||
394 | # endif | ||
395 | j = strlen(name); | ||
396 | if (j < 128) { | ||
397 | for (i = 0; i < GHBN_NUM; i++) { | ||
398 | if (low > ghbn_cache[i].order) { | ||
399 | low = ghbn_cache[i].order; | ||
400 | lowi = i; | ||
401 | } | ||
402 | if (ghbn_cache[i].order > 0) { | ||
403 | if (strncmp(name, ghbn_cache[i].name, 128) == 0) | ||
404 | break; | ||
405 | } | ||
406 | } | ||
407 | } else | ||
408 | i = GHBN_NUM; | ||
409 | |||
410 | if (i == GHBN_NUM) /* no hit*/ | ||
411 | { | ||
412 | BIO_ghbn_miss++; | ||
413 | /* Note: under VMS with SOCKETSHR, it seems like the first | ||
414 | * parameter is 'char *', instead of 'const char *' | ||
415 | */ | ||
416 | # ifndef CONST_STRICT | ||
417 | ret = gethostbyname((char *)name); | ||
418 | # else | ||
419 | ret = gethostbyname(name); | ||
420 | # endif | ||
421 | |||
422 | if (ret == NULL) | ||
423 | goto end; | ||
424 | if (j > 128) /* too big to cache */ | ||
425 | { | ||
426 | # if 0 | ||
427 | /* If we were trying to make this function thread-safe (which | ||
428 | * is bound to fail), we'd have to give up in this case | ||
429 | * (or allocate more memory). */ | ||
430 | ret = NULL; | ||
431 | # endif | ||
432 | goto end; | ||
433 | } | ||
434 | |||
435 | /* else add to cache */ | ||
436 | if (ghbn_cache[lowi].ent != NULL) | ||
437 | ghbn_free(ghbn_cache[lowi].ent); /* XXX not thread-safe */ | ||
438 | ghbn_cache[lowi].name[0] = '\0'; | ||
439 | |||
440 | if ((ret = ghbn_cache[lowi].ent = ghbn_dup(ret)) == NULL) { | ||
441 | BIOerr(BIO_F_BIO_GETHOSTBYNAME, ERR_R_MALLOC_FAILURE); | ||
442 | goto end; | ||
443 | } | ||
444 | strncpy(ghbn_cache[lowi].name, name, 128); | ||
445 | ghbn_cache[lowi].order = BIO_ghbn_miss + BIO_ghbn_hits; | ||
446 | } else { | ||
447 | BIO_ghbn_hits++; | ||
448 | ret = ghbn_cache[i].ent; | ||
449 | ghbn_cache[i].order = BIO_ghbn_miss + BIO_ghbn_hits; | ||
450 | } | ||
451 | end: | ||
452 | # if 0 | ||
453 | CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME); | ||
454 | # endif | ||
455 | return (ret); | ||
456 | #endif | ||
457 | } | 247 | } |
458 | 248 | ||
459 | 249 | ||
460 | int | 250 | int |
461 | BIO_sock_init(void) | 251 | BIO_sock_init(void) |
462 | { | 252 | { |
463 | #ifdef WATT32 | ||
464 | extern int _watt_do_exit; | ||
465 | _watt_do_exit = 0; | ||
466 | /* don't make sock_init() call exit() */ | ||
467 | if (sock_init()) | ||
468 | return (-1); | ||
469 | #endif | ||
470 | |||
471 | #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) | ||
472 | WORD wVerReq; | ||
473 | WSADATA wsaData; | ||
474 | int err; | ||
475 | |||
476 | if (!wsa_init_done) { | ||
477 | wsa_init_done = 1; | ||
478 | wVerReq = MAKEWORD( 2, 0 ); | ||
479 | err = WSAStartup(wVerReq, &wsaData); | ||
480 | if (err != 0) { | ||
481 | SYSerr(SYS_F_WSASTARTUP, err); | ||
482 | BIOerr(BIO_F_BIO_SOCK_INIT, BIO_R_WSASTARTUP); | ||
483 | return (-1); | ||
484 | } | ||
485 | } | ||
486 | #endif | ||
487 | |||
488 | return (1); | 253 | return (1); |
489 | } | 254 | } |
490 | 255 | ||
491 | void | 256 | void |
492 | BIO_sock_cleanup(void) | 257 | BIO_sock_cleanup(void) |
493 | { | 258 | { |
494 | #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) | ||
495 | if (wsa_init_done) { | ||
496 | wsa_init_done = 0; | ||
497 | WSACleanup(); | ||
498 | } | ||
499 | #endif | ||
500 | } | 259 | } |
501 | 260 | ||
502 | #if !defined(OPENSSL_SYS_VMS) || __VMS_VER >= 70000000 | ||
503 | |||
504 | int | 261 | int |
505 | BIO_socket_ioctl(int fd, long type, void *arg) | 262 | BIO_socket_ioctl(int fd, long type, void *arg) |
506 | { | 263 | { |
@@ -509,28 +266,7 @@ BIO_socket_ioctl(int fd, long type, void *arg) | |||
509 | #ifdef __DJGPP__ | 266 | #ifdef __DJGPP__ |
510 | i = ioctl(fd, type, (char *)arg); | 267 | i = ioctl(fd, type, (char *)arg); |
511 | #else | 268 | #else |
512 | # if defined(OPENSSL_SYS_VMS) | ||
513 | /* 2011-02-18 SMS. | ||
514 | * VMS ioctl() can't tolerate a 64-bit "void *arg", but we | ||
515 | * observe that all the consumers pass in an "unsigned long *", | ||
516 | * so we arrange a local copy with a short pointer, and use | ||
517 | * that, instead. | ||
518 | */ | ||
519 | # if __INITIAL_POINTER_SIZE == 64 | ||
520 | # define ARG arg_32p | ||
521 | # pragma pointer_size save | ||
522 | # pragma pointer_size 32 | ||
523 | unsigned long arg_32; | ||
524 | unsigned long *arg_32p; | ||
525 | # pragma pointer_size restore | ||
526 | arg_32p = &arg_32; | ||
527 | arg_32 = *((unsigned long *) arg); | ||
528 | # else /* __INITIAL_POINTER_SIZE == 64 */ | ||
529 | # define ARG arg | ||
530 | # endif /* __INITIAL_POINTER_SIZE == 64 [else] */ | ||
531 | # else /* defined(OPENSSL_SYS_VMS) */ | ||
532 | # define ARG arg | 269 | # define ARG arg |
533 | # endif /* defined(OPENSSL_SYS_VMS) [else] */ | ||
534 | 270 | ||
535 | i = ioctl(fd, type, ARG); | 271 | i = ioctl(fd, type, ARG); |
536 | #endif /* __DJGPP__ */ | 272 | #endif /* __DJGPP__ */ |
@@ -538,7 +274,6 @@ BIO_socket_ioctl(int fd, long type, void *arg) | |||
538 | SYSerr(SYS_F_IOCTLSOCKET, errno); | 274 | SYSerr(SYS_F_IOCTLSOCKET, errno); |
539 | return (i); | 275 | return (i); |
540 | } | 276 | } |
541 | #endif /* __VMS_VER */ | ||
542 | 277 | ||
543 | /* The reason I have implemented this instead of using sscanf is because | 278 | /* The reason I have implemented this instead of using sscanf is because |
544 | * Visual C 1.52c gives an unresolved external when linking a DLL :-( */ | 279 | * Visual C 1.52c gives an unresolved external when linking a DLL :-( */ |
diff --git a/src/lib/libssl/src/crypto/bio/bio.h b/src/lib/libssl/src/crypto/bio/bio.h index 4f1d02ada5..9bae034daa 100644 --- a/src/lib/libssl/src/crypto/bio/bio.h +++ b/src/lib/libssl/src/crypto/bio/bio.h | |||
@@ -69,11 +69,7 @@ | |||
69 | #include <openssl/crypto.h> | 69 | #include <openssl/crypto.h> |
70 | 70 | ||
71 | #ifndef OPENSSL_NO_SCTP | 71 | #ifndef OPENSSL_NO_SCTP |
72 | # ifndef OPENSSL_SYS_VMS | ||
73 | # include <stdint.h> | 72 | # include <stdint.h> |
74 | # else | ||
75 | # include <inttypes.h> | ||
76 | # endif | ||
77 | #endif | 73 | #endif |
78 | 74 | ||
79 | #ifdef __cplusplus | 75 | #ifdef __cplusplus |
@@ -671,16 +667,11 @@ BIO_METHOD *BIO_s_socket(void); | |||
671 | BIO_METHOD *BIO_s_connect(void); | 667 | BIO_METHOD *BIO_s_connect(void); |
672 | BIO_METHOD *BIO_s_accept(void); | 668 | BIO_METHOD *BIO_s_accept(void); |
673 | BIO_METHOD *BIO_s_fd(void); | 669 | BIO_METHOD *BIO_s_fd(void); |
674 | #ifndef OPENSSL_SYS_OS2 | ||
675 | BIO_METHOD *BIO_s_log(void); | 670 | BIO_METHOD *BIO_s_log(void); |
676 | #endif | ||
677 | BIO_METHOD *BIO_s_bio(void); | 671 | BIO_METHOD *BIO_s_bio(void); |
678 | BIO_METHOD *BIO_s_null(void); | 672 | BIO_METHOD *BIO_s_null(void); |
679 | BIO_METHOD *BIO_f_null(void); | 673 | BIO_METHOD *BIO_f_null(void); |
680 | BIO_METHOD *BIO_f_buffer(void); | 674 | BIO_METHOD *BIO_f_buffer(void); |
681 | #ifdef OPENSSL_SYS_VMS | ||
682 | BIO_METHOD *BIO_f_linebuffer(void); | ||
683 | #endif | ||
684 | BIO_METHOD *BIO_f_nbio_test(void); | 675 | BIO_METHOD *BIO_f_nbio_test(void); |
685 | #ifndef OPENSSL_NO_DGRAM | 676 | #ifndef OPENSSL_NO_DGRAM |
686 | BIO_METHOD *BIO_s_datagram(void); | 677 | BIO_METHOD *BIO_s_datagram(void); |
diff --git a/src/lib/libssl/src/crypto/bio/bio_cb.c b/src/lib/libssl/src/crypto/bio/bio_cb.c index 00f41b1de1..a272bf969a 100644 --- a/src/lib/libssl/src/crypto/bio/bio_cb.c +++ b/src/lib/libssl/src/crypto/bio/bio_cb.c | |||
@@ -139,7 +139,7 @@ BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, | |||
139 | b = (BIO *)bio->cb_arg; | 139 | b = (BIO *)bio->cb_arg; |
140 | if (b != NULL) | 140 | if (b != NULL) |
141 | BIO_write(b, buf, strlen(buf)); | 141 | BIO_write(b, buf, strlen(buf)); |
142 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) | 142 | #if !defined(OPENSSL_NO_STDIO) |
143 | else | 143 | else |
144 | fputs(buf, stderr); | 144 | fputs(buf, stderr); |
145 | #endif | 145 | #endif |
diff --git a/src/lib/libssl/src/crypto/bio/bio_lcl.h b/src/lib/libssl/src/crypto/bio/bio_lcl.h index e7f7ec8d8b..cc89c1bf2d 100644 --- a/src/lib/libssl/src/crypto/bio/bio_lcl.h +++ b/src/lib/libssl/src/crypto/bio/bio_lcl.h | |||
@@ -18,14 +18,6 @@ | |||
18 | #define UP_ftell ftell | 18 | #define UP_ftell ftell |
19 | #define UP_fflush fflush | 19 | #define UP_fflush fflush |
20 | #define UP_ferror ferror | 20 | #define UP_ferror ferror |
21 | #ifdef _WIN32 | ||
22 | #define UP_fileno _fileno | ||
23 | #define UP_open _open | ||
24 | #define UP_read _read | ||
25 | #define UP_write _write | ||
26 | #define UP_lseek _lseek | ||
27 | #define UP_close _close | ||
28 | #else | ||
29 | #define UP_fileno fileno | 21 | #define UP_fileno fileno |
30 | #define UP_open open | 22 | #define UP_open open |
31 | #define UP_read read | 23 | #define UP_read read |
@@ -33,4 +25,3 @@ | |||
33 | #define UP_lseek lseek | 25 | #define UP_lseek lseek |
34 | #define UP_close close | 26 | #define UP_close close |
35 | #endif | 27 | #endif |
36 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/bio/bss_acpt.c b/src/lib/libssl/src/crypto/bio/bss_acpt.c index d772515d64..d7c151eaaa 100644 --- a/src/lib/libssl/src/crypto/bio/bss_acpt.c +++ b/src/lib/libssl/src/crypto/bio/bss_acpt.c | |||
@@ -64,16 +64,7 @@ | |||
64 | 64 | ||
65 | #ifndef OPENSSL_NO_SOCK | 65 | #ifndef OPENSSL_NO_SOCK |
66 | 66 | ||
67 | #ifdef OPENSSL_SYS_WIN16 | ||
68 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ | ||
69 | #else | ||
70 | #define SOCKET_PROTOCOL IPPROTO_TCP | 67 | #define SOCKET_PROTOCOL IPPROTO_TCP |
71 | #endif | ||
72 | |||
73 | #if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000) | ||
74 | /* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ | ||
75 | #undef FIONBIO | ||
76 | #endif | ||
77 | 68 | ||
78 | typedef struct bio_accept_st { | 69 | typedef struct bio_accept_st { |
79 | int state; | 70 | int state; |
diff --git a/src/lib/libssl/src/crypto/bio/bss_conn.c b/src/lib/libssl/src/crypto/bio/bss_conn.c index df34c49a4a..db877b140b 100644 --- a/src/lib/libssl/src/crypto/bio/bss_conn.c +++ b/src/lib/libssl/src/crypto/bio/bss_conn.c | |||
@@ -64,17 +64,7 @@ | |||
64 | 64 | ||
65 | #ifndef OPENSSL_NO_SOCK | 65 | #ifndef OPENSSL_NO_SOCK |
66 | 66 | ||
67 | #ifdef OPENSSL_SYS_WIN16 | ||
68 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ | ||
69 | #else | ||
70 | #define SOCKET_PROTOCOL IPPROTO_TCP | 67 | #define SOCKET_PROTOCOL IPPROTO_TCP |
71 | #endif | ||
72 | |||
73 | #if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000) | ||
74 | /* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ | ||
75 | #undef FIONBIO | ||
76 | #endif | ||
77 | |||
78 | 68 | ||
79 | typedef struct bio_connect_st { | 69 | typedef struct bio_connect_st { |
80 | int state; | 70 | int state; |
diff --git a/src/lib/libssl/src/crypto/bio/bss_dgram.c b/src/lib/libssl/src/crypto/bio/bss_dgram.c index 9219fffc8d..478c765399 100644 --- a/src/lib/libssl/src/crypto/bio/bss_dgram.c +++ b/src/lib/libssl/src/crypto/bio/bss_dgram.c | |||
@@ -66,10 +66,6 @@ | |||
66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
67 | #ifndef OPENSSL_NO_DGRAM | 67 | #ifndef OPENSSL_NO_DGRAM |
68 | 68 | ||
69 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) | ||
70 | #include <sys/timeb.h> | ||
71 | #endif | ||
72 | |||
73 | #ifndef OPENSSL_NO_SCTP | 69 | #ifndef OPENSSL_NO_SCTP |
74 | #include <netinet/sctp.h> | 70 | #include <netinet/sctp.h> |
75 | #include <fcntl.h> | 71 | #include <fcntl.h> |
@@ -91,12 +87,6 @@ | |||
91 | ((a)->s6_addr32[2] == htonl(0x0000ffff))) | 87 | ((a)->s6_addr32[2] == htonl(0x0000ffff))) |
92 | #endif | 88 | #endif |
93 | 89 | ||
94 | #ifdef WATT32 | ||
95 | #define sock_write SockWrite /* Watt-32 uses same names */ | ||
96 | #define sock_read SockRead | ||
97 | #define sock_puts SockPuts | ||
98 | #endif | ||
99 | |||
100 | static int dgram_write(BIO *h, const char *buf, int num); | 90 | static int dgram_write(BIO *h, const char *buf, int num); |
101 | static int dgram_read(BIO *h, char *buf, int size); | 91 | static int dgram_read(BIO *h, char *buf, int size); |
102 | static int dgram_puts(BIO *h, const char *str); | 92 | static int dgram_puts(BIO *h, const char *str); |
diff --git a/src/lib/libssl/src/crypto/bio/bss_file.c b/src/lib/libssl/src/crypto/bio/bss_file.c index 982317b34a..59e48e6659 100644 --- a/src/lib/libssl/src/crypto/bio/bss_file.c +++ b/src/lib/libssl/src/crypto/bio/bss_file.c | |||
@@ -89,10 +89,6 @@ | |||
89 | #include "bio_lcl.h" | 89 | #include "bio_lcl.h" |
90 | #include <openssl/err.h> | 90 | #include <openssl/err.h> |
91 | 91 | ||
92 | #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) | ||
93 | #include <nwfileio.h> | ||
94 | #endif | ||
95 | |||
96 | #if !defined(OPENSSL_NO_STDIO) | 92 | #if !defined(OPENSSL_NO_STDIO) |
97 | 93 | ||
98 | static int file_write(BIO *h, const char *buf, int num); | 94 | static int file_write(BIO *h, const char *buf, int num); |
@@ -122,46 +118,8 @@ BIO | |||
122 | BIO *ret; | 118 | BIO *ret; |
123 | FILE *file = NULL; | 119 | FILE *file = NULL; |
124 | 120 | ||
125 | #if defined(_WIN32) && defined(CP_UTF8) | ||
126 | int sz, len_0 = (int)strlen(filename) + 1; | ||
127 | DWORD flags; | ||
128 | |||
129 | /* | ||
130 | * Basically there are three cases to cover: a) filename is | ||
131 | * pure ASCII string; b) actual UTF-8 encoded string and | ||
132 | * c) locale-ized string, i.e. one containing 8-bit | ||
133 | * characters that are meaningful in current system locale. | ||
134 | * If filename is pure ASCII or real UTF-8 encoded string, | ||
135 | * MultiByteToWideChar succeeds and _wfopen works. If | ||
136 | * filename is locale-ized string, chances are that | ||
137 | * MultiByteToWideChar fails reporting | ||
138 | * ERROR_NO_UNICODE_TRANSLATION, in which case we fall | ||
139 | * back to fopen... | ||
140 | */ | ||
141 | if ((sz = MultiByteToWideChar(CP_UTF8,(flags = MB_ERR_INVALID_CHARS), | ||
142 | filename, len_0, NULL, 0)) > 0 || | ||
143 | (GetLastError() == ERROR_INVALID_FLAGS && | ||
144 | (sz = MultiByteToWideChar(CP_UTF8,(flags = 0), | ||
145 | filename, len_0, NULL, 0)) > 0)) { | ||
146 | WCHAR wmode[8]; | ||
147 | WCHAR *wfilename = _alloca(sz*sizeof(WCHAR)); | ||
148 | |||
149 | if (MultiByteToWideChar(CP_UTF8, flags, filename, len_0, | ||
150 | wfilename, sz) && MultiByteToWideChar(CP_UTF8, 0, mode, | ||
151 | strlen(mode) + 1, wmode, | ||
152 | sizeof(wmode) / sizeof(wmode[0])) && | ||
153 | (file = _wfopen(wfilename, wmode)) == NULL && | ||
154 | (errno == ENOENT || errno == EBADF) | ||
155 | ) /* UTF - 8 decode succeeded, but no file, filename | ||
156 | * could still have been locale-ized... */ | ||
157 | file = fopen(filename, mode); | ||
158 | } else if (GetLastError() == ERROR_NO_UNICODE_TRANSLATION) { | ||
159 | file = fopen(filename, mode); | ||
160 | } | ||
161 | #else | ||
162 | file = fopen(filename, mode); | 121 | file = fopen(filename, mode); |
163 | 122 | ||
164 | #endif | ||
165 | if (file == NULL) { | 123 | if (file == NULL) { |
166 | SYSerr(SYS_F_FOPEN, errno); | 124 | SYSerr(SYS_F_FOPEN, errno); |
167 | ERR_add_error_data(5, "fopen('", filename, "', '", mode, "')"); | 125 | ERR_add_error_data(5, "fopen('", filename, "', '", mode, "')"); |
@@ -304,9 +262,6 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
304 | b->ptr = ptr; | 262 | b->ptr = ptr; |
305 | b->init = 1; | 263 | b->init = 1; |
306 | #if BIO_FLAGS_UPLINK!=0 | 264 | #if BIO_FLAGS_UPLINK!=0 |
307 | #if defined(__MINGW32__) && defined(__MSVCRT__) && !defined(_IOB_ENTRIES) | ||
308 | #define _IOB_ENTRIES 20 | ||
309 | #endif | ||
310 | #if defined(_IOB_ENTRIES) | 265 | #if defined(_IOB_ENTRIES) |
311 | /* Safety net to catch purely internal BIO_set_fp calls */ | 266 | /* Safety net to catch purely internal BIO_set_fp calls */ |
312 | if ((size_t)ptr >= (size_t)stdin && | 267 | if ((size_t)ptr >= (size_t)stdin && |
@@ -317,37 +272,7 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
317 | #ifdef UP_fsetmod | 272 | #ifdef UP_fsetmod |
318 | if (b->flags&BIO_FLAGS_UPLINK) | 273 | if (b->flags&BIO_FLAGS_UPLINK) |
319 | UP_fsetmod(b->ptr,(char)((num&BIO_FP_TEXT)?'t':'b')); | 274 | UP_fsetmod(b->ptr,(char)((num&BIO_FP_TEXT)?'t':'b')); |
320 | else | ||
321 | #endif | 275 | #endif |
322 | { | ||
323 | #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) | ||
324 | int fd = fileno((FILE*)ptr); | ||
325 | /* Under CLib there are differences in file modes */ | ||
326 | if (num & BIO_FP_TEXT) | ||
327 | setmode(fd, O_TEXT); | ||
328 | else | ||
329 | setmode(fd, O_BINARY); | ||
330 | #elif defined(OPENSSL_SYS_MSDOS) | ||
331 | int fd = fileno((FILE*)ptr); | ||
332 | /* Set correct text/binary mode */ | ||
333 | if (num & BIO_FP_TEXT) | ||
334 | _setmode(fd, _O_TEXT); | ||
335 | /* Dangerous to set stdin/stdout to raw (unless redirected) */ | ||
336 | else { | ||
337 | if (fd == STDIN_FILENO || fd == STDOUT_FILENO) { | ||
338 | if (isatty(fd) <= 0) | ||
339 | _setmode(fd, _O_BINARY); | ||
340 | } else | ||
341 | _setmode(fd, _O_BINARY); | ||
342 | } | ||
343 | #elif defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_WIN32_CYGWIN) | ||
344 | int fd = fileno((FILE*)ptr); | ||
345 | if (num & BIO_FP_TEXT) | ||
346 | setmode(fd, O_TEXT); | ||
347 | else | ||
348 | setmode(fd, O_BINARY); | ||
349 | #endif | ||
350 | } | ||
351 | break; | 276 | break; |
352 | case BIO_C_SET_FILENAME: | 277 | case BIO_C_SET_FILENAME: |
353 | file_free(b); | 278 | file_free(b); |
@@ -367,18 +292,6 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
367 | ret = 0; | 292 | ret = 0; |
368 | break; | 293 | break; |
369 | } | 294 | } |
370 | #if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_WIN32_CYGWIN) | ||
371 | if (!(num & BIO_FP_TEXT)) | ||
372 | strcat(p, "b"); | ||
373 | else | ||
374 | strcat(p, "t"); | ||
375 | #endif | ||
376 | #if defined(OPENSSL_SYS_NETWARE) | ||
377 | if (!(num & BIO_FP_TEXT)) | ||
378 | strcat(p, "b"); | ||
379 | else | ||
380 | strcat(p, "t"); | ||
381 | #endif | ||
382 | fp = fopen(ptr, p); | 295 | fp = fopen(ptr, p); |
383 | if (fp == NULL) { | 296 | if (fp == NULL) { |
384 | SYSerr(SYS_F_FOPEN, errno); | 297 | SYSerr(SYS_F_FOPEN, errno); |
diff --git a/src/lib/libssl/src/crypto/bio/bss_log.c b/src/lib/libssl/src/crypto/bio/bss_log.c index 9225af4df2..5a79f72673 100644 --- a/src/lib/libssl/src/crypto/bio/bss_log.c +++ b/src/lib/libssl/src/crypto/bio/bss_log.c | |||
@@ -68,59 +68,13 @@ | |||
68 | 68 | ||
69 | #include "cryptlib.h" | 69 | #include "cryptlib.h" |
70 | 70 | ||
71 | #if defined(OPENSSL_SYS_WINCE) | 71 | #include <syslog.h> |
72 | #elif defined(OPENSSL_SYS_WIN32) | ||
73 | #elif defined(OPENSSL_SYS_VMS) | ||
74 | # include <opcdef.h> | ||
75 | # include <descrip.h> | ||
76 | # include <lib$routines.h> | ||
77 | # include <starlet.h> | ||
78 | /* Some compiler options may mask the declaration of "_malloc32". */ | ||
79 | # if __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE | ||
80 | # if __INITIAL_POINTER_SIZE == 64 | ||
81 | # pragma pointer_size save | ||
82 | # pragma pointer_size 32 | ||
83 | void * _malloc32 (__size_t); | ||
84 | # pragma pointer_size restore | ||
85 | # endif /* __INITIAL_POINTER_SIZE == 64 */ | ||
86 | # endif /* __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE */ | ||
87 | #elif defined(__ultrix) | ||
88 | # include <sys/syslog.h> | ||
89 | #elif defined(OPENSSL_SYS_NETWARE) | ||
90 | # define NO_SYSLOG | ||
91 | #elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG) | ||
92 | # include <syslog.h> | ||
93 | #endif | ||
94 | 72 | ||
95 | #include <openssl/buffer.h> | 73 | #include <openssl/buffer.h> |
96 | #include <openssl/err.h> | 74 | #include <openssl/err.h> |
97 | 75 | ||
98 | #ifndef NO_SYSLOG | 76 | #ifndef NO_SYSLOG |
99 | 77 | ||
100 | #if defined(OPENSSL_SYS_WIN32) | ||
101 | #define LOG_EMERG 0 | ||
102 | #define LOG_ALERT 1 | ||
103 | #define LOG_CRIT 2 | ||
104 | #define LOG_ERR 3 | ||
105 | #define LOG_WARNING 4 | ||
106 | #define LOG_NOTICE 5 | ||
107 | #define LOG_INFO 6 | ||
108 | #define LOG_DEBUG 7 | ||
109 | |||
110 | #define LOG_DAEMON (3<<3) | ||
111 | #elif defined(OPENSSL_SYS_VMS) | ||
112 | /* On VMS, we don't really care about these, but we need them to compile */ | ||
113 | #define LOG_EMERG 0 | ||
114 | #define LOG_ALERT 1 | ||
115 | #define LOG_CRIT 2 | ||
116 | #define LOG_ERR 3 | ||
117 | #define LOG_WARNING 4 | ||
118 | #define LOG_NOTICE 5 | ||
119 | #define LOG_INFO 6 | ||
120 | #define LOG_DEBUG 7 | ||
121 | |||
122 | #define LOG_DAEMON OPC$M_NM_NTWORK | ||
123 | #endif | ||
124 | 78 | ||
125 | static int slg_write(BIO *h, const char *buf, int num); | 79 | static int slg_write(BIO *h, const char *buf, int num); |
126 | static int slg_puts(BIO *h, const char *str); | 80 | static int slg_puts(BIO *h, const char *str); |
@@ -245,161 +199,11 @@ slg_puts(BIO *bp, const char *str) | |||
245 | return (ret); | 199 | return (ret); |
246 | } | 200 | } |
247 | 201 | ||
248 | #if defined(OPENSSL_SYS_WIN32) | ||
249 | |||
250 | static void | ||
251 | xopenlog(BIO* bp, char* name, int level) | ||
252 | { | ||
253 | if (check_winnt()) | ||
254 | bp->ptr = RegisterEventSourceA(NULL, name); | ||
255 | else | ||
256 | bp->ptr = NULL; | ||
257 | } | ||
258 | |||
259 | static void | ||
260 | xsyslog(BIO *bp, int priority, const char *string) | ||
261 | { | ||
262 | LPCSTR lpszStrings[2]; | ||
263 | WORD evtype = EVENTLOG_ERROR_TYPE; | ||
264 | char pidbuf[DECIMAL_SIZE(DWORD) + 4]; | ||
265 | |||
266 | if (bp->ptr == NULL) | ||
267 | return; | ||
268 | |||
269 | switch (priority) { | ||
270 | case LOG_EMERG: | ||
271 | case LOG_ALERT: | ||
272 | case LOG_CRIT: | ||
273 | case LOG_ERR: | ||
274 | evtype = EVENTLOG_ERROR_TYPE; | ||
275 | break; | ||
276 | case LOG_WARNING: | ||
277 | evtype = EVENTLOG_WARNING_TYPE; | ||
278 | break; | ||
279 | case LOG_NOTICE: | ||
280 | case LOG_INFO: | ||
281 | case LOG_DEBUG: | ||
282 | evtype = EVENTLOG_INFORMATION_TYPE; | ||
283 | break; | ||
284 | default: /* Should never happen, but set it | ||
285 | as error anyway. */ | ||
286 | evtype = EVENTLOG_ERROR_TYPE; | ||
287 | break; | ||
288 | } | ||
289 | |||
290 | sprintf(pidbuf, "[%u] ", GetCurrentProcessId()); | ||
291 | lpszStrings[0] = pidbuf; | ||
292 | lpszStrings[1] = string; | ||
293 | |||
294 | ReportEventA(bp->ptr, evtype, 0, 1024, NULL, 2, 0, | ||
295 | lpszStrings, NULL); | ||
296 | } | ||
297 | |||
298 | static void | ||
299 | xcloselog(BIO* bp) | ||
300 | { | ||
301 | if (bp->ptr) | ||
302 | DeregisterEventSource((HANDLE)(bp->ptr)); | ||
303 | bp->ptr = NULL; | ||
304 | } | ||
305 | |||
306 | #elif defined(OPENSSL_SYS_VMS) | ||
307 | |||
308 | static int VMS_OPC_target = LOG_DAEMON; | ||
309 | |||
310 | static void | ||
311 | xopenlog(BIO* bp, char* name, int level) | ||
312 | { | ||
313 | VMS_OPC_target = level; | ||
314 | |||
315 | } | ||
316 | |||
317 | static void | ||
318 | xsyslog(BIO *bp, int priority, const char *string) | ||
319 | { | ||
320 | struct dsc$descriptor_s opc_dsc; | ||
321 | |||
322 | /* Arrange 32-bit pointer to opcdef buffer and malloc(), if needed. */ | ||
323 | #if __INITIAL_POINTER_SIZE == 64 | ||
324 | # pragma pointer_size save | ||
325 | # pragma pointer_size 32 | ||
326 | # define OPCDEF_TYPE __char_ptr32 | ||
327 | # define OPCDEF_MALLOC _malloc32 | ||
328 | #else /* __INITIAL_POINTER_SIZE == 64 */ | ||
329 | # define OPCDEF_TYPE char * | ||
330 | # define OPCDEF_MALLOC OPENSSL_malloc | ||
331 | #endif /* __INITIAL_POINTER_SIZE == 64 [else] */ | ||
332 | |||
333 | struct opcdef *opcdef_p; | ||
334 | |||
335 | #if __INITIAL_POINTER_SIZE == 64 | ||
336 | # pragma pointer_size restore | ||
337 | #endif /* __INITIAL_POINTER_SIZE == 64 */ | ||
338 | |||
339 | char buf[10240]; | ||
340 | unsigned int len; | ||
341 | struct dsc$descriptor_s buf_dsc; | ||
342 | $DESCRIPTOR(fao_cmd, "!AZ: !AZ"); | ||
343 | char *priority_tag; | ||
344 | |||
345 | switch (priority) { | ||
346 | case LOG_EMERG: | ||
347 | priority_tag = "Emergency"; break; | ||
348 | case LOG_ALERT: | ||
349 | priority_tag = "Alert"; break; | ||
350 | case LOG_CRIT: | ||
351 | priority_tag = "Critical"; break; | ||
352 | case LOG_ERR: | ||
353 | priority_tag = "Error"; break; | ||
354 | case LOG_WARNING: | ||
355 | priority_tag = "Warning"; break; | ||
356 | case LOG_NOTICE: | ||
357 | priority_tag = "Notice"; break; | ||
358 | case LOG_INFO: | ||
359 | priority_tag = "Info"; break; | ||
360 | case LOG_DEBUG: | ||
361 | priority_tag = "DEBUG"; break; | ||
362 | } | ||
363 | |||
364 | buf_dsc.dsc$b_dtype = DSC$K_DTYPE_T; | ||
365 | buf_dsc.dsc$b_class = DSC$K_CLASS_S; | ||
366 | buf_dsc.dsc$a_pointer = buf; | ||
367 | buf_dsc.dsc$w_length = sizeof(buf) - 1; | ||
368 | |||
369 | lib$sys_fao(&fao_cmd, &len, &buf_dsc, priority_tag, string); | ||
370 | |||
371 | /* We know there's an 8-byte header. That's documented. */ | ||
372 | opcdef_p = OPCDEF_MALLOC( 8 + len); | ||
373 | opcdef_p->opc$b_ms_type = OPC$_RQ_RQST; | ||
374 | memcpy(opcdef_p->opc$z_ms_target_classes, &VMS_OPC_target, 3); | ||
375 | opcdef_p->opc$l_ms_rqstid = 0; | ||
376 | memcpy(&opcdef_p->opc$l_ms_text, buf, len); | ||
377 | |||
378 | opc_dsc.dsc$b_dtype = DSC$K_DTYPE_T; | ||
379 | opc_dsc.dsc$b_class = DSC$K_CLASS_S; | ||
380 | opc_dsc.dsc$a_pointer = (OPCDEF_TYPE) opcdef_p; | ||
381 | opc_dsc.dsc$w_length = len + 8; | ||
382 | |||
383 | sys$sndopr(opc_dsc, 0); | ||
384 | |||
385 | OPENSSL_free(opcdef_p); | ||
386 | } | ||
387 | |||
388 | static void | ||
389 | xcloselog(BIO* bp) | ||
390 | { | ||
391 | } | ||
392 | |||
393 | #else /* Unix/Watt32 */ | ||
394 | 202 | ||
395 | static void | 203 | static void |
396 | xopenlog(BIO* bp, char* name, int level) | 204 | xopenlog(BIO* bp, char* name, int level) |
397 | { | 205 | { |
398 | #ifdef WATT32 /* djgpp/DOS */ | ||
399 | openlog(name, LOG_PID|LOG_CONS|LOG_NDELAY, level); | ||
400 | #else | ||
401 | openlog(name, LOG_PID|LOG_CONS, level); | 206 | openlog(name, LOG_PID|LOG_CONS, level); |
402 | #endif | ||
403 | } | 207 | } |
404 | 208 | ||
405 | static void | 209 | static void |
@@ -414,6 +218,5 @@ xcloselog(BIO* bp) | |||
414 | closelog(); | 218 | closelog(); |
415 | } | 219 | } |
416 | 220 | ||
417 | #endif /* Unix */ | ||
418 | 221 | ||
419 | #endif /* NO_SYSLOG */ | 222 | #endif /* NO_SYSLOG */ |
diff --git a/src/lib/libssl/src/crypto/bio/bss_sock.c b/src/lib/libssl/src/crypto/bio/bss_sock.c index c05b8d37f1..b9cf817a0c 100644 --- a/src/lib/libssl/src/crypto/bio/bss_sock.c +++ b/src/lib/libssl/src/crypto/bio/bss_sock.c | |||
@@ -65,12 +65,6 @@ | |||
65 | 65 | ||
66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
67 | 67 | ||
68 | #ifdef WATT32 | ||
69 | #define sock_write SockWrite /* Watt-32 uses same names */ | ||
70 | #define sock_read SockRead | ||
71 | #define sock_puts SockPuts | ||
72 | #endif | ||
73 | |||
74 | static int sock_write(BIO *h, const char *buf, int num); | 68 | static int sock_write(BIO *h, const char *buf, int num); |
75 | static int sock_read(BIO *h, char *buf, int size); | 69 | static int sock_read(BIO *h, char *buf, int size); |
76 | static int sock_puts(BIO *h, const char *str); | 70 | static int sock_puts(BIO *h, const char *str); |