From 337ade3d2c9691aeb4a6ca1720f00346db91ac60 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Thu, 5 Nov 2020 17:28:59 +0000 Subject: [PATCH] Don't forget the datatype when decoding a PEM file The OSSL_STORE code was forgetting the datatype that we read from the PEM header when decoding the DER. Fixes #13046 Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/13329) --- crypto/store/store_result.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/store/store_result.c b/crypto/store/store_result.c index 175891d29f6..25100e0248c 100644 --- a/crypto/store/store_result.c +++ b/crypto/store/store_result.c @@ -274,8 +274,8 @@ static EVP_PKEY *try_key_value(struct extracted_param_data_st *data, } decoderctx = - OSSL_DECODER_CTX_new_by_EVP_PKEY(&pk, NULL, NULL, NULL, selection, - libctx, propq); + OSSL_DECODER_CTX_new_by_EVP_PKEY(&pk, "DER", NULL, data->data_type, + selection, libctx, propq); (void)OSSL_DECODER_CTX_set_passphrase_cb(decoderctx, cb, cbarg); /* No error if this couldn't be decoded */ -- 2.47.2