diff options
| author | markus <> | 2003-05-12 02:18:40 +0000 |
|---|---|---|
| committer | markus <> | 2003-05-12 02:18:40 +0000 |
| commit | d4fcd82bb7f6d603bd61e19a81ba97337b89dfca (patch) | |
| tree | d52e3a0f1f08f65ad283027e560e17ed0d720462 /src/lib/libcrypto/ui | |
| parent | 582bbd139cd2afd58d10dc051c5b0b989b441074 (diff) | |
| download | openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.gz openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.bz2 openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.zip | |
merge 0.9.7b with local changes; crank majors for libssl/libcrypto
Diffstat (limited to 'src/lib/libcrypto/ui')
| -rw-r--r-- | src/lib/libcrypto/ui/Makefile.ssl | 18 | ||||
| -rw-r--r-- | src/lib/libcrypto/ui/ui_lib.c | 10 | ||||
| -rw-r--r-- | src/lib/libcrypto/ui/ui_openssl.c | 26 | ||||
| -rw-r--r-- | src/lib/libcrypto/ui/ui_util.c | 8 |
4 files changed, 39 insertions, 23 deletions
diff --git a/src/lib/libcrypto/ui/Makefile.ssl b/src/lib/libcrypto/ui/Makefile.ssl index 57b2e38335..ba46951d1c 100644 --- a/src/lib/libcrypto/ui/Makefile.ssl +++ b/src/lib/libcrypto/ui/Makefile.ssl | |||
| @@ -44,7 +44,7 @@ all: lib | |||
| 44 | 44 | ||
| 45 | lib: $(LIBOBJ) | 45 | lib: $(LIBOBJ) |
| 46 | $(AR) $(LIB) $(LIBOBJ) | 46 | $(AR) $(LIB) $(LIBOBJ) |
| 47 | $(RANLIB) $(LIB) | 47 | $(RANLIB) $(LIB) || echo Never mind. |
| 48 | @touch lib | 48 | @touch lib |
| 49 | 49 | ||
| 50 | files: | 50 | files: |
| @@ -72,7 +72,7 @@ lint: | |||
| 72 | lint -DLINT $(INCLUDES) $(SRC)>fluff | 72 | lint -DLINT $(INCLUDES) $(SRC)>fluff |
| 73 | 73 | ||
| 74 | depend: | 74 | depend: |
| 75 | $(MAKEDEPEND) $(CFLAG) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) | 75 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) |
| 76 | 76 | ||
| 77 | dclean: | 77 | dclean: |
| 78 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | 78 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new |
| @@ -95,13 +95,13 @@ ui_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | |||
| 95 | ui_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | 95 | ui_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h |
| 96 | ui_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 96 | ui_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 97 | ui_err.o: ../../include/openssl/ui.h ui_err.c | 97 | ui_err.o: ../../include/openssl/ui.h ui_err.c |
| 98 | ui_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 98 | ui_lib.o: ../../e_os.h ../../include/openssl/bio.h |
| 99 | ui_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 99 | ui_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 100 | ui_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | 100 | ui_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 101 | ui_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 101 | ui_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h |
| 102 | ui_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 102 | ui_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h |
| 103 | ui_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h ui_lib.c | 103 | ui_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 104 | ui_lib.o: ui_locl.h | 104 | ui_lib.o: ../../include/openssl/ui.h ../cryptlib.h ui_lib.c ui_locl.h |
| 105 | ui_openssl.o: ../../e_os.h ../../include/openssl/bio.h | 105 | ui_openssl.o: ../../e_os.h ../../include/openssl/bio.h |
| 106 | ui_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 106 | ui_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 107 | ui_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 107 | ui_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c index cce9075ac1..33c86d76ef 100644 --- a/src/lib/libcrypto/ui/ui_lib.c +++ b/src/lib/libcrypto/ui/ui_lib.c | |||
| @@ -62,6 +62,7 @@ | |||
| 62 | #include <openssl/ui.h> | 62 | #include <openssl/ui.h> |
| 63 | #include <openssl/err.h> | 63 | #include <openssl/err.h> |
| 64 | #include "ui_locl.h" | 64 | #include "ui_locl.h" |
| 65 | #include "cryptlib.h" | ||
| 65 | 66 | ||
| 66 | IMPLEMENT_STACK_OF(UI_STRING_ST) | 67 | IMPLEMENT_STACK_OF(UI_STRING_ST) |
| 67 | 68 | ||
| @@ -144,7 +145,8 @@ static UI_STRING *general_allocate_prompt(UI *ui, const char *prompt, | |||
| 144 | { | 145 | { |
| 145 | UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,ERR_R_PASSED_NULL_PARAMETER); | 146 | UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,ERR_R_PASSED_NULL_PARAMETER); |
| 146 | } | 147 | } |
| 147 | else if (result_buf == NULL) | 148 | else if ((type == UIT_PROMPT || type == UIT_VERIFY |
| 149 | || type == UIT_BOOLEAN) && result_buf == NULL) | ||
| 148 | { | 150 | { |
| 149 | UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,UI_R_NO_RESULT_BUFFER); | 151 | UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,UI_R_NO_RESULT_BUFFER); |
| 150 | } | 152 | } |
| @@ -235,7 +237,7 @@ static int general_allocate_boolean(UI *ui, | |||
| 235 | return ret; | 237 | return ret; |
| 236 | } | 238 | } |
| 237 | 239 | ||
| 238 | /* Returns the index to the place in the stack or 0 for error. Uses a | 240 | /* Returns the index to the place in the stack or -1 for error. Uses a |
| 239 | direct reference to the prompt. */ | 241 | direct reference to the prompt. */ |
| 240 | int UI_add_input_string(UI *ui, const char *prompt, int flags, | 242 | int UI_add_input_string(UI *ui, const char *prompt, int flags, |
| 241 | char *result_buf, int minsize, int maxsize) | 243 | char *result_buf, int minsize, int maxsize) |
| @@ -831,8 +833,8 @@ int UI_set_result(UI *ui, UI_STRING *uis, const char *result) | |||
| 831 | case UIT_PROMPT: | 833 | case UIT_PROMPT: |
| 832 | case UIT_VERIFY: | 834 | case UIT_VERIFY: |
| 833 | { | 835 | { |
| 834 | char number1[20]; | 836 | char number1[DECIMAL_SIZE(uis->_.string_data.result_minsize)+1]; |
| 835 | char number2[20]; | 837 | char number2[DECIMAL_SIZE(uis->_.string_data.result_maxsize)+1]; |
| 836 | 838 | ||
| 837 | BIO_snprintf(number1, sizeof(number1), "%d", | 839 | BIO_snprintf(number1, sizeof(number1), "%d", |
| 838 | uis->_.string_data.result_minsize); | 840 | uis->_.string_data.result_minsize); |
diff --git a/src/lib/libcrypto/ui/ui_openssl.c b/src/lib/libcrypto/ui/ui_openssl.c index f47ed31cb0..75318d48a1 100644 --- a/src/lib/libcrypto/ui/ui_openssl.c +++ b/src/lib/libcrypto/ui/ui_openssl.c | |||
| @@ -159,8 +159,10 @@ | |||
| 159 | 159 | ||
| 160 | #ifdef WIN_CONSOLE_BUG | 160 | #ifdef WIN_CONSOLE_BUG |
| 161 | # include <windows.h> | 161 | # include <windows.h> |
| 162 | #ifndef OPENSSL_SYS_WINCE | ||
| 162 | # include <wincon.h> | 163 | # include <wincon.h> |
| 163 | #endif | 164 | #endif |
| 165 | #endif | ||
| 164 | 166 | ||
| 165 | 167 | ||
| 166 | /* There are 5 types of terminal interface supported, | 168 | /* There are 5 types of terminal interface supported, |
| @@ -191,7 +193,7 @@ | |||
| 191 | # define SGTTY | 193 | # define SGTTY |
| 192 | #endif | 194 | #endif |
| 193 | 195 | ||
| 194 | #if defined(OPENSSL_SYS_VSWORKS) | 196 | #if defined(OPENSSL_SYS_VXWORKS) |
| 195 | #undef TERMIOS | 197 | #undef TERMIOS |
| 196 | #undef TERMIO | 198 | #undef TERMIO |
| 197 | #undef SGTTY | 199 | #undef SGTTY |
| @@ -221,7 +223,7 @@ | |||
| 221 | # define TTY_set(tty,data) ioctl(tty,TIOCSETP,data) | 223 | # define TTY_set(tty,data) ioctl(tty,TIOCSETP,data) |
| 222 | #endif | 224 | #endif |
| 223 | 225 | ||
| 224 | #if !defined(_LIBC) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_MACINTOSH_CLASSIC) | 226 | #if !defined(_LIBC) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && !defined(OPENSSL_SYS_SUNOS) |
| 225 | # include <sys/ioctl.h> | 227 | # include <sys/ioctl.h> |
| 226 | #endif | 228 | #endif |
| 227 | 229 | ||
| @@ -241,6 +243,10 @@ struct IOSB { | |||
| 241 | }; | 243 | }; |
| 242 | #endif | 244 | #endif |
| 243 | 245 | ||
| 246 | #ifdef OPENSSL_SYS_SUNOS | ||
| 247 | typedef int sig_atomic_t; | ||
| 248 | #endif | ||
| 249 | |||
| 244 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(MAC_OS_GUSI_SOURCE) | 250 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(MAC_OS_GUSI_SOURCE) |
| 245 | /* | 251 | /* |
| 246 | * This one needs work. As a matter of fact the code is unoperational | 252 | * This one needs work. As a matter of fact the code is unoperational |
| @@ -277,10 +283,12 @@ static FILE *tty_in, *tty_out; | |||
| 277 | static int is_a_tty; | 283 | static int is_a_tty; |
| 278 | 284 | ||
| 279 | /* Declare static functions */ | 285 | /* Declare static functions */ |
| 286 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) | ||
| 280 | static void read_till_nl(FILE *); | 287 | static void read_till_nl(FILE *); |
| 281 | static void recsig(int); | 288 | static void recsig(int); |
| 282 | static void pushsig(void); | 289 | static void pushsig(void); |
| 283 | static void popsig(void); | 290 | static void popsig(void); |
| 291 | #endif | ||
| 284 | #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) | 292 | #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) |
| 285 | static int noecho_fgets(char *buf, int size, FILE *tty); | 293 | static int noecho_fgets(char *buf, int size, FILE *tty); |
| 286 | #endif | 294 | #endif |
| @@ -367,6 +375,7 @@ static int read_string(UI *ui, UI_STRING *uis) | |||
| 367 | } | 375 | } |
| 368 | 376 | ||
| 369 | 377 | ||
| 378 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) | ||
| 370 | /* Internal functions to read a string without echoing */ | 379 | /* Internal functions to read a string without echoing */ |
| 371 | static void read_till_nl(FILE *in) | 380 | static void read_till_nl(FILE *in) |
| 372 | { | 381 | { |
| @@ -379,6 +388,7 @@ static void read_till_nl(FILE *in) | |||
| 379 | } | 388 | } |
| 380 | 389 | ||
| 381 | static volatile sig_atomic_t intr_signal; | 390 | static volatile sig_atomic_t intr_signal; |
| 391 | #endif | ||
| 382 | 392 | ||
| 383 | static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl) | 393 | static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl) |
| 384 | { | 394 | { |
| @@ -386,9 +396,9 @@ static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl) | |||
| 386 | int ok; | 396 | int ok; |
| 387 | char result[BUFSIZ]; | 397 | char result[BUFSIZ]; |
| 388 | int maxsize = BUFSIZ-1; | 398 | int maxsize = BUFSIZ-1; |
| 399 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) | ||
| 389 | char *p; | 400 | char *p; |
| 390 | 401 | ||
| 391 | #ifndef OPENSSL_SYS_WIN16 | ||
| 392 | intr_signal=0; | 402 | intr_signal=0; |
| 393 | ok=0; | 403 | ok=0; |
| 394 | ps=0; | 404 | ps=0; |
| @@ -439,7 +449,7 @@ error: | |||
| 439 | ok=1; | 449 | ok=1; |
| 440 | #endif | 450 | #endif |
| 441 | 451 | ||
| 442 | memset(result,0,BUFSIZ); | 452 | OPENSSL_cleanse(result,BUFSIZ); |
| 443 | return ok; | 453 | return ok; |
| 444 | } | 454 | } |
| 445 | 455 | ||
| @@ -450,7 +460,7 @@ static int open_console(UI *ui) | |||
| 450 | CRYPTO_w_lock(CRYPTO_LOCK_UI); | 460 | CRYPTO_w_lock(CRYPTO_LOCK_UI); |
| 451 | is_a_tty = 1; | 461 | is_a_tty = 1; |
| 452 | 462 | ||
| 453 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VSWORKS) | 463 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) |
| 454 | tty_in=stdin; | 464 | tty_in=stdin; |
| 455 | tty_out=stderr; | 465 | tty_out=stderr; |
| 456 | #else | 466 | #else |
| @@ -540,7 +550,7 @@ static int echo_console(UI *ui) | |||
| 540 | 550 | ||
| 541 | static int close_console(UI *ui) | 551 | static int close_console(UI *ui) |
| 542 | { | 552 | { |
| 543 | if (tty_in != stderr) fclose(tty_in); | 553 | if (tty_in != stdin) fclose(tty_in); |
| 544 | if (tty_out != stderr) fclose(tty_out); | 554 | if (tty_out != stderr) fclose(tty_out); |
| 545 | #ifdef OPENSSL_SYS_VMS | 555 | #ifdef OPENSSL_SYS_VMS |
| 546 | status = sys$dassgn(channel); | 556 | status = sys$dassgn(channel); |
| @@ -551,6 +561,7 @@ static int close_console(UI *ui) | |||
| 551 | } | 561 | } |
| 552 | 562 | ||
| 553 | 563 | ||
| 564 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) | ||
| 554 | /* Internal functions to handle signals and act on them */ | 565 | /* Internal functions to handle signals and act on them */ |
| 555 | static void pushsig(void) | 566 | static void pushsig(void) |
| 556 | { | 567 | { |
| @@ -614,9 +625,10 @@ static void recsig(int i) | |||
| 614 | { | 625 | { |
| 615 | intr_signal=i; | 626 | intr_signal=i; |
| 616 | } | 627 | } |
| 628 | #endif | ||
| 617 | 629 | ||
| 618 | /* Internal functions specific for Windows */ | 630 | /* Internal functions specific for Windows */ |
| 619 | #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) | 631 | #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) |
| 620 | static int noecho_fgets(char *buf, int size, FILE *tty) | 632 | static int noecho_fgets(char *buf, int size, FILE *tty) |
| 621 | { | 633 | { |
| 622 | int i; | 634 | int i; |
diff --git a/src/lib/libcrypto/ui/ui_util.c b/src/lib/libcrypto/ui/ui_util.c index f05573df33..46bc8c1a9a 100644 --- a/src/lib/libcrypto/ui/ui_util.c +++ b/src/lib/libcrypto/ui/ui_util.c | |||
| @@ -62,7 +62,7 @@ int UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify) | |||
| 62 | int ret; | 62 | int ret; |
| 63 | 63 | ||
| 64 | ret=UI_UTIL_read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify); | 64 | ret=UI_UTIL_read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify); |
| 65 | memset(buff,0,BUFSIZ); | 65 | OPENSSL_cleanse(buff,BUFSIZ); |
| 66 | return(ret); | 66 | return(ret); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| @@ -78,12 +78,14 @@ int UI_UTIL_read_pw(char *buf,char *buff,int size,const char *prompt,int verify) | |||
| 78 | if (ui) | 78 | if (ui) |
| 79 | { | 79 | { |
| 80 | ok = UI_add_input_string(ui,prompt,0,buf,0,size-1); | 80 | ok = UI_add_input_string(ui,prompt,0,buf,0,size-1); |
| 81 | if (ok == 0 && verify) | 81 | if (ok >= 0 && verify) |
| 82 | ok = UI_add_verify_string(ui,prompt,0,buff,0,size-1, | 82 | ok = UI_add_verify_string(ui,prompt,0,buff,0,size-1, |
| 83 | buf); | 83 | buf); |
| 84 | if (ok == 0) | 84 | if (ok >= 0) |
| 85 | ok=UI_process(ui); | 85 | ok=UI_process(ui); |
| 86 | UI_free(ui); | 86 | UI_free(ui); |
| 87 | } | 87 | } |
| 88 | if (ok > 0) | ||
| 89 | ok = 0; | ||
| 88 | return(ok); | 90 | return(ok); |
| 89 | } | 91 | } |
