summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2021-12-12 20:28:02 +0000
committertb <>2021-12-12 20:28:02 +0000
commit6a16a9c80a0d29a10f70a0ba34a26914a1171284 (patch)
tree900254d2e4986bec6cca06ce38c20f861684bdf1
parent25b5b1d125b9cbfb86966328303f1c859a69c17b (diff)
downloadopenbsd-6a16a9c80a0d29a10f70a0ba34a26914a1171284.tar.gz
openbsd-6a16a9c80a0d29a10f70a0ba34a26914a1171284.tar.bz2
openbsd-6a16a9c80a0d29a10f70a0ba34a26914a1171284.zip
Make x509.c compile with opaque EVP_PKEY.
ok inoguchi
-rw-r--r--src/usr.bin/openssl/x509.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/usr.bin/openssl/x509.c b/src/usr.bin/openssl/x509.c
index 978f097efa..38838729af 100644
--- a/src/usr.bin/openssl/x509.c
+++ b/src/usr.bin/openssl/x509.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509.c,v 1.26 2021/11/26 16:23:27 tb Exp $ */ 1/* $OpenBSD: x509.c,v 1.27 2021/12/12 20:28:02 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1053,12 +1053,20 @@ x509_main(int argc, char **argv)
1053 goto end; 1053 goto end;
1054 } 1054 }
1055 BIO_printf(STDout, "Modulus="); 1055 BIO_printf(STDout, "Modulus=");
1056 if (pkey->type == EVP_PKEY_RSA) 1056 if (EVP_PKEY_id(pkey) == EVP_PKEY_RSA) {
1057 BN_print(STDout, pkey->pkey.rsa->n); 1057 RSA *rsa = EVP_PKEY_get0_RSA(pkey);
1058 else if (pkey->type == EVP_PKEY_DSA) 1058 const BIGNUM *n = NULL;
1059 BN_print(STDout, 1059
1060 pkey->pkey.dsa->pub_key); 1060 RSA_get0_key(rsa, &n, NULL, NULL);
1061 else 1061 BN_print(STDout, n);
1062 } else if (EVP_PKEY_id(pkey) == EVP_PKEY_DSA) {
1063 DSA *dsa = EVP_PKEY_get0_DSA(pkey);
1064 const BIGNUM *pub_key = NULL;
1065
1066 DSA_get0_key(dsa, &pub_key, NULL);
1067
1068 BN_print(STDout, pub_key);
1069 } else
1062 BIO_printf(STDout, 1070 BIO_printf(STDout,
1063 "Wrong Algorithm type"); 1071 "Wrong Algorithm type");
1064 BIO_printf(STDout, "\n"); 1072 BIO_printf(STDout, "\n");