aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjayaram <jayaramx.matta@intel.com>2019-09-23 16:14:56 +0530
committerDmitry Belyavskiy <beldmit@gmail.com>2019-09-24 14:24:32 +0300
commitaecf529b0546adc9cfc199f23c64fbb32ff5ed56 (patch)
treec9502f5c2673c46bc758a2c21a399b68923c3b5e
parent4baee2d72e0c82bfd6de085df23a1bdc6af887ba (diff)
downloadopenssl-aecf529b0546adc9cfc199f23c64fbb32ff5ed56.zip
openssl-aecf529b0546adc9cfc199f23c64fbb32ff5ed56.tar.gz
openssl-aecf529b0546adc9cfc199f23c64fbb32ff5ed56.tar.bz2
fix for dsa key size feature request issue: pkey -text or -text_pub should show dsa key size
Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/9983)
-rw-r--r--crypto/dsa/dsa_ameth.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/crypto/dsa/dsa_ameth.c b/crypto/dsa/dsa_ameth.c
index 4e0ed01..f3aab34 100644
--- a/crypto/dsa/dsa_ameth.c
+++ b/crypto/dsa/dsa_ameth.c
@@ -336,6 +336,10 @@ static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype)
int ret = 0;
const char *ktype = NULL;
const BIGNUM *priv_key, *pub_key;
+ int mod_len = 0;
+
+ if (x->p != NULL)
+ mod_len = BN_num_bits(x->p);
if (ptype == 2)
priv_key = x->priv_key;
@@ -360,6 +364,9 @@ static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype)
if (BIO_printf(bp, "%s: (%d bit)\n", ktype, BN_num_bits(x->p))
<= 0)
goto err;
+ } else {
+ if (BIO_printf(bp, "Public-Key: (%d bit)\n", mod_len) <= 0)
+ goto err;
}
if (!ASN1_bn_print(bp, "priv:", priv_key, NULL, off))