aboutsummaryrefslogtreecommitdiff
path: root/apps/dsa.c
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-01-30 07:23:39 +1000
committerPauli <paul.dale@oracle.com>2020-02-12 08:52:41 +1000
commitf41ac0eeab9d2889d44e3acf6ff1e8274d03d73e (patch)
treeba3620a537ece73983886b7449eab118e5869223 /apps/dsa.c
parent7f6deaf68e42e979a2084989db2c32193825d1b3 (diff)
downloadopenssl-f41ac0eeab9d2889d44e3acf6ff1e8274d03d73e.zip
openssl-f41ac0eeab9d2889d44e3acf6ff1e8274d03d73e.tar.gz
openssl-f41ac0eeab9d2889d44e3acf6ff1e8274d03d73e.tar.bz2
Deprecate the low level DSA functions.
Use of the low level DSA functions has been informally discouraged for a long time. We now formally deprecate them. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10977)
Diffstat (limited to 'apps/dsa.c')
-rw-r--r--apps/dsa.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/apps/dsa.c b/apps/dsa.c
index f0c9fc1..8ba9305 100644
--- a/apps/dsa.c
+++ b/apps/dsa.c
@@ -81,6 +81,7 @@ int dsa_main(int argc, char **argv)
int pvk_encr = 2;
# endif
int private = 0;
+ EVP_PKEY *pkey = NULL;
prog = opt_init(argc, argv, dsa_options);
while ((o = opt_next()) != OPT_EOF) {
@@ -160,19 +161,14 @@ int dsa_main(int argc, char **argv)
}
BIO_printf(bio_err, "read DSA key\n");
- {
- EVP_PKEY *pkey;
+ if (pubin)
+ pkey = load_pubkey(infile, informat, 1, passin, e, "Public Key");
+ else
+ pkey = load_key(infile, informat, 1, passin, e, "Private Key");
- if (pubin)
- pkey = load_pubkey(infile, informat, 1, passin, e, "Public Key");
- else
- pkey = load_key(infile, informat, 1, passin, e, "Private Key");
+ if (pkey != NULL)
+ dsa = EVP_PKEY_get1_DSA(pkey);
- if (pkey != NULL) {
- dsa = EVP_PKEY_get1_DSA(pkey);
- EVP_PKEY_free(pkey);
- }
- }
if (dsa == NULL) {
BIO_printf(bio_err, "unable to load Key\n");
ERR_print_errors(bio_err);
@@ -185,7 +181,7 @@ int dsa_main(int argc, char **argv)
if (text) {
assert(pubin || private);
- if (!DSA_print(out, dsa, 0)) {
+ if (!EVP_PKEY_print_private(out, pkey, 0, NULL)) {
perror(outfile);
ERR_print_errors(bio_err);
goto end;
@@ -261,6 +257,7 @@ int dsa_main(int argc, char **argv)
}
ret = 0;
end:
+ EVP_PKEY_free(pkey);
BIO_free_all(out);
DSA_free(dsa);
release_engine(e);