summaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2021-06-10 18:14:03 +1000
committerShane Lontis <shane.lontis@oracle.com>2021-06-14 09:21:12 +1000
commit1c49be8673713d2ceb03a63be03531d9b28a46bd (patch)
tree03de6cf281166362041a4966ee5b6ebfdbb48b08 /crypto/dh
parent243af566e41e33e4ce2d3afa3e6a7383e20da737 (diff)
Fix DH/DHX named groups to not overwrite the private key length.
The only reason(s) the DH private key length should be set are: (1) The user sets it during key generation via EVP_PKEY_CTX_set_params using OSSL_PKEY_PARAM_DH_PRIV_LEN. (2) When loading a PKCS3 (DH) key the optional value 'privateValueLength' is set. Now that the named groups contain a value for 'q' there is no reason to automatically overwrite the private key length. Issue detected by @davidmakepeace Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15695)
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_group_params.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/crypto/dh/dh_group_params.c b/crypto/dh/dh_group_params.c
index ff6d7cdd66..c71f4053da 100644
--- a/crypto/dh/dh_group_params.c
+++ b/crypto/dh/dh_group_params.c
@@ -34,7 +34,6 @@ static DH *dh_param_init(OSSL_LIB_CTX *libctx, const DH_NAMED_GROUP *group)
ossl_ffc_named_group_set_pqg(&dh->params, group);
dh->params.nid = ossl_ffc_named_group_get_uid(group);
- dh->length = BN_num_bits(dh->params.q);
dh->dirty_cnt++;
return dh;
}
@@ -76,7 +75,6 @@ void ossl_dh_cache_named_group(DH *dh)
dh->params.q = (BIGNUM *)ossl_ffc_named_group_get_q(group);
/* cache the nid */
dh->params.nid = ossl_ffc_named_group_get_uid(group);
- dh->length = BN_num_bits(dh->params.q);
dh->dirty_cnt++;
}
}