]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix error reporting in EVP_PKEY_{sign,verify,verify_recover}
authorRichard Levitte <levitte@openssl.org>
Mon, 29 Jan 2024 07:51:52 +0000 (08:51 +0100)
committerMatt Caswell <matt@openssl.org>
Wed, 31 Jan 2024 10:39:46 +0000 (10:39 +0000)
commit8ae92de132bc97d4e7a7a79bf7eb893e0d152181
tree97d3af00942c88e2db11a94af134fe0050228c38
parent48c2dc449211812922f6b0521494b0a436a43117
Fix error reporting in EVP_PKEY_{sign,verify,verify_recover}

For some reason, those functions (and the _init functions too) would
raise EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE when the passed
ctx is NULL, and then not check if the provider supplied the function
that would support these libcrypto functions.

This corrects the situation, and has all those libcrypto functions
raise ERR_R_PASS_NULL_PARAMETER if ctx is NULL, and then check for the
corresponding provider supplied, and only when that one is missing,
raise EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE.

Because 0 doesn't mean error for EVP_PKEY_verify(), -1 is returned when
ERR_R_PASSED_NULL_PARAMETER is raised.  This is done consistently for all
affected functions.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23411)

(cherry picked from commit 5a25177d1b07ef6e754fec1747b57ee90ab1e028)
crypto/evp/signature.c