diff options
Diffstat (limited to 'src/lib/libssl/src/apps/dsa.c')
-rw-r--r-- | src/lib/libssl/src/apps/dsa.c | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/src/lib/libssl/src/apps/dsa.c b/src/lib/libssl/src/apps/dsa.c index 9e103037dd..cbc1fe3f81 100644 --- a/src/lib/libssl/src/apps/dsa.c +++ b/src/lib/libssl/src/apps/dsa.c | |||
@@ -96,9 +96,7 @@ int MAIN(int, char **); | |||
96 | 96 | ||
97 | int MAIN(int argc, char **argv) | 97 | int MAIN(int argc, char **argv) |
98 | { | 98 | { |
99 | #ifndef OPENSSL_NO_ENGINE | ||
100 | ENGINE *e = NULL; | 99 | ENGINE *e = NULL; |
101 | #endif | ||
102 | int ret=1; | 100 | int ret=1; |
103 | DSA *dsa=NULL; | 101 | DSA *dsa=NULL; |
104 | int i,badops=0; | 102 | int i,badops=0; |
@@ -240,37 +238,27 @@ bad: | |||
240 | goto end; | 238 | goto end; |
241 | } | 239 | } |
242 | 240 | ||
243 | in=BIO_new(BIO_s_file()); | ||
244 | out=BIO_new(BIO_s_file()); | 241 | out=BIO_new(BIO_s_file()); |
245 | if ((in == NULL) || (out == NULL)) | 242 | if (out == NULL) |
246 | { | 243 | { |
247 | ERR_print_errors(bio_err); | 244 | ERR_print_errors(bio_err); |
248 | goto end; | 245 | goto end; |
249 | } | 246 | } |
250 | 247 | ||
251 | if (infile == NULL) | ||
252 | BIO_set_fp(in,stdin,BIO_NOCLOSE); | ||
253 | else | ||
254 | { | ||
255 | if (BIO_read_filename(in,infile) <= 0) | ||
256 | { | ||
257 | perror(infile); | ||
258 | goto end; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | BIO_printf(bio_err,"read DSA key\n"); | 248 | BIO_printf(bio_err,"read DSA key\n"); |
263 | if (informat == FORMAT_ASN1) { | 249 | { |
264 | if(pubin) dsa=d2i_DSA_PUBKEY_bio(in,NULL); | 250 | EVP_PKEY *pkey; |
265 | else dsa=d2i_DSAPrivateKey_bio(in,NULL); | 251 | if (pubin) |
266 | } else if (informat == FORMAT_PEM) { | 252 | pkey = load_pubkey(bio_err, infile, informat, 1, |
267 | if(pubin) dsa=PEM_read_bio_DSA_PUBKEY(in,NULL, NULL, NULL); | 253 | passin, e, "Public Key"); |
268 | else dsa=PEM_read_bio_DSAPrivateKey(in,NULL,NULL,passin); | 254 | else |
269 | } else | 255 | pkey = load_key(bio_err, infile, informat, 1, |
270 | { | 256 | passin, e, "Private Key"); |
271 | BIO_printf(bio_err,"bad input format specified for key\n"); | 257 | |
272 | goto end; | 258 | if (pkey != NULL) |
273 | } | 259 | dsa = pkey == NULL ? NULL : EVP_PKEY_get1_DSA(pkey); |
260 | EVP_PKEY_free(pkey); | ||
261 | } | ||
274 | if (dsa == NULL) | 262 | if (dsa == NULL) |
275 | { | 263 | { |
276 | BIO_printf(bio_err,"unable to load Key\n"); | 264 | BIO_printf(bio_err,"unable to load Key\n"); |