diff options
Diffstat (limited to 'src/lib/libcrypto/ui/ui_openssl.c')
-rw-r--r-- | src/lib/libcrypto/ui/ui_openssl.c | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/src/lib/libcrypto/ui/ui_openssl.c b/src/lib/libcrypto/ui/ui_openssl.c index d03aeba91a..8446673ed4 100644 --- a/src/lib/libcrypto/ui/ui_openssl.c +++ b/src/lib/libcrypto/ui/ui_openssl.c | |||
@@ -117,6 +117,17 @@ | |||
117 | 117 | ||
118 | #include <openssl/e_os2.h> | 118 | #include <openssl/e_os2.h> |
119 | 119 | ||
120 | /* need for #define _POSIX_C_SOURCE arises whenever you pass -ansi to gcc | ||
121 | * [maybe others?], because it masks interfaces not discussed in standard, | ||
122 | * sigaction and fileno included. -pedantic would be more appropriate for | ||
123 | * the intended purposes, but we can't prevent users from adding -ansi. | ||
124 | */ | ||
125 | #define _POSIX_C_SOURCE 1 | ||
126 | #include <signal.h> | ||
127 | #include <stdio.h> | ||
128 | #include <string.h> | ||
129 | #include <errno.h> | ||
130 | |||
120 | #if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) | 131 | #if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) |
121 | # ifdef OPENSSL_UNISTD | 132 | # ifdef OPENSSL_UNISTD |
122 | # include OPENSSL_UNISTD | 133 | # include OPENSSL_UNISTD |
@@ -145,10 +156,6 @@ | |||
145 | /* 06-Apr-92 Luke Brennan Support for VMS */ | 156 | /* 06-Apr-92 Luke Brennan Support for VMS */ |
146 | #include "ui_locl.h" | 157 | #include "ui_locl.h" |
147 | #include "cryptlib.h" | 158 | #include "cryptlib.h" |
148 | #include <signal.h> | ||
149 | #include <stdio.h> | ||
150 | #include <string.h> | ||
151 | #include <errno.h> | ||
152 | 159 | ||
153 | #ifdef OPENSSL_SYS_VMS /* prototypes for sys$whatever */ | 160 | #ifdef OPENSSL_SYS_VMS /* prototypes for sys$whatever */ |
154 | # include <starlet.h> | 161 | # include <starlet.h> |
@@ -199,6 +206,12 @@ | |||
199 | #undef SGTTY | 206 | #undef SGTTY |
200 | #endif | 207 | #endif |
201 | 208 | ||
209 | #if defined(OPENSSL_SYS_NETWARE) | ||
210 | #undef TERMIOS | ||
211 | #undef TERMIO | ||
212 | #undef SGTTY | ||
213 | #endif | ||
214 | |||
202 | #ifdef TERMIOS | 215 | #ifdef TERMIOS |
203 | # include <termios.h> | 216 | # include <termios.h> |
204 | # define TTY_STRUCT struct termios | 217 | # define TTY_STRUCT struct termios |
@@ -247,7 +260,7 @@ struct IOSB { | |||
247 | typedef int sig_atomic_t; | 260 | typedef int sig_atomic_t; |
248 | #endif | 261 | #endif |
249 | 262 | ||
250 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(MAC_OS_GUSI_SOURCE) | 263 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(MAC_OS_GUSI_SOURCE) || defined(OPENSSL_SYS_NETWARE) |
251 | /* | 264 | /* |
252 | * This one needs work. As a matter of fact the code is unoperational | 265 | * This one needs work. As a matter of fact the code is unoperational |
253 | * and this is only a trick to get it compiled. | 266 | * and this is only a trick to get it compiled. |
@@ -461,7 +474,7 @@ static int open_console(UI *ui) | |||
461 | CRYPTO_w_lock(CRYPTO_LOCK_UI); | 474 | CRYPTO_w_lock(CRYPTO_LOCK_UI); |
462 | is_a_tty = 1; | 475 | is_a_tty = 1; |
463 | 476 | ||
464 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) | 477 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) |
465 | tty_in=stdin; | 478 | tty_in=stdin; |
466 | tty_out=stderr; | 479 | tty_out=stderr; |
467 | #else | 480 | #else |
@@ -477,7 +490,7 @@ static int open_console(UI *ui) | |||
477 | #endif | 490 | #endif |
478 | 491 | ||
479 | #if defined(TTY_get) && !defined(OPENSSL_SYS_VMS) | 492 | #if defined(TTY_get) && !defined(OPENSSL_SYS_VMS) |
480 | if (TTY_get(fileno(tty_in),&tty_orig) == -1) | 493 | if (TTY_get(fileno(tty_in),&tty_orig) == -1) |
481 | { | 494 | { |
482 | #ifdef ENOTTY | 495 | #ifdef ENOTTY |
483 | if (errno == ENOTTY) | 496 | if (errno == ENOTTY) |
@@ -566,7 +579,9 @@ static int close_console(UI *ui) | |||
566 | /* Internal functions to handle signals and act on them */ | 579 | /* Internal functions to handle signals and act on them */ |
567 | static void pushsig(void) | 580 | static void pushsig(void) |
568 | { | 581 | { |
582 | #ifndef OPENSSL_SYS_WIN32 | ||
569 | int i; | 583 | int i; |
584 | #endif | ||
570 | #ifdef SIGACTION | 585 | #ifdef SIGACTION |
571 | struct sigaction sa; | 586 | struct sigaction sa; |
572 | 587 | ||
@@ -574,6 +589,14 @@ static void pushsig(void) | |||
574 | sa.sa_handler=recsig; | 589 | sa.sa_handler=recsig; |
575 | #endif | 590 | #endif |
576 | 591 | ||
592 | #ifdef OPENSSL_SYS_WIN32 | ||
593 | savsig[SIGABRT]=signal(SIGABRT,recsig); | ||
594 | savsig[SIGFPE]=signal(SIGFPE,recsig); | ||
595 | savsig[SIGILL]=signal(SIGILL,recsig); | ||
596 | savsig[SIGINT]=signal(SIGINT,recsig); | ||
597 | savsig[SIGSEGV]=signal(SIGSEGV,recsig); | ||
598 | savsig[SIGTERM]=signal(SIGTERM,recsig); | ||
599 | #else | ||
577 | for (i=1; i<NX509_SIG; i++) | 600 | for (i=1; i<NX509_SIG; i++) |
578 | { | 601 | { |
579 | #ifdef SIGUSR1 | 602 | #ifdef SIGUSR1 |
@@ -594,6 +617,7 @@ static void pushsig(void) | |||
594 | savsig[i]=signal(i,recsig); | 617 | savsig[i]=signal(i,recsig); |
595 | #endif | 618 | #endif |
596 | } | 619 | } |
620 | #endif | ||
597 | 621 | ||
598 | #ifdef SIGWINCH | 622 | #ifdef SIGWINCH |
599 | signal(SIGWINCH,SIG_DFL); | 623 | signal(SIGWINCH,SIG_DFL); |
@@ -602,8 +626,15 @@ static void pushsig(void) | |||
602 | 626 | ||
603 | static void popsig(void) | 627 | static void popsig(void) |
604 | { | 628 | { |
629 | #ifdef OPENSSL_SYS_WIN32 | ||
630 | signal(SIGABRT,savsig[SIGABRT]); | ||
631 | signal(SIGFPE,savsig[SIGFPE]); | ||
632 | signal(SIGILL,savsig[SIGILL]); | ||
633 | signal(SIGINT,savsig[SIGINT]); | ||
634 | signal(SIGSEGV,savsig[SIGSEGV]); | ||
635 | signal(SIGTERM,savsig[SIGTERM]); | ||
636 | #else | ||
605 | int i; | 637 | int i; |
606 | |||
607 | for (i=1; i<NX509_SIG; i++) | 638 | for (i=1; i<NX509_SIG; i++) |
608 | { | 639 | { |
609 | #ifdef SIGUSR1 | 640 | #ifdef SIGUSR1 |
@@ -620,6 +651,7 @@ static void popsig(void) | |||
620 | signal(i,savsig[i]); | 651 | signal(i,savsig[i]); |
621 | #endif | 652 | #endif |
622 | } | 653 | } |
654 | #endif | ||
623 | } | 655 | } |
624 | 656 | ||
625 | static void recsig(int i) | 657 | static void recsig(int i) |