diff options
author | djm <> | 2010-10-01 22:59:01 +0000 |
---|---|---|
committer | djm <> | 2010-10-01 22:59:01 +0000 |
commit | fe047d8b632246cb2db3234a0a4f32e5c318857b (patch) | |
tree | 939b752540947d33507b3acc48d76a8bfb7c3dc3 /src/lib/libcrypto/ui | |
parent | 2ea67f4aa254b09ded62e6e14fc893bbe6381579 (diff) | |
download | openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.tar.gz openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.tar.bz2 openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.zip |
resolve conflicts, fix local changes
Diffstat (limited to 'src/lib/libcrypto/ui')
-rw-r--r-- | src/lib/libcrypto/ui/Makefile.ssl | 117 | ||||
-rw-r--r-- | src/lib/libcrypto/ui/ui.h | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ui/ui_err.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/ui/ui_lib.c | 19 | ||||
-rw-r--r-- | src/lib/libcrypto/ui/ui_openssl.c | 14 |
5 files changed, 32 insertions, 124 deletions
diff --git a/src/lib/libcrypto/ui/Makefile.ssl b/src/lib/libcrypto/ui/Makefile.ssl deleted file mode 100644 index ba46951d1c..0000000000 --- a/src/lib/libcrypto/ui/Makefile.ssl +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | # | ||
2 | # OpenSSL/crypto/ui/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= ui | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALL_PREFIX= | ||
11 | OPENSSLDIR= /usr/local/ssl | ||
12 | INSTALLTOP=/usr/local/ssl | ||
13 | MAKE= make -f Makefile.ssl | ||
14 | MAKEDEPPROG= makedepend | ||
15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
16 | MAKEFILE= Makefile.ssl | ||
17 | AR= ar r | ||
18 | |||
19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
20 | |||
21 | GENERAL=Makefile | ||
22 | #TEST= uitest.c | ||
23 | TEST= | ||
24 | APPS= | ||
25 | |||
26 | COMPATSRC= ui_compat.c | ||
27 | COMPATOBJ= ui_compat.o | ||
28 | |||
29 | LIB=$(TOP)/libcrypto.a | ||
30 | LIBSRC= ui_err.c ui_lib.c ui_openssl.c ui_util.c $(COMPATSRC) | ||
31 | LIBOBJ= ui_err.o ui_lib.o ui_openssl.o ui_util.o $(COMPATOBJ) | ||
32 | |||
33 | SRC= $(LIBSRC) | ||
34 | |||
35 | EXHEADER= ui.h ui_compat.h | ||
36 | HEADER= $(EXHEADER) ui_locl.h | ||
37 | |||
38 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
39 | |||
40 | top: | ||
41 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
42 | |||
43 | all: lib | ||
44 | |||
45 | lib: $(LIBOBJ) | ||
46 | $(AR) $(LIB) $(LIBOBJ) | ||
47 | $(RANLIB) $(LIB) || echo Never mind. | ||
48 | @touch lib | ||
49 | |||
50 | files: | ||
51 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
52 | |||
53 | links: | ||
54 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
55 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
56 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
57 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
58 | |||
59 | install: | ||
60 | @for i in $(EXHEADER) ; \ | ||
61 | do \ | ||
62 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
63 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
64 | done; | ||
65 | |||
66 | tags: | ||
67 | ctags $(SRC) | ||
68 | |||
69 | tests: | ||
70 | |||
71 | lint: | ||
72 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
73 | |||
74 | depend: | ||
75 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
76 | |||
77 | dclean: | ||
78 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
79 | mv -f Makefile.new $(MAKEFILE) | ||
80 | |||
81 | clean: | ||
82 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
83 | |||
84 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
85 | |||
86 | ui_compat.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
87 | ui_compat.o: ../../include/openssl/opensslconf.h | ||
88 | ui_compat.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
89 | ui_compat.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
90 | ui_compat.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
91 | ui_compat.o: ui_compat.c | ||
92 | ui_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
93 | ui_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
94 | ui_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.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 | ||
97 | ui_err.o: ../../include/openssl/ui.h ui_err.c | ||
98 | ui_lib.o: ../../e_os.h ../../include/openssl/bio.h | ||
99 | ui_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
100 | ui_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
101 | ui_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
102 | ui_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
103 | ui_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.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 | ||
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 | ||
108 | ui_openssl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
109 | ui_openssl.o: ../../include/openssl/opensslv.h | ||
110 | ui_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
111 | ui_openssl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
112 | ui_openssl.o: ../cryptlib.h ui_locl.h ui_openssl.c | ||
113 | ui_util.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
114 | ui_util.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
115 | ui_util.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
116 | ui_util.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
117 | ui_util.o: ui_util.c | ||
diff --git a/src/lib/libcrypto/ui/ui.h b/src/lib/libcrypto/ui/ui.h index 018296412b..2b1cfa2289 100644 --- a/src/lib/libcrypto/ui/ui.h +++ b/src/lib/libcrypto/ui/ui.h | |||
@@ -287,8 +287,8 @@ UI_METHOD *UI_OpenSSL(void); | |||
287 | /* The UI_STRING type is the data structure that contains all the needed info | 287 | /* The UI_STRING type is the data structure that contains all the needed info |
288 | about a string or a prompt, including test data for a verification prompt. | 288 | about a string or a prompt, including test data for a verification prompt. |
289 | */ | 289 | */ |
290 | DECLARE_STACK_OF(UI_STRING) | ||
291 | typedef struct ui_string_st UI_STRING; | 290 | typedef struct ui_string_st UI_STRING; |
291 | DECLARE_STACK_OF(UI_STRING) | ||
292 | 292 | ||
293 | /* The different types of strings that are currently supported. | 293 | /* The different types of strings that are currently supported. |
294 | This is only needed by method authors. */ | 294 | This is only needed by method authors. */ |
@@ -310,11 +310,13 @@ int UI_method_set_writer(UI_METHOD *method, int (*writer)(UI *ui, UI_STRING *uis | |||
310 | int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui)); | 310 | int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui)); |
311 | int UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis)); | 311 | int UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis)); |
312 | int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui)); | 312 | int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui)); |
313 | int UI_method_set_prompt_constructor(UI_METHOD *method, char *(*prompt_constructor)(UI* ui, const char* object_desc, const char* object_name)); | ||
313 | int (*UI_method_get_opener(UI_METHOD *method))(UI*); | 314 | int (*UI_method_get_opener(UI_METHOD *method))(UI*); |
314 | int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*); | 315 | int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*); |
315 | int (*UI_method_get_flusher(UI_METHOD *method))(UI*); | 316 | int (*UI_method_get_flusher(UI_METHOD *method))(UI*); |
316 | int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*); | 317 | int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*); |
317 | int (*UI_method_get_closer(UI_METHOD *method))(UI*); | 318 | int (*UI_method_get_closer(UI_METHOD *method))(UI*); |
319 | char* (*UI_method_get_prompt_constructor(UI_METHOD *method))(UI*, const char*, const char*); | ||
318 | 320 | ||
319 | /* The following functions are helpers for method writers to access relevant | 321 | /* The following functions are helpers for method writers to access relevant |
320 | data from a UI_STRING. */ | 322 | data from a UI_STRING. */ |
diff --git a/src/lib/libcrypto/ui/ui_err.c b/src/lib/libcrypto/ui/ui_err.c index 786bd0dbc3..a6b96299a0 100644 --- a/src/lib/libcrypto/ui/ui_err.c +++ b/src/lib/libcrypto/ui/ui_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/ui/ui_err.c */ | 1 | /* crypto/ui/ui_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c index ac0100808f..a8abc27064 100644 --- a/src/lib/libcrypto/ui/ui_lib.c +++ b/src/lib/libcrypto/ui/ui_lib.c | |||
@@ -693,6 +693,17 @@ int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui)) | |||
693 | return -1; | 693 | return -1; |
694 | } | 694 | } |
695 | 695 | ||
696 | int UI_method_set_prompt_constructor(UI_METHOD *method, char *(*prompt_constructor)(UI* ui, const char* object_desc, const char* object_name)) | ||
697 | { | ||
698 | if (method) | ||
699 | { | ||
700 | method->ui_construct_prompt = prompt_constructor; | ||
701 | return 0; | ||
702 | } | ||
703 | else | ||
704 | return -1; | ||
705 | } | ||
706 | |||
696 | int (*UI_method_get_opener(UI_METHOD *method))(UI*) | 707 | int (*UI_method_get_opener(UI_METHOD *method))(UI*) |
697 | { | 708 | { |
698 | if (method) | 709 | if (method) |
@@ -733,6 +744,14 @@ int (*UI_method_get_closer(UI_METHOD *method))(UI*) | |||
733 | return NULL; | 744 | return NULL; |
734 | } | 745 | } |
735 | 746 | ||
747 | char* (*UI_method_get_prompt_constructor(UI_METHOD *method))(UI*, const char*, const char*) | ||
748 | { | ||
749 | if (method) | ||
750 | return method->ui_construct_prompt; | ||
751 | else | ||
752 | return NULL; | ||
753 | } | ||
754 | |||
736 | enum UI_string_types UI_get_string_type(UI_STRING *uis) | 755 | enum UI_string_types UI_get_string_type(UI_STRING *uis) |
737 | { | 756 | { |
738 | if (!uis) | 757 | if (!uis) |
diff --git a/src/lib/libcrypto/ui/ui_openssl.c b/src/lib/libcrypto/ui/ui_openssl.c index 5fbedf6ff8..1e3dba0833 100644 --- a/src/lib/libcrypto/ui/ui_openssl.c +++ b/src/lib/libcrypto/ui/ui_openssl.c | |||
@@ -122,7 +122,9 @@ | |||
122 | * sigaction and fileno included. -pedantic would be more appropriate for | 122 | * sigaction and fileno included. -pedantic would be more appropriate for |
123 | * the intended purposes, but we can't prevent users from adding -ansi. | 123 | * the intended purposes, but we can't prevent users from adding -ansi. |
124 | */ | 124 | */ |
125 | #define _POSIX_C_SOURCE 1 | 125 | #ifndef _POSIX_C_SOURCE |
126 | #define _POSIX_C_SOURCE 2 | ||
127 | #endif | ||
126 | #include <signal.h> | 128 | #include <signal.h> |
127 | #include <stdio.h> | 129 | #include <stdio.h> |
128 | #include <string.h> | 130 | #include <string.h> |
@@ -297,7 +299,7 @@ static int is_a_tty; | |||
297 | 299 | ||
298 | /* Declare static functions */ | 300 | /* Declare static functions */ |
299 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) | 301 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) |
300 | static void read_till_nl(FILE *); | 302 | static int read_till_nl(FILE *); |
301 | static void recsig(int); | 303 | static void recsig(int); |
302 | static void pushsig(void); | 304 | static void pushsig(void); |
303 | static void popsig(void); | 305 | static void popsig(void); |
@@ -390,7 +392,7 @@ static int read_string(UI *ui, UI_STRING *uis) | |||
390 | 392 | ||
391 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) | 393 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) |
392 | /* Internal functions to read a string without echoing */ | 394 | /* Internal functions to read a string without echoing */ |
393 | static void read_till_nl(FILE *in) | 395 | static int read_till_nl(FILE *in) |
394 | { | 396 | { |
395 | #define SIZE 4 | 397 | #define SIZE 4 |
396 | char buf[SIZE+1]; | 398 | char buf[SIZE+1]; |
@@ -399,6 +401,7 @@ static void read_till_nl(FILE *in) | |||
399 | if (fgets(buf,sizeof(buf),in) == NULL) | 401 | if (fgets(buf,sizeof(buf),in) == NULL) |
400 | break; | 402 | break; |
401 | } while (strchr(buf,'\n') == NULL); | 403 | } while (strchr(buf,'\n') == NULL); |
404 | return 1; | ||
402 | } | 405 | } |
403 | 406 | ||
404 | static volatile sig_atomic_t intr_signal; | 407 | static volatile sig_atomic_t intr_signal; |
@@ -446,7 +449,8 @@ static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl) | |||
446 | *p='\0'; | 449 | *p='\0'; |
447 | } | 450 | } |
448 | else | 451 | else |
449 | read_till_nl(tty_in); | 452 | if (!read_till_nl(tty_in)) |
453 | goto error; | ||
450 | if (UI_set_result(ui, uis, result) >= 0) | 454 | if (UI_set_result(ui, uis, result) >= 0) |
451 | ok=1; | 455 | ok=1; |
452 | 456 | ||
@@ -474,7 +478,7 @@ static int open_console(UI *ui) | |||
474 | CRYPTO_w_lock(CRYPTO_LOCK_UI); | 478 | CRYPTO_w_lock(CRYPTO_LOCK_UI); |
475 | is_a_tty = 1; | 479 | is_a_tty = 1; |
476 | 480 | ||
477 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) | 481 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS) |
478 | tty_in=stdin; | 482 | tty_in=stdin; |
479 | tty_out=stderr; | 483 | tty_out=stderr; |
480 | #else | 484 | #else |