summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh/dhtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/dh/dhtest.c')
-rw-r--r--src/lib/libcrypto/dh/dhtest.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/lib/libcrypto/dh/dhtest.c b/src/lib/libcrypto/dh/dhtest.c
index 882f5c310a..b76dede771 100644
--- a/src/lib/libcrypto/dh/dhtest.c
+++ b/src/lib/libcrypto/dh/dhtest.c
@@ -56,12 +56,6 @@
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
65#include <stdio.h> 59#include <stdio.h>
66#include <stdlib.h> 60#include <stdlib.h>
67#include <string.h> 61#include <string.h>
@@ -89,13 +83,12 @@ int main(int argc, char *argv[])
89#define MS_CALLBACK 83#define MS_CALLBACK
90#endif 84#endif
91 85
92static int MS_CALLBACK cb(int p, int n, BN_GENCB *arg); 86static void MS_CALLBACK cb(int p, int n, void *arg);
93 87
94static const char rnd_seed[] = "string to make the random number generator think it has entropy"; 88static const char rnd_seed[] = "string to make the random number generator think it has entropy";
95 89
96int main(int argc, char *argv[]) 90int main(int argc, char *argv[])
97 { 91 {
98 BN_GENCB _cb;
99 DH *a; 92 DH *a;
100 DH *b=NULL; 93 DH *b=NULL;
101 char buf[12]; 94 char buf[12];
@@ -117,10 +110,8 @@ int main(int argc, char *argv[])
117 if (out == NULL) EXIT(1); 110 if (out == NULL) EXIT(1);
118 BIO_set_fp(out,stdout,BIO_NOCLOSE); 111 BIO_set_fp(out,stdout,BIO_NOCLOSE);
119 112
120 BN_GENCB_set(&_cb, &cb, out); 113 a=DH_generate_parameters(64,DH_GENERATOR_5,cb,out);
121 if(((a = DH_new()) == NULL) || !DH_generate_parameters_ex(a, 64, 114 if (a == NULL) goto err;
122 DH_GENERATOR_5, &_cb))
123 goto err;
124 115
125 if (!DH_check(a, &i)) goto err; 116 if (!DH_check(a, &i)) goto err;
126 if (i & DH_CHECK_P_NOT_PRIME) 117 if (i & DH_CHECK_P_NOT_PRIME)
@@ -201,14 +192,14 @@ err:
201 if(b != NULL) DH_free(b); 192 if(b != NULL) DH_free(b);
202 if(a != NULL) DH_free(a); 193 if(a != NULL) DH_free(a);
203 BIO_free(out); 194 BIO_free(out);
204#ifdef OPENSSL_SYS_NETWARE 195 CRYPTO_cleanup_all_ex_data();
205 if (ret) printf("ERROR: %d\n", ret); 196 ERR_remove_state(0);
206#endif 197 CRYPTO_mem_leaks_fp(stderr);
207 EXIT(ret); 198 EXIT(ret);
208 return(ret); 199 return(ret);
209 } 200 }
210 201
211static int MS_CALLBACK cb(int p, int n, BN_GENCB *arg) 202static void MS_CALLBACK cb(int p, int n, void *arg)
212 { 203 {
213 char c='*'; 204 char c='*';
214 205
@@ -216,11 +207,10 @@ static int MS_CALLBACK cb(int p, int n, BN_GENCB *arg)
216 if (p == 1) c='+'; 207 if (p == 1) c='+';
217 if (p == 2) c='*'; 208 if (p == 2) c='*';
218 if (p == 3) c='\n'; 209 if (p == 3) c='\n';
219 BIO_write(arg->arg,&c,1); 210 BIO_write((BIO *)arg,&c,1);
220 (void)BIO_flush(arg->arg); 211 (void)BIO_flush((BIO *)arg);
221#ifdef LINT 212#ifdef LINT
222 p=n; 213 p=n;
223#endif 214#endif
224 return 1;
225 } 215 }
226#endif 216#endif