diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/usr.bin/openssl/x509.c | 22 |
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"); |
