openssl/crypto/evp
Ingo Franzki b9ff440dd6 Only report generic error if provider did not put an error on the error queue
Commit 72351b0d18 added code to unconditionally
put a generic error onto the error stack, if key generation, encryption,
decryption, sign, or verify fails to ensure that there is an error entry
on the error queue, even if the provider did not itself put a specific error
onto the queue.

However, this can hide error details if an application just looks at the very
last error entry and checks for specific errors. Now, the generic error is
always the last entry, and the application won't find the expected error
entry, although it would be there as second last entry. This can lead to
different application behavior in error situations than before this change.

To fix this, only add the generic error entry if the provider did not itself
add an error entry onto the queue. That way, there always is an error on the
error queue in case of a failure, but no behavior change in case the provider
emitted the error entry itself.

Closes: https://github.com/openssl/openssl/issues/27992

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28073)
2025-07-30 18:27:08 +02:00
..
asymcipher.c Only report generic error if provider did not put an error on the error queue 2025-07-30 18:27:08 +02:00
bio_b64.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
bio_enc.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
bio_md.c evp: remove TODOs 2021-06-02 16:30:15 +10:00
bio_ok.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
build.info Deprecate ASN1_METH internal usage 2025-07-17 11:25:18 -04:00
c_allc.c Update copyright year 2022-05-03 13:34:51 +01:00
c_alld.c
cmeth_lib.c Copyright year updates 2023-09-07 09:59:15 +01:00
ctrl_params_translate.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
dh_ctrl.c todo: remove TODO(3.0) from the sources. 2021-05-20 09:00:22 +01:00
dh_support.c Copyright year updates 2024-09-05 09:35:49 +02:00
digest.c crypto/evp/digest.c: optimize ossl_(un)likely 2025-07-16 13:07:15 -04:00
dsa_ctrl.c todo: remove TODO(3.0) from the sources. 2021-05-20 09:00:22 +01:00
e_aes.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
e_aes_cbc_hmac_sha1.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
e_aes_cbc_hmac_sha256.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
e_aria.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
e_bf.c Update copyright year 2021-06-17 13:24:59 +01:00
e_camellia.c fix some code with obvious wrong coding style 2021-10-28 13:10:46 +10:00
e_cast.c Rename all getters to use get/get0 in name 2021-06-01 12:40:00 +02:00
e_chacha20_poly1305.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
e_des.c Fix Coverity 1201740 & 1201712: uninitialised values 2022-05-08 17:50:04 +10:00
e_des3.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
e_idea.c fix some code with obvious wrong coding style 2021-10-28 13:10:46 +10:00
e_null.c Update copyright year 2021-04-22 14:38:44 +01:00
e_old.c
e_rc2.c Rename all getters to use get/get0 in name 2021-06-01 12:40:00 +02:00
e_rc4.c Rename all getters to use get/get0 in name 2021-06-01 12:40:00 +02:00
e_rc4_hmac_md5.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
e_rc5.c Address coverity 1493382 argument cannot be negative 2021-11-08 08:55:32 +10:00
e_seed.c fix some code with obvious wrong coding style 2021-10-28 13:10:46 +10:00
e_sm4.c Update copyright year 2022-05-03 13:34:51 +01:00
e_xcbc_d.c Rename all getters to use get/get0 in name 2021-06-01 12:40:00 +02:00
ec_ctrl.c Copyright year updates 2023-09-07 09:59:15 +01:00
ec_support.c Update copyright year 2022-05-03 13:34:51 +01:00
encode.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
evp_cnf.c Don't try and load the config file while already loading the config file 2021-07-28 10:35:06 +10:00
evp_enc.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
evp_err.c crypto/evp: compensate for providers not adding error queue entries for keymgmt, sigver, and asymcipher 2025-05-20 21:19:34 +02:00
evp_fetch.c Copyright year updates 2025-03-12 13:35:59 +00:00
evp_key.c Copyright year updates 2024-04-09 13:43:26 +02:00
evp_lib.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
evp_local.h Copyright year updates 2025-03-12 13:35:59 +00:00
evp_pbe.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
evp_pkey.c Deprecate ASN1_METH internal usage 2025-07-17 11:25:18 -04:00
evp_pkey_type.c evp_pkey_type: Make base_id_conversion table static 2025-07-18 08:57:16 +02:00
evp_rand.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
evp_utils.c Rename the field 'provctx and data' to 'algctx' inside some objects containing 2021-05-24 10:12:18 +10:00
exchange.c Keep the provided peer EVP_PKEY in the EVP_PKEY_CTX too 2025-03-14 09:44:52 +01:00
kdf_lib.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
kdf_meth.c Copyright year updates 2025-03-12 13:35:59 +00:00
kem.c Copyright year updates 2025-03-12 13:35:59 +00:00
keymgmt_lib.c evp: add EVP_PKEY_get_security_category function 2025-05-27 18:01:44 +10:00
keymgmt_meth.c Only report generic error if provider did not put an error on the error queue 2025-07-30 18:27:08 +02:00
legacy_blake2.c Copyright year updates 2023-09-28 14:23:29 +01:00
legacy_md2.c Update copyright year 2021-04-22 14:38:44 +01:00
legacy_md4.c Update copyright year 2021-04-22 14:38:44 +01:00
legacy_md5.c Update copyright year 2021-04-22 14:38:44 +01:00
legacy_md5_sha1.c Rename all getters to use get/get0 in name 2021-06-01 12:40:00 +02:00
legacy_mdc2.c Update copyright year 2021-04-22 14:38:44 +01:00
legacy_meth.h Update copyright year 2021-06-17 13:24:59 +01:00
legacy_ripemd.c Update copyright year 2021-04-22 14:38:44 +01:00
legacy_sha.c Fix SHAKE AlgorithmIdentifier encodings 2025-06-10 19:42:00 +02:00
legacy_wp.c Update copyright year 2021-04-22 14:38:44 +01:00
m_null.c Update copyright year 2021-04-22 14:38:44 +01:00
m_sigver.c Only report generic error if provider did not put an error on the error queue 2025-07-30 18:27:08 +02:00
mac_lib.c Copyright year updates 2025-03-12 13:35:59 +00:00
mac_meth.c Copyright year updates 2025-03-12 13:35:59 +00:00
names.c Copyright year updates 2024-09-05 09:35:49 +02:00
p5_crpt.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
p5_crpt2.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
p_dec.c Fix possible null pointer dereference of evp_pkey_get_legacy() 2022-06-02 12:06:08 +02:00
p_enc.c Fix possible null pointer dereference of evp_pkey_get_legacy() 2022-06-02 12:06:08 +02:00
p_legacy.c Copyright year updates 2025-03-12 13:35:59 +00:00
p_lib.c Deprecate ASN1_METH internal usage 2025-07-17 11:25:18 -04:00
p_open.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
p_seal.c Stop raising ERR_R_MALLOC_FAILURE in most places 2022-10-05 14:02:03 +02:00
p_sign.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
p_verify.c Copyright year updates 2023-09-07 09:59:15 +01:00
pbe_scrypt.c Add library context and property query support into the PKCS12 API 2021-04-30 09:15:50 +10:00
pmeth_check.c Make EVP_PKEY_check() be an alias for EVP_PKEY_pairwise_check() 2021-07-15 10:54:25 +10:00
pmeth_gn.c Deprecate ASN1_METH internal usage 2025-07-17 11:25:18 -04:00
pmeth_lib.c libapps + libcrypto: Silence warnings on Win64 builds 2025-07-02 17:26:26 +02:00
s_lib.c EVP_SKEY_get_raw_key => EVP_SKEY_get0_raw_key 2025-02-21 17:58:41 +01:00
signature.c crypto/evp/signature.c: add checks for consistent presence of 'update' and 'final' functions 2025-05-20 21:19:34 +02:00
skeymgmt_meth.c Fix coverity finding 2025-02-20 16:28:22 +01:00