Fix coverity CID #1465594 - Null dereference in EVP_PKEY_get0()

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12628)
This commit is contained in:
Shane Lontis 2020-08-11 15:03:42 +10:00
parent 05ead00065
commit 3c1ccfea85

View File

@ -720,6 +720,8 @@ int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)
void *EVP_PKEY_get0(const EVP_PKEY *pkey)
{
if (pkey == NULL)
return NULL;
if (!evp_pkey_downgrade((EVP_PKEY *)pkey)) {
ERR_raise(ERR_LIB_EVP, EVP_R_INACCESSIBLE_KEY);
return NULL;