summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src/apps/dsa.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2009-01-05 21:36:37 +0000
committerdjm <djm@openbsd.org>2009-01-05 21:36:37 +0000
commit8214bb003f591cff80401f6649ee13ec96a00866 (patch)
treecf9ad15d0f4ad517b261e29d2edfe1bf6cb57361 /lib/libssl/src/apps/dsa.c
parent- clear some confusion, the chip supports vlan tag insertion/stripping, (diff)
downloadwireguard-openbsd-8214bb003f591cff80401f6649ee13ec96a00866.tar.xz
wireguard-openbsd-8214bb003f591cff80401f6649ee13ec96a00866.zip
update to openssl-0.9.8i; tested by several, especially krw@
Diffstat (limited to 'lib/libssl/src/apps/dsa.c')
-rw-r--r--lib/libssl/src/apps/dsa.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/lib/libssl/src/apps/dsa.c b/lib/libssl/src/apps/dsa.c
index 9e103037dd7..7518a2fe964 100644
--- a/lib/libssl/src/apps/dsa.c
+++ b/lib/libssl/src/apps/dsa.c
@@ -240,37 +240,27 @@ bad:
goto end;
}
- in=BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file());
- if ((in == NULL) || (out == NULL))
+ if (out == NULL)
{
ERR_print_errors(bio_err);
goto end;
}
- if (infile == NULL)
- BIO_set_fp(in,stdin,BIO_NOCLOSE);
- else
- {
- if (BIO_read_filename(in,infile) <= 0)
- {
- perror(infile);
- goto end;
- }
- }
-
BIO_printf(bio_err,"read DSA key\n");
- if (informat == FORMAT_ASN1) {
- if(pubin) dsa=d2i_DSA_PUBKEY_bio(in,NULL);
- else dsa=d2i_DSAPrivateKey_bio(in,NULL);
- } else if (informat == FORMAT_PEM) {
- if(pubin) dsa=PEM_read_bio_DSA_PUBKEY(in,NULL, NULL, NULL);
- else dsa=PEM_read_bio_DSAPrivateKey(in,NULL,NULL,passin);
- } else
- {
- BIO_printf(bio_err,"bad input format specified for key\n");
- goto end;
- }
+ {
+ EVP_PKEY *pkey;
+ if (pubin)
+ pkey = load_pubkey(bio_err, infile, informat, 1,
+ passin, e, "Public Key");
+ else
+ pkey = load_key(bio_err, infile, informat, 1,
+ passin, e, "Private Key");
+
+ if (pkey != NULL)
+ dsa = pkey == NULL ? NULL : EVP_PKEY_get1_DSA(pkey);
+ EVP_PKEY_free(pkey);
+ }
if (dsa == NULL)
{
BIO_printf(bio_err,"unable to load Key\n");