diff options
Diffstat (limited to 'src/lib/libcrypto/dsa/dsatest.c')
-rw-r--r-- | src/lib/libcrypto/dsa/dsatest.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/src/lib/libcrypto/dsa/dsatest.c b/src/lib/libcrypto/dsa/dsatest.c index 912317bb44..55a3756aff 100644 --- a/src/lib/libcrypto/dsa/dsatest.c +++ b/src/lib/libcrypto/dsa/dsatest.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> |
@@ -74,7 +68,6 @@ | |||
74 | #include <openssl/rand.h> | 68 | #include <openssl/rand.h> |
75 | #include <openssl/bio.h> | 69 | #include <openssl/bio.h> |
76 | #include <openssl/err.h> | 70 | #include <openssl/err.h> |
77 | #include <openssl/bn.h> | ||
78 | 71 | ||
79 | #ifdef OPENSSL_NO_DSA | 72 | #ifdef OPENSSL_NO_DSA |
80 | int main(int argc, char *argv[]) | 73 | int main(int argc, char *argv[]) |
@@ -91,7 +84,7 @@ int main(int argc, char *argv[]) | |||
91 | #define MS_CALLBACK | 84 | #define MS_CALLBACK |
92 | #endif | 85 | #endif |
93 | 86 | ||
94 | static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *arg); | 87 | static void MS_CALLBACK dsa_cb(int p, int n, void *arg); |
95 | 88 | ||
96 | /* seed, out_p, out_q, out_g are taken from the updated Appendix 5 to | 89 | /* seed, out_p, out_q, out_g are taken from the updated Appendix 5 to |
97 | * FIPS PUB 186 and also appear in Appendix 5 to FIPS PIB 186-1 */ | 90 | * FIPS PUB 186 and also appear in Appendix 5 to FIPS PIB 186-1 */ |
@@ -136,7 +129,6 @@ static BIO *bio_err=NULL; | |||
136 | 129 | ||
137 | int main(int argc, char **argv) | 130 | int main(int argc, char **argv) |
138 | { | 131 | { |
139 | BN_GENCB cb; | ||
140 | DSA *dsa=NULL; | 132 | DSA *dsa=NULL; |
141 | int counter,ret=0,i,j; | 133 | int counter,ret=0,i,j; |
142 | unsigned char buf[256]; | 134 | unsigned char buf[256]; |
@@ -156,10 +148,7 @@ int main(int argc, char **argv) | |||
156 | 148 | ||
157 | BIO_printf(bio_err,"test generation of DSA parameters\n"); | 149 | BIO_printf(bio_err,"test generation of DSA parameters\n"); |
158 | 150 | ||
159 | BN_GENCB_set(&cb, dsa_cb, bio_err); | 151 | dsa=DSA_generate_parameters(512,seed,20,&counter,&h,dsa_cb,bio_err); |
160 | if(((dsa = DSA_new()) == NULL) || !DSA_generate_parameters_ex(dsa, 512, | ||
161 | seed, 20, &counter, &h, &cb)) | ||
162 | goto end; | ||
163 | 152 | ||
164 | BIO_printf(bio_err,"seed\n"); | 153 | BIO_printf(bio_err,"seed\n"); |
165 | for (i=0; i<20; i+=4) | 154 | for (i=0; i<20; i+=4) |
@@ -167,7 +156,7 @@ int main(int argc, char **argv) | |||
167 | BIO_printf(bio_err,"%02X%02X%02X%02X ", | 156 | BIO_printf(bio_err,"%02X%02X%02X%02X ", |
168 | seed[i],seed[i+1],seed[i+2],seed[i+3]); | 157 | seed[i],seed[i+1],seed[i+2],seed[i+3]); |
169 | } | 158 | } |
170 | BIO_printf(bio_err,"\ncounter=%d h=%ld\n",counter,h); | 159 | BIO_printf(bio_err,"\ncounter=%d h=%d\n",counter,h); |
171 | 160 | ||
172 | if (dsa == NULL) goto end; | 161 | if (dsa == NULL) goto end; |
173 | DSA_print(bio_err,dsa,0); | 162 | DSA_print(bio_err,dsa,0); |
@@ -231,14 +220,17 @@ end: | |||
231 | BIO_free(bio_err); | 220 | BIO_free(bio_err); |
232 | bio_err = NULL; | 221 | bio_err = NULL; |
233 | } | 222 | } |
234 | #ifdef OPENSSL_SYS_NETWARE | ||
235 | if (!ret) printf("ERROR\n"); | ||
236 | #endif | ||
237 | EXIT(!ret); | 223 | EXIT(!ret); |
238 | return(0); | 224 | return(0); |
239 | } | 225 | } |
240 | 226 | ||
241 | static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *arg) | 227 | static int cb_exit(int ec) |
228 | { | ||
229 | EXIT(ec); | ||
230 | return(0); /* To keep some compilers quiet */ | ||
231 | } | ||
232 | |||
233 | static void MS_CALLBACK dsa_cb(int p, int n, void *arg) | ||
242 | { | 234 | { |
243 | char c='*'; | 235 | char c='*'; |
244 | static int ok=0,num=0; | 236 | static int ok=0,num=0; |
@@ -247,14 +239,13 @@ static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *arg) | |||
247 | if (p == 1) c='+'; | 239 | if (p == 1) c='+'; |
248 | if (p == 2) { c='*'; ok++; } | 240 | if (p == 2) { c='*'; ok++; } |
249 | if (p == 3) c='\n'; | 241 | if (p == 3) c='\n'; |
250 | BIO_write(arg->arg,&c,1); | 242 | BIO_write(arg,&c,1); |
251 | (void)BIO_flush(arg->arg); | 243 | (void)BIO_flush(arg); |
252 | 244 | ||
253 | if (!ok && (p == 0) && (num > 1)) | 245 | if (!ok && (p == 0) && (num > 1)) |
254 | { | 246 | { |
255 | BIO_printf((BIO *)arg,"error in dsatest\n"); | 247 | BIO_printf((BIO *)arg,"error in dsatest\n"); |
256 | return 0; | 248 | cb_exit(1); |
257 | } | 249 | } |
258 | return 1; | ||
259 | } | 250 | } |
260 | #endif | 251 | #endif |