summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh
diff options
context:
space:
mode:
authordjm <>2008-09-06 12:15:54 +0000
committerdjm <>2008-09-06 12:15:54 +0000
commitf1625f274acf5dcd5601f6cb5e29e233b2a441a3 (patch)
tree44899ddfbef8f24aacbea50086c041c1b150f6d6 /src/lib/libcrypto/dh
parent4f828b924f54507141fb95ebe49dfcd261945e85 (diff)
downloadopenbsd-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/Makefile44
-rw-r--r--src/lib/libcrypto/dh/dhtest.c28
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= ../..
7CC= cc 7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include 8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g 9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKEDEPPROG= makedepend
14MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
15MAKEFILE= Makefile 10MAKEFILE= Makefile
16AR= ar r 11AR= ar r
17 12
@@ -22,8 +17,8 @@ TEST= dhtest.c
22APPS= 17APPS=
23 18
24LIB=$(TOP)/libcrypto.a 19LIB=$(TOP)/libcrypto.a
25LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c 20LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr.c
26LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o 21LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o dh_depr.o
27 22
28SRC= $(LIBSRC) 23SRC= $(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
53install: 48install:
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
68depend: 64depend:
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
71dclean: 68dclean:
@@ -95,13 +92,21 @@ dh_check.o: ../../include/openssl/opensslconf.h
95dh_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h 92dh_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
96dh_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 93dh_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
97dh_check.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_check.c 94dh_check.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_check.c
98dh_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 95dh_depr.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
99dh_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h 96dh_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
100dh_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 97dh_depr.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
101dh_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 98dh_depr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
102dh_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h 99dh_depr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
103dh_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 100dh_depr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
104dh_err.o: ../../include/openssl/symhacks.h dh_err.c 101dh_depr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
102dh_depr.o: ../cryptlib.h dh_depr.c
103dh_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
104dh_err.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
105dh_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
106dh_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
107dh_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
108dh_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
109dh_err.o: dh_err.c
105dh_gen.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h 110dh_gen.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
106dh_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 111dh_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
107dh_gen.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h 112dh_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
118dh_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h 123dh_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
119dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 124dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
120dh_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_key.c 125dh_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_key.c
121dh_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h 126dh_lib.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
122dh_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 127dh_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
123dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h 128dh_lib.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
124dh_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
125dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h 129dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
126dh_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 130dh_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
127dh_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h 131dh_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
128dh_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
129dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 132dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
130dh_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h 133dh_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_lib.c
131dh_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
86static void MS_CALLBACK cb(int p, int n, void *arg); 92static int MS_CALLBACK cb(int p, int n, BN_GENCB *arg);
87 93
88static const char rnd_seed[] = "string to make the random number generator think it has entropy"; 94static const char rnd_seed[] = "string to make the random number generator think it has entropy";
89 95
90int main(int argc, char *argv[]) 96int 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
202static void MS_CALLBACK cb(int p, int n, void *arg) 211static 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