summaryrefslogtreecommitdiffstats
path: root/crypto/dh/dh_lib.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-10-15 07:14:16 +0200
committerRichard Levitte <levitte@openssl.org>2020-10-27 15:13:54 +0100
commit28e1d588f14404d480cc2bd38827ecd587625643 (patch)
treed694b95a240cf667d496aea5944137b2a770aeed /crypto/dh/dh_lib.c
parent09803e9ce3a8a555e7014ebd11b4c80f9d300cf0 (diff)
DH: stop setting the private key length arbitrarily
The private key length is supposed to be a user settable parameter. We do check if it's set or not, and if not, we do apply defaults. Fixes #12071 Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13140)
Diffstat (limited to 'crypto/dh/dh_lib.c')
-rw-r--r--crypto/dh/dh_lib.c13
1 files changed, 0 insertions, 13 deletions
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c
index 6280472ade..207e7b06c6 100644
--- a/crypto/dh/dh_lib.c
+++ b/crypto/dh/dh_lib.c
@@ -219,18 +219,6 @@ int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
ossl_ffc_params_set0_pqg(&dh->params, p, q, g);
dh_cache_named_group(dh);
- if (q != NULL)
- dh->length = BN_num_bits(q);
- /*
- * Check if this is a named group. If it finds a named group then the
- * 'q' and 'length' value are either already set or are set by the
- * call.
- */
- if (DH_get_nid(dh) == NID_undef) {
- /* If its not a named group then set the 'length' if q is not NULL */
- if (q != NULL)
- dh->length = BN_num_bits(q);
- }
dh->dirty_cnt++;
return 1;
}
@@ -264,7 +252,6 @@ int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key)
if (priv_key != NULL) {
BN_clear_free(dh->priv_key);
dh->priv_key = priv_key;
- dh->length = BN_num_bits(priv_key);
}
dh->dirty_cnt++;