summaryrefslogtreecommitdiffstats
path: root/apps/x509.c
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-10-20 13:32:26 +1000
committerRichard Levitte <levitte@openssl.org>2020-12-17 21:09:54 +0100
commit47422549da431cf9546a148d916d162e196fcd44 (patch)
treea09cdee887b43d97878a2c1382b6df8b48fddc5e /apps/x509.c
parent575b36ecefca4eff181210ff1eeb3a3dcfbf5456 (diff)
dsa: apps deprecation changes
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13638)
Diffstat (limited to 'apps/x509.c')
-rw-r--r--apps/x509.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/apps/x509.c b/apps/x509.c
index a82682bc11..5de25c1e2c 100644
--- a/apps/x509.c
+++ b/apps/x509.c
@@ -755,7 +755,6 @@ int x509_main(int argc, char **argv)
goto end;
}
BIO_printf(out, "Modulus=");
-#ifndef OPENSSL_NO_RSA
if (EVP_PKEY_is_a(pkey, "RSA")) {
BIGNUM *n;
@@ -763,16 +762,14 @@ int x509_main(int argc, char **argv)
EVP_PKEY_get_bn_param(pkey, "n", &n);
BN_print(out, n);
BN_free(n);
- } else
-#endif
-#ifndef OPENSSL_NO_DSA
- if (EVP_PKEY_id(pkey) == EVP_PKEY_DSA) {
- const BIGNUM *dsapub = NULL;
- DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &dsapub, NULL);
+ } else if (EVP_PKEY_is_a(pkey, "DSA")) {
+ BIGNUM *dsapub;
+
+ /* Every DSA key has an 'pub' */
+ EVP_PKEY_get_bn_param(pkey, "pub", &dsapub);
BN_print(out, dsapub);
- } else
-#endif
- {
+ BN_free(dsapub);
+ } else {
BIO_printf(out, "Wrong Algorithm type");
}
BIO_printf(out, "\n");