diff options
author | djm <> | 2008-09-06 12:15:54 +0000 |
---|---|---|
committer | djm <> | 2008-09-06 12:15:54 +0000 |
commit | f1625f274acf5dcd5601f6cb5e29e233b2a441a3 (patch) | |
tree | 44899ddfbef8f24aacbea50086c041c1b150f6d6 /src/lib/libcrypto/dh | |
parent | 4f828b924f54507141fb95ebe49dfcd261945e85 (diff) | |
download | openbsd-f1625f274acf5dcd5601f6cb5e29e233b2a441a3.tar.gz openbsd-f1625f274acf5dcd5601f6cb5e29e233b2a441a3.tar.bz2 openbsd-f1625f274acf5dcd5601f6cb5e29e233b2a441a3.zip |
import of OpenSSL 0.9.8h
Diffstat (limited to 'src/lib/libcrypto/dh')
-rw-r--r-- | src/lib/libcrypto/dh/Makefile | 44 | ||||
-rw-r--r-- | src/lib/libcrypto/dh/dhtest.c | 28 |
2 files changed, 42 insertions, 30 deletions
diff --git a/src/lib/libcrypto/dh/Makefile b/src/lib/libcrypto/dh/Makefile index 352678b94a..d368e33b4c 100644 --- a/src/lib/libcrypto/dh/Makefile +++ b/src/lib/libcrypto/dh/Makefile | |||
@@ -7,11 +7,6 @@ TOP= ../.. | |||
7 | CC= cc | 7 | CC= cc |
8 | INCLUDES= -I.. -I$(TOP) -I../../include | 8 | INCLUDES= -I.. -I$(TOP) -I../../include |
9 | CFLAG=-g | 9 | CFLAG=-g |
10 | INSTALL_PREFIX= | ||
11 | OPENSSLDIR= /usr/local/ssl | ||
12 | INSTALLTOP=/usr/local/ssl | ||
13 | MAKEDEPPROG= makedepend | ||
14 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
15 | MAKEFILE= Makefile | 10 | MAKEFILE= Makefile |
16 | AR= ar r | 11 | AR= ar r |
17 | 12 | ||
@@ -22,8 +17,8 @@ TEST= dhtest.c | |||
22 | APPS= | 17 | APPS= |
23 | 18 | ||
24 | LIB=$(TOP)/libcrypto.a | 19 | LIB=$(TOP)/libcrypto.a |
25 | LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c | 20 | LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr.c |
26 | LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o | 21 | LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o dh_depr.o |
27 | 22 | ||
28 | SRC= $(LIBSRC) | 23 | SRC= $(LIBSRC) |
29 | 24 | ||
@@ -51,6 +46,7 @@ links: | |||
51 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) |
52 | 47 | ||
53 | install: | 48 | install: |
49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
54 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ |
55 | do \ | 51 | do \ |
56 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ |
@@ -66,6 +62,7 @@ lint: | |||
66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff |
67 | 63 | ||
68 | depend: | 64 | depend: |
65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
69 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) |
70 | 67 | ||
71 | dclean: | 68 | dclean: |
@@ -95,13 +92,21 @@ dh_check.o: ../../include/openssl/opensslconf.h | |||
95 | dh_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 92 | dh_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
96 | dh_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 93 | dh_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
97 | dh_check.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_check.c | 94 | dh_check.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_check.c |
98 | dh_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 95 | dh_depr.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h |
99 | dh_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | 96 | dh_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
100 | dh_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 97 | dh_depr.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h |
101 | dh_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | 98 | dh_depr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h |
102 | dh_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 99 | dh_depr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
103 | dh_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 100 | dh_depr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
104 | dh_err.o: ../../include/openssl/symhacks.h dh_err.c | 101 | dh_depr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
102 | dh_depr.o: ../cryptlib.h dh_depr.c | ||
103 | dh_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
104 | dh_err.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
105 | dh_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
106 | dh_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
107 | dh_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
108 | dh_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
109 | dh_err.o: dh_err.c | ||
105 | dh_gen.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | 110 | dh_gen.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h |
106 | dh_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 111 | dh_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
107 | dh_gen.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | 112 | dh_gen.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h |
@@ -118,14 +123,11 @@ dh_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | |||
118 | dh_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | 123 | dh_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h |
119 | dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 124 | dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
120 | dh_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_key.c | 125 | dh_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_key.c |
121 | dh_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 126 | dh_lib.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h |
122 | dh_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | 127 | dh_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
123 | dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | 128 | dh_lib.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h |
124 | dh_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
125 | dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 129 | dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
126 | dh_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | 130 | dh_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h |
127 | dh_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 131 | dh_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
128 | dh_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
129 | dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 132 | dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
130 | dh_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | 133 | dh_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_lib.c |
131 | dh_lib.o: ../cryptlib.h dh_lib.c | ||
diff --git a/src/lib/libcrypto/dh/dhtest.c b/src/lib/libcrypto/dh/dhtest.c index b76dede771..882f5c310a 100644 --- a/src/lib/libcrypto/dh/dhtest.c +++ b/src/lib/libcrypto/dh/dhtest.c | |||
@@ -56,6 +56,12 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | /* Until the key-gen callbacks are modified to use newer prototypes, we allow | ||
60 | * deprecated functions for openssl-internal code */ | ||
61 | #ifdef OPENSSL_NO_DEPRECATED | ||
62 | #undef OPENSSL_NO_DEPRECATED | ||
63 | #endif | ||
64 | |||
59 | #include <stdio.h> | 65 | #include <stdio.h> |
60 | #include <stdlib.h> | 66 | #include <stdlib.h> |
61 | #include <string.h> | 67 | #include <string.h> |
@@ -83,12 +89,13 @@ int main(int argc, char *argv[]) | |||
83 | #define MS_CALLBACK | 89 | #define MS_CALLBACK |
84 | #endif | 90 | #endif |
85 | 91 | ||
86 | static void MS_CALLBACK cb(int p, int n, void *arg); | 92 | static int MS_CALLBACK cb(int p, int n, BN_GENCB *arg); |
87 | 93 | ||
88 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; | 94 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; |
89 | 95 | ||
90 | int main(int argc, char *argv[]) | 96 | int main(int argc, char *argv[]) |
91 | { | 97 | { |
98 | BN_GENCB _cb; | ||
92 | DH *a; | 99 | DH *a; |
93 | DH *b=NULL; | 100 | DH *b=NULL; |
94 | char buf[12]; | 101 | char buf[12]; |
@@ -110,8 +117,10 @@ int main(int argc, char *argv[]) | |||
110 | if (out == NULL) EXIT(1); | 117 | if (out == NULL) EXIT(1); |
111 | BIO_set_fp(out,stdout,BIO_NOCLOSE); | 118 | BIO_set_fp(out,stdout,BIO_NOCLOSE); |
112 | 119 | ||
113 | a=DH_generate_parameters(64,DH_GENERATOR_5,cb,out); | 120 | BN_GENCB_set(&_cb, &cb, out); |
114 | if (a == NULL) goto err; | 121 | if(((a = DH_new()) == NULL) || !DH_generate_parameters_ex(a, 64, |
122 | DH_GENERATOR_5, &_cb)) | ||
123 | goto err; | ||
115 | 124 | ||
116 | if (!DH_check(a, &i)) goto err; | 125 | if (!DH_check(a, &i)) goto err; |
117 | if (i & DH_CHECK_P_NOT_PRIME) | 126 | if (i & DH_CHECK_P_NOT_PRIME) |
@@ -192,14 +201,14 @@ err: | |||
192 | if(b != NULL) DH_free(b); | 201 | if(b != NULL) DH_free(b); |
193 | if(a != NULL) DH_free(a); | 202 | if(a != NULL) DH_free(a); |
194 | BIO_free(out); | 203 | BIO_free(out); |
195 | CRYPTO_cleanup_all_ex_data(); | 204 | #ifdef OPENSSL_SYS_NETWARE |
196 | ERR_remove_state(0); | 205 | if (ret) printf("ERROR: %d\n", ret); |
197 | CRYPTO_mem_leaks_fp(stderr); | 206 | #endif |
198 | EXIT(ret); | 207 | EXIT(ret); |
199 | return(ret); | 208 | return(ret); |
200 | } | 209 | } |
201 | 210 | ||
202 | static void MS_CALLBACK cb(int p, int n, void *arg) | 211 | static int MS_CALLBACK cb(int p, int n, BN_GENCB *arg) |
203 | { | 212 | { |
204 | char c='*'; | 213 | char c='*'; |
205 | 214 | ||
@@ -207,10 +216,11 @@ static void MS_CALLBACK cb(int p, int n, void *arg) | |||
207 | if (p == 1) c='+'; | 216 | if (p == 1) c='+'; |
208 | if (p == 2) c='*'; | 217 | if (p == 2) c='*'; |
209 | if (p == 3) c='\n'; | 218 | if (p == 3) c='\n'; |
210 | BIO_write((BIO *)arg,&c,1); | 219 | BIO_write(arg->arg,&c,1); |
211 | (void)BIO_flush((BIO *)arg); | 220 | (void)BIO_flush(arg->arg); |
212 | #ifdef LINT | 221 | #ifdef LINT |
213 | p=n; | 222 | p=n; |
214 | #endif | 223 | #endif |
224 | return 1; | ||
215 | } | 225 | } |
216 | #endif | 226 | #endif |