Skip to content

Commit

Permalink
fix for dsa key size feature request issue: pkey -text or -text_pub s…
Browse files Browse the repository at this point in the history
…hould show dsa key size

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from #9983)
  • Loading branch information
jayaram-intel authored and beldmit committed Sep 24, 2019
1 parent 4baee2d commit aecf529
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crypto/dsa/dsa_ameth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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))
Expand Down

0 comments on commit aecf529

Please sign in to comment.