Put a NULL check back in to avoid dereferencing the NULL pointer.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7146)
const EVP_PKEY_METHOD *pmeth;
if (id == -1) {
+ if (pkey == NULL)
+ return 0;
id = pkey->type;
}
#ifndef OPENSSL_NO_ENGINE
ret->pmeth = pmeth;
ret->operation = EVP_PKEY_OP_UNDEFINED;
ret->pkey = pkey;
- if (pkey)
+ if (pkey != NULL)
EVP_PKEY_up_ref(pkey);
if (pmeth->init) {