diff options
Diffstat (limited to 'src/lib/libcrypto/dh/dhtest.c')
-rw-r--r-- | src/lib/libcrypto/dh/dhtest.c | 28 |
1 files changed, 19 insertions, 9 deletions
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 |