summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ui/ui_openssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ui/ui_openssl.c')
-rw-r--r--src/lib/libcrypto/ui/ui_openssl.c26
1 files changed, 19 insertions, 7 deletions
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;
277static int is_a_tty; 283static int is_a_tty;
278 284
279/* Declare static functions */ 285/* Declare static functions */
286#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
280static void read_till_nl(FILE *); 287static void read_till_nl(FILE *);
281static void recsig(int); 288static void recsig(int);
282static void pushsig(void); 289static void pushsig(void);
283static void popsig(void); 290static 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)
285static int noecho_fgets(char *buf, int size, FILE *tty); 293static 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 */
371static void read_till_nl(FILE *in) 380static void read_till_nl(FILE *in)
372 { 381 {
@@ -379,6 +388,7 @@ static void read_till_nl(FILE *in)
379 } 388 }
380 389
381static volatile sig_atomic_t intr_signal; 390static volatile sig_atomic_t intr_signal;
391#endif
382 392
383static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl) 393static 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
541static int close_console(UI *ui) 551static 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 */
555static void pushsig(void) 566static 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)
620static int noecho_fgets(char *buf, int size, FILE *tty) 632static int noecho_fgets(char *buf, int size, FILE *tty)
621 { 633 {
622 int i; 634 int i;