diff options
-rw-r--r-- | crypto/dh/dh_check.c | 2 | ||||
-rw-r--r-- | crypto/dh/dh_lib.c | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/crypto/dh/dh_check.c b/crypto/dh/dh_check.c index 61be68bf64..e75d20d862 100644 --- a/crypto/dh/dh_check.c +++ b/crypto/dh/dh_check.c @@ -262,7 +262,7 @@ int ossl_dh_check_priv_key(const DH *dh, const BIGNUM *priv_key, int *ret) upper = dh->params.q; /* Is it from an approved Safe prime group ?*/ - if (DH_get_nid((DH *)dh) != NID_undef) { + if (DH_get_nid((DH *)dh) != NID_undef && dh->length != 0) { if (!BN_lshift(two_powN, BN_value_one(), dh->length)) goto err; if (BN_cmp(two_powN, dh->params.q) < 0) diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index f5e0f893c1..7154f8c2ab 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c @@ -202,6 +202,7 @@ int DH_size(const DH *dh) int DH_security_bits(const DH *dh) { int N; + if (dh->params.q != NULL) N = BN_num_bits(dh->params.q); else if (dh->length) |