OLD | NEW |
1 /* crypto/dsa/dsatest.c */ | 1 /* crypto/dsa/dsatest.c */ |
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 goto end; | 162 goto end; |
163 | 163 |
164 BIO_printf(bio_err,"seed\n"); | 164 BIO_printf(bio_err,"seed\n"); |
165 for (i=0; i<20; i+=4) | 165 for (i=0; i<20; i+=4) |
166 { | 166 { |
167 BIO_printf(bio_err,"%02X%02X%02X%02X ", | 167 BIO_printf(bio_err,"%02X%02X%02X%02X ", |
168 seed[i],seed[i+1],seed[i+2],seed[i+3]); | 168 seed[i],seed[i+1],seed[i+2],seed[i+3]); |
169 } | 169 } |
170 BIO_printf(bio_err,"\ncounter=%d h=%ld\n",counter,h); | 170 BIO_printf(bio_err,"\ncounter=%d h=%ld\n",counter,h); |
171 | 171 |
172 if (dsa == NULL) goto end; | |
173 DSA_print(bio_err,dsa,0); | 172 DSA_print(bio_err,dsa,0); |
174 if (counter != 105) | 173 if (counter != 105) |
175 { | 174 { |
176 BIO_printf(bio_err,"counter should be 105\n"); | 175 BIO_printf(bio_err,"counter should be 105\n"); |
177 goto end; | 176 goto end; |
178 } | 177 } |
179 if (h != 2) | 178 if (h != 2) |
180 { | 179 { |
181 BIO_printf(bio_err,"h should be 2\n"); | 180 BIO_printf(bio_err,"h should be 2\n"); |
182 goto end; | 181 goto end; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 DSA_generate_key(dsa); | 215 DSA_generate_key(dsa); |
217 DSA_sign(0, str1, 20, sig, &siglen, dsa); | 216 DSA_sign(0, str1, 20, sig, &siglen, dsa); |
218 if (DSA_verify(0, str1, 20, sig, siglen, dsa) == 1) | 217 if (DSA_verify(0, str1, 20, sig, siglen, dsa) == 1) |
219 ret=1; | 218 ret=1; |
220 | 219 |
221 end: | 220 end: |
222 if (!ret) | 221 if (!ret) |
223 ERR_print_errors(bio_err); | 222 ERR_print_errors(bio_err); |
224 if (dsa != NULL) DSA_free(dsa); | 223 if (dsa != NULL) DSA_free(dsa); |
225 CRYPTO_cleanup_all_ex_data(); | 224 CRYPTO_cleanup_all_ex_data(); |
226 » ERR_remove_state(0); | 225 » ERR_remove_thread_state(NULL); |
227 ERR_free_strings(); | 226 ERR_free_strings(); |
228 CRYPTO_mem_leaks(bio_err); | 227 CRYPTO_mem_leaks(bio_err); |
229 if (bio_err != NULL) | 228 if (bio_err != NULL) |
230 { | 229 { |
231 BIO_free(bio_err); | 230 BIO_free(bio_err); |
232 bio_err = NULL; | 231 bio_err = NULL; |
233 } | 232 } |
234 #ifdef OPENSSL_SYS_NETWARE | 233 #ifdef OPENSSL_SYS_NETWARE |
235 if (!ret) printf("ERROR\n"); | 234 if (!ret) printf("ERROR\n"); |
236 #endif | 235 #endif |
(...skipping 14 matching lines...) Expand all Loading... |
251 (void)BIO_flush(arg->arg); | 250 (void)BIO_flush(arg->arg); |
252 | 251 |
253 if (!ok && (p == 0) && (num > 1)) | 252 if (!ok && (p == 0) && (num > 1)) |
254 { | 253 { |
255 BIO_printf((BIO *)arg,"error in dsatest\n"); | 254 BIO_printf((BIO *)arg,"error in dsatest\n"); |
256 return 0; | 255 return 0; |
257 } | 256 } |
258 return 1; | 257 return 1; |
259 } | 258 } |
260 #endif | 259 #endif |
OLD | NEW |