diff options
author | Tomas Mraz <tomas@openssl.org> | 2022-06-10 09:46:45 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-07-19 12:11:02 +0200 |
commit | c9bdbc12ac7343992ba249e11d2bda3338469a97 (patch) | |
tree | a9071c7a96774a579903e4505995f79cc08284a2 /providers/implementations | |
parent | 8ed6ddcaa559b7b04202c15ea3a95ee0b05caeba (diff) |
dh_to_text: Print the dh->length if set
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/18793)
Diffstat (limited to 'providers/implementations')
-rw-r--r-- | providers/implementations/encode_decode/encode_key2text.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/providers/implementations/encode_decode/encode_key2text.c b/providers/implementations/encode_decode/encode_key2text.c index 80d6f7b35f..7d983f5e51 100644 --- a/providers/implementations/encode_decode/encode_key2text.c +++ b/providers/implementations/encode_decode/encode_key2text.c @@ -220,6 +220,7 @@ static int dh_to_text(BIO *out, const void *key, int selection) const BIGNUM *priv_key = NULL, *pub_key = NULL; const FFC_PARAMS *params = NULL; const BIGNUM *p = NULL; + long length; if (out == NULL || dh == NULL) { ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_NULL_PARAMETER); @@ -272,6 +273,11 @@ static int dh_to_text(BIO *out, const void *key, int selection) if (params != NULL && !ffc_params_to_text(out, params)) return 0; + length = DH_get_length(dh); + if (length > 0 + && BIO_printf(out, "recommended-private-length: %ld bits\n", + length) <= 0) + return 0; return 1; } |