EVP: Fix evp_pkey_ctx_store_cached_data() to handle provider backed EVP_PKEY_CTX
authorRichard Levitte <levitte@openssl.org>
Wed, 27 Jan 2021 10:07:38 +0000 (11:07 +0100)
committerRichard Levitte <levitte@openssl.org>
Wed, 3 Feb 2021 16:20:56 +0000 (17:20 +0100)
commit977e95b912138d02bae86d829a990d81c2bbcca0
tree0e0c3e9a851c9676fc4b1fe81e111c77c74fb8a4
parent60488d2434c5be15dc14e1fa2a8733f076d9ccf4
EVP: Fix evp_pkey_ctx_store_cached_data() to handle provider backed EVP_PKEY_CTX

It assumed there would always be a non-NULL ctx->pmeth, leading to a
crash when that isn't the case.  Since it needs to check 'keytype'
when that one isn't -1, we also add a corresponding check for the
provider backed EVP_PKEY_CTX case.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13973)
crypto/evp/p_lib.c
crypto/evp/pmeth_lib.c
include/crypto/evp.h