EVP: fetch the EVP_KEYMGMT earlier
authorRichard Levitte <levitte@openssl.org>
Tue, 17 Mar 2020 13:37:47 +0000 (14:37 +0100)
committerRichard Levitte <levitte@openssl.org>
Sat, 21 Mar 2020 08:28:11 +0000 (09:28 +0100)
commit4b9e90f42a367a880af2dae6f6c4b455a0d2c0f4
treea64f44c6f27a4f4c70fe671d0f984f859ef94990
parent9a1c170d6309bb814ba8d720503069337f628b32
EVP: fetch the EVP_KEYMGMT earlier

Instead of fetching the EVP_KEYMGMT in the init for every different
operation, do it when creating the EVP_PKEY_CTX.

This allows certain control functions to be called between the
creation of the EVP_PKEY_CTX and the call of the operation's init
function.

Use case: EVP_PKEY_CTX_set1_id(), which is allowed to be called very
early with the legacy implementation, this should still be allowed
with provider implementations.

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
(Merged from https://github.com/openssl/openssl/pull/11343)
crypto/evp/exchange.c
crypto/evp/p_lib.c
crypto/evp/pmeth_gn.c
crypto/evp/pmeth_lib.c
crypto/evp/signature.c
include/crypto/evp.h