summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/rsa/rsa_ameth.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c
index 255ccb4d13..d373d7c132 100644
--- a/src/lib/libcrypto/rsa/rsa_ameth.c
+++ b/src/lib/libcrypto/rsa/rsa_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_ameth.c,v 1.23 2019/11/02 14:35:48 jsing Exp $ */ 1/* $OpenBSD: rsa_ameth.c,v 1.24 2019/11/20 10:46:17 inoguchi Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -449,10 +449,17 @@ pkey_rsa_print(BIO *bp, const EVP_PKEY *pkey, int off, int priv)
449 if (BIO_printf(bp, "%s ", pkey_is_pss(pkey) ? "RSA-PSS" : "RSA") <= 0) 449 if (BIO_printf(bp, "%s ", pkey_is_pss(pkey) ? "RSA-PSS" : "RSA") <= 0)
450 goto err; 450 goto err;
451 451
452 if (BIO_printf(bp, "Public-Key: (%d bit)\n", mod_len) <= 0) 452 if (priv && x->d != NULL) {
453 goto err; 453 if (BIO_printf(bp, "Private-Key: (%d bit)\n", mod_len) <= 0)
454 str = "Modulus:"; 454 goto err;
455 s = "Exponent:"; 455 str = "modulus:";
456 s = "publicExponent:";
457 } else {
458 if (BIO_printf(bp, "Public-Key: (%d bit)\n", mod_len) <= 0)
459 goto err;
460 str = "Modulus:";
461 s = "Exponent:";
462 }
456 if (!ASN1_bn_print(bp, str, x->n, m, off)) 463 if (!ASN1_bn_print(bp, str, x->n, m, off))
457 goto err; 464 goto err;
458 if (!ASN1_bn_print(bp, s, x->e, m, off)) 465 if (!ASN1_bn_print(bp, s, x->e, m, off))