Make DH_check set some error bits in recently added error
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sun, 23 Jul 2023 12:27:54 +0000 (14:27 +0200)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Wed, 26 Jul 2023 11:20:19 +0000 (13:20 +0200)
commite648db50d9a63f71cab5cb78424c2932d019a744
treebe4986aa9dd66e534f9e14ed256289974413102d
parent281d11b2e40ee5af35edd3bbd335d0b45f02de67
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/21524)

(cherry picked from commit 81d10e61a4b7d5394d08a718bf7d6bae20e818fc)
crypto/dh/dh_check.c