openssl/crypto/evp
Richard Levitte 5246183e7a EVP: Reverse the fetch logic in all pkey using functionality
In all initializing functions for functionality that use an EVP_PKEY, the
coded logic was to find an KEYMGMT implementation first, and then try to
find the operation method (for example, SIGNATURE implementation) in the
same provider.

This implies that in providers where there is a KEYMGMT implementation,
there must also be a SIGNATURE implementation, along with a KEYEXCH,
ASYM_CIPHER, etc implementation.

The intended design was, however, the opposite implication, i.e. that
where there is a SIGNATURE implementation, there must also be KEYMGMT.

This change reverses the logic of the code to be closer to the intended
design.

There is a consequence; we now use the query_operation_name function from
the KEYMGMT of the EVP_PKEY given by the EVP_PKEY_CTX (ultimately given by
the application).  Previously, we used the query_operation_name function
from the KEYMGMT found alongside the SIGNATURE implementation.

Another minor consequence is that the |keymgmt| field in EVP_PKEY_CTX
is now always a reference to the KEYMGMT of the |pkey| field if that
one is given (|pkey| isn't NULL) and is provided (|pkey->keymgmt|
isn't NULL).

Fixes #16614

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16725)
2021-10-27 12:41:12 +02:00
..
asymcipher.c EVP: Reverse the fetch logic in all pkey using functionality 2021-10-27 12:41:12 +02:00
bio_b64.c Update copyright year 2021-06-17 13:24:59 +01:00
bio_enc.c Update copyright year 2021-06-17 13:24:59 +01:00
bio_md.c
bio_ok.c
build.info
c_allc.c
c_alld.c
cmeth_lib.c Fix EVP_MD_meth_dup and EVP_CIPHER_meth_dup 2021-07-28 09:36:54 +10:00
ctrl_params_translate.c ctrl_params_translate: Fix leak of BN_CTX 2021-10-12 16:45:21 +02:00
dh_ctrl.c
dh_support.c
digest.c fips module header inclusion fine-tunning 2021-07-06 10:52:27 +10:00
dsa_ctrl.c
e_aes_cbc_hmac_sha1.c
e_aes_cbc_hmac_sha256.c
e_aes.c s390x: AES OFB/CFB: Maintain running IV from cipher context 2021-08-16 13:02:50 +02:00
e_aria.c
e_bf.c Update copyright year 2021-06-17 13:24:59 +01:00
e_camellia.c Split bignum code out of the sparcv9cap.c 2021-07-15 09:33:04 +02:00
e_cast.c
e_chacha20_poly1305.c
e_des3.c Split bignum code out of the sparcv9cap.c 2021-07-15 09:33:04 +02:00
e_des.c Split bignum code out of the sparcv9cap.c 2021-07-15 09:33:04 +02:00
e_idea.c Update copyright year 2021-06-17 13:24:59 +01:00
e_null.c
e_old.c
e_rc2.c
e_rc4_hmac_md5.c
e_rc4.c
e_rc5.c Update copyright year 2021-06-17 13:24:59 +01:00
e_seed.c
e_sm4.c
e_xcbc_d.c
ec_ctrl.c
ec_support.c
encode.c
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 EVP_CIPHER_CTX_set_key_length: Raise error when key length is not settable 2021-08-11 17:11:47 +02:00
evp_err.c
evp_fetch.c EVP: Add the internal function evp_generic_fetch_from_prov() 2021-10-27 12:41:10 +02:00
evp_key.c Update copyright year 2021-06-17 13:24:59 +01:00
evp_lib.c Fix EVP_MD_meth_dup and EVP_CIPHER_meth_dup 2021-07-28 09:36:54 +10:00
evp_local.h EVP: Add evp_keymgmt_fetch_from_prov() 2021-10-27 12:41:10 +02:00
evp_pbe.c
evp_pkey.c EVP: Add EVP_PKEY_get0_provider() and EVP_PKEY_CTX_get0_provider() 2021-07-26 12:11:54 +02:00
evp_rand.c fips module header inclusion fine-tunning 2021-07-06 10:52:27 +10:00
evp_utils.c
exchange.c EVP: Reverse the fetch logic in all pkey using functionality 2021-10-27 12:41:12 +02:00
kdf_lib.c fips module header inclusion fine-tunning 2021-07-06 10:52:27 +10:00
kdf_meth.c Adapt all public EVP_XXX_do_all_provided() for the changed evp_generic_do_all() 2021-06-15 16:21:32 +02:00
kem.c EVP: Reverse the fetch logic in all pkey using functionality 2021-10-27 12:41:12 +02:00
keymgmt_lib.c EVP: Reverse the fetch logic in all pkey using functionality 2021-10-27 12:41:12 +02:00
keymgmt_meth.c EVP: Add evp_keymgmt_fetch_from_prov() 2021-10-27 12:41:10 +02:00
legacy_blake2.c
legacy_md2.c
legacy_md4.c
legacy_md5_sha1.c
legacy_md5.c
legacy_mdc2.c
legacy_meth.h Update copyright year 2021-06-17 13:24:59 +01:00
legacy_ripemd.c
legacy_sha.c
legacy_wp.c
m_null.c
m_sigver.c EVP: Reverse the fetch logic in all pkey using functionality 2021-10-27 12:41:12 +02:00
mac_lib.c Enforce a size check in EVP_MAC_final() 2021-10-22 08:43:26 +01:00
mac_meth.c Adapt all public EVP_XXX_do_all_provided() for the changed evp_generic_do_all() 2021-06-15 16:21:32 +02:00
names.c
p5_crpt2.c
p5_crpt.c Update copyright year 2021-06-17 13:24:59 +01:00
p_dec.c
p_enc.c
p_legacy.c
p_lib.c add checks for the return values of BN_new(), sk_RSA_PRIME_INFO_new_reserve(), 2021-10-27 08:36:55 +10:00
p_open.c
p_seal.c
p_sign.c
p_verify.c
pbe_scrypt.c
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 fips module header inclusion fine-tunning 2021-07-06 10:52:27 +10:00
pmeth_lib.c EVP: Reverse the fetch logic in all pkey using functionality 2021-10-27 12:41:12 +02:00
signature.c EVP: Reverse the fetch logic in all pkey using functionality 2021-10-27 12:41:12 +02:00