summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/apps/dsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/apps/dsa.c')
-rw-r--r--src/lib/libssl/src/apps/dsa.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/src/lib/libssl/src/apps/dsa.c b/src/lib/libssl/src/apps/dsa.c
index 9e103037dd..7518a2fe96 100644
--- a/src/lib/libssl/src/apps/dsa.c
+++ b/src/lib/libssl/src/apps/dsa.c
@@ -240,37 +240,27 @@ bad:
240 goto end; 240 goto end;
241 } 241 }
242 242
243 in=BIO_new(BIO_s_file());
244 out=BIO_new(BIO_s_file()); 243 out=BIO_new(BIO_s_file());
245 if ((in == NULL) || (out == NULL)) 244 if (out == NULL)
246 { 245 {
247 ERR_print_errors(bio_err); 246 ERR_print_errors(bio_err);
248 goto end; 247 goto end;
249 } 248 }
250 249
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"); 250 BIO_printf(bio_err,"read DSA key\n");
263 if (informat == FORMAT_ASN1) { 251 {
264 if(pubin) dsa=d2i_DSA_PUBKEY_bio(in,NULL); 252 EVP_PKEY *pkey;
265 else dsa=d2i_DSAPrivateKey_bio(in,NULL); 253 if (pubin)
266 } else if (informat == FORMAT_PEM) { 254 pkey = load_pubkey(bio_err, infile, informat, 1,
267 if(pubin) dsa=PEM_read_bio_DSA_PUBKEY(in,NULL, NULL, NULL); 255 passin, e, "Public Key");
268 else dsa=PEM_read_bio_DSAPrivateKey(in,NULL,NULL,passin); 256 else
269 } else 257 pkey = load_key(bio_err, infile, informat, 1,
270 { 258 passin, e, "Private Key");
271 BIO_printf(bio_err,"bad input format specified for key\n"); 259
272 goto end; 260 if (pkey != NULL)
273 } 261 dsa = pkey == NULL ? NULL : EVP_PKEY_get1_DSA(pkey);
262 EVP_PKEY_free(pkey);
263 }
274 if (dsa == NULL) 264 if (dsa == NULL)
275 { 265 {
276 BIO_printf(bio_err,"unable to load Key\n"); 266 BIO_printf(bio_err,"unable to load Key\n");