diff options
| author | djm <> | 2008-09-06 12:15:56 +0000 |
|---|---|---|
| committer | djm <> | 2008-09-06 12:15:56 +0000 |
| commit | 5a3c0a05c7f2c5d3c584b7c8d6aec836dd724c80 (patch) | |
| tree | aba68249883aa9d2361d92eef69a81d0c4961732 /src/lib/libcrypto/ui/ui_openssl.c | |
| parent | f6198d4d0ab97685dc56be2d48715ed39fcc74b9 (diff) | |
| download | openbsd-5a3c0a05c7f2c5d3c584b7c8d6aec836dd724c80.tar.gz openbsd-5a3c0a05c7f2c5d3c584b7c8d6aec836dd724c80.tar.bz2 openbsd-5a3c0a05c7f2c5d3c584b7c8d6aec836dd724c80.zip | |
import of OpenSSL 0.9.8h
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 75318d48a1..1f23a45a33 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. |
| @@ -460,7 +473,7 @@ static int open_console(UI *ui) | |||
| 460 | CRYPTO_w_lock(CRYPTO_LOCK_UI); | 473 | CRYPTO_w_lock(CRYPTO_LOCK_UI); |
| 461 | is_a_tty = 1; | 474 | is_a_tty = 1; |
| 462 | 475 | ||
| 463 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) | 476 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) |
| 464 | tty_in=stdin; | 477 | tty_in=stdin; |
| 465 | tty_out=stderr; | 478 | tty_out=stderr; |
| 466 | #else | 479 | #else |
| @@ -476,7 +489,7 @@ static int open_console(UI *ui) | |||
| 476 | #endif | 489 | #endif |
| 477 | 490 | ||
| 478 | #if defined(TTY_get) && !defined(OPENSSL_SYS_VMS) | 491 | #if defined(TTY_get) && !defined(OPENSSL_SYS_VMS) |
| 479 | if (TTY_get(fileno(tty_in),&tty_orig) == -1) | 492 | if (TTY_get(fileno(tty_in),&tty_orig) == -1) |
| 480 | { | 493 | { |
| 481 | #ifdef ENOTTY | 494 | #ifdef ENOTTY |
| 482 | if (errno == ENOTTY) | 495 | if (errno == ENOTTY) |
| @@ -565,7 +578,9 @@ static int close_console(UI *ui) | |||
| 565 | /* Internal functions to handle signals and act on them */ | 578 | /* Internal functions to handle signals and act on them */ |
| 566 | static void pushsig(void) | 579 | static void pushsig(void) |
| 567 | { | 580 | { |
| 581 | #ifndef OPENSSL_SYS_WIN32 | ||
| 568 | int i; | 582 | int i; |
| 583 | #endif | ||
| 569 | #ifdef SIGACTION | 584 | #ifdef SIGACTION |
| 570 | struct sigaction sa; | 585 | struct sigaction sa; |
| 571 | 586 | ||
| @@ -573,6 +588,14 @@ static void pushsig(void) | |||
| 573 | sa.sa_handler=recsig; | 588 | sa.sa_handler=recsig; |
| 574 | #endif | 589 | #endif |
| 575 | 590 | ||
| 591 | #ifdef OPENSSL_SYS_WIN32 | ||
| 592 | savsig[SIGABRT]=signal(SIGABRT,recsig); | ||
| 593 | savsig[SIGFPE]=signal(SIGFPE,recsig); | ||
| 594 | savsig[SIGILL]=signal(SIGILL,recsig); | ||
| 595 | savsig[SIGINT]=signal(SIGINT,recsig); | ||
| 596 | savsig[SIGSEGV]=signal(SIGSEGV,recsig); | ||
| 597 | savsig[SIGTERM]=signal(SIGTERM,recsig); | ||
| 598 | #else | ||
| 576 | for (i=1; i<NX509_SIG; i++) | 599 | for (i=1; i<NX509_SIG; i++) |
| 577 | { | 600 | { |
| 578 | #ifdef SIGUSR1 | 601 | #ifdef SIGUSR1 |
| @@ -593,6 +616,7 @@ static void pushsig(void) | |||
| 593 | savsig[i]=signal(i,recsig); | 616 | savsig[i]=signal(i,recsig); |
| 594 | #endif | 617 | #endif |
| 595 | } | 618 | } |
| 619 | #endif | ||
| 596 | 620 | ||
| 597 | #ifdef SIGWINCH | 621 | #ifdef SIGWINCH |
| 598 | signal(SIGWINCH,SIG_DFL); | 622 | signal(SIGWINCH,SIG_DFL); |
| @@ -601,8 +625,15 @@ static void pushsig(void) | |||
| 601 | 625 | ||
| 602 | static void popsig(void) | 626 | static void popsig(void) |
| 603 | { | 627 | { |
| 628 | #ifdef OPENSSL_SYS_WIN32 | ||
| 629 | signal(SIGABRT,savsig[SIGABRT]); | ||
| 630 | signal(SIGFPE,savsig[SIGFPE]); | ||
| 631 | signal(SIGILL,savsig[SIGILL]); | ||
| 632 | signal(SIGINT,savsig[SIGINT]); | ||
| 633 | signal(SIGSEGV,savsig[SIGSEGV]); | ||
| 634 | signal(SIGTERM,savsig[SIGTERM]); | ||
| 635 | #else | ||
| 604 | int i; | 636 | int i; |
| 605 | |||
| 606 | for (i=1; i<NX509_SIG; i++) | 637 | for (i=1; i<NX509_SIG; i++) |
| 607 | { | 638 | { |
| 608 | #ifdef SIGUSR1 | 639 | #ifdef SIGUSR1 |
| @@ -619,6 +650,7 @@ static void popsig(void) | |||
| 619 | signal(i,savsig[i]); | 650 | signal(i,savsig[i]); |
| 620 | #endif | 651 | #endif |
| 621 | } | 652 | } |
| 653 | #endif | ||
| 622 | } | 654 | } |
| 623 | 655 | ||
| 624 | static void recsig(int i) | 656 | static void recsig(int i) |
