summaryrefslogtreecommitdiffstats
path: root/crypto/pem
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2021-05-28 11:07:24 +0100
committerMatt Caswell <matt@openssl.org>2021-06-08 18:53:39 +0100
commitb2f1b36592806afcaae79289c33756fb0af5b4ca (patch)
tree35073737fd3e45fe90a2bc3c6399d7ca61e429c7 /crypto/pem
parent237cb05d342338ac42852cfdec21b900458a537c (diff)
Actually use a legacy route in pem_read_bio_key_legacy()
The function pem_read_bio_key_legacy() is a fallback route if we failed to load a key via a provider. We should be using the legacy specific d2i functions to force legacy otherwise we end up using a provider anyway Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15504)
Diffstat (limited to 'crypto/pem')
-rw-r--r--crypto/pem/pem_pkey.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/pem/pem_pkey.c b/crypto/pem/pem_pkey.c
index 01877057dc..ca6b2a2132 100644
--- a/crypto/pem/pem_pkey.c
+++ b/crypto/pem/pem_pkey.c
@@ -23,6 +23,7 @@
#include <openssl/decoder.h>
#include <openssl/ui.h>
#include "crypto/asn1.h"
+#include "crypto/x509.h"
#include "crypto/evp.h"
#include "pem_local.h"
@@ -157,9 +158,10 @@ static EVP_PKEY *pem_read_bio_key_legacy(BIO *bp, EVP_PKEY **x,
ameth = EVP_PKEY_asn1_find_str(NULL, nm, slen);
if (ameth == NULL || ameth->old_priv_decode == NULL)
goto p8err;
- ret = d2i_PrivateKey(ameth->pkey_id, x, &p, len);
+ ret = ossl_d2i_PrivateKey_legacy(ameth->pkey_id, x, &p, len, libctx,
+ propq);
} else if (selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) {
- ret = d2i_PUBKEY(x, &p, len);
+ ret = ossl_d2i_PUBKEY_legacy(x, &p, len);
} else if ((slen = ossl_pem_check_suffix(nm, "PARAMETERS")) > 0) {
ret = EVP_PKEY_new();
if (ret == NULL)