Update our EVP_PKEY_METHODs to get low level keys via public APIs
authorMatt Caswell <matt@openssl.org>
Tue, 20 Jul 2021 08:58:53 +0000 (09:58 +0100)
committerTomas Mraz <tomas@openssl.org>
Thu, 22 Jul 2021 11:52:46 +0000 (13:52 +0200)
commit5dc6489bb6026b679eb6cbe696e4227da9c7032e
treea567173607b9708303fbf01061e52c33800006df
parent981a5b7ce3bcdf4748162073c3dbd096c82d3c69
Update our EVP_PKEY_METHODs to get low level keys via public APIs

It is possible to call built-in EVP_PKEY_METHOD functions with a provided
key. For example this might occur if a custom EVP_PKEY_METHOD is in use
that wraps a built-in EVP_PKEY_METHOD. Therefore our EVP_PKEY_METHOD
functions should not assume that we are using a legacy key. Instead we
get the low level key using EVP_PKEY_get0_RSA() or other similar functions.
This "does the right thing" if the key is actually provided.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16118)
crypto/dh/dh_pmeth.c
crypto/dsa/dsa_pmeth.c
crypto/ec/ec_pmeth.c
crypto/ec/ecx_meth.c
crypto/rsa/rsa_pmeth.c