diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2023-07-23 14:27:54 +0200 |
---|---|---|
committer | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2023-07-26 13:23:15 +0200 |
commit | eec805ee71356c06f9a86192fa06507c3bb92b09 (patch) | |
tree | be8af93a9091ff10e6b085e421d1166d504a9398 | |
parent | 97b4f2b515ffd3ce91c6d5cd6d04614a4a15d7df (diff) |
Make DH_check set some error bits in recently added error
The pre-existing error cases where DH_check returned zero
are not related to the dh params in any way, but are only
triggered by out-of-memory errors, therefore having *ret
set to zero feels right, but since the new error case is
triggered by too large p values that is something different.
On the other hand some callers of this function might not
be prepared to handle the return value correctly but only
rely on *ret. Therefore we set some error bits in *ret as
additional safety measure.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21533)
-rw-r--r-- | crypto/dh/dh_check.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/crypto/dh/dh_check.c b/crypto/dh/dh_check.c index e5f9dd5030..2001d2e7cb 100644 --- a/crypto/dh/dh_check.c +++ b/crypto/dh/dh_check.c @@ -104,6 +104,7 @@ int DH_check(const DH *dh, int *ret) /* Don't do any checks at all with an excessively large modulus */ if (BN_num_bits(dh->p) > OPENSSL_DH_CHECK_MAX_MODULUS_BITS) { DHerr(DH_F_DH_CHECK, DH_R_MODULUS_TOO_LARGE); + *ret = DH_CHECK_P_NOT_PRIME; return 0; } |