diff options
author | Matt Caswell <matt@openssl.org> | 2021-05-28 12:07:24 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-06-08 19:53:39 +0200 |
commit | b2f1b36592806afcaae79289c33756fb0af5b4ca (patch) | |
tree | 35073737fd3e45fe90a2bc3c6399d7ca61e429c7 /crypto/x509/x_pubkey.c | |
parent | Just look for "Unable to load Public Key" if no SM2 (diff) | |
download | openssl-b2f1b36592806afcaae79289c33756fb0af5b4ca.tar.xz openssl-b2f1b36592806afcaae79289c33756fb0af5b4ca.zip |
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/x509/x_pubkey.c')
-rw-r--r-- | crypto/x509/x_pubkey.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/crypto/x509/x_pubkey.c b/crypto/x509/x_pubkey.c index ace4b533fe..20216bd922 100644 --- a/crypto/x509/x_pubkey.c +++ b/crypto/x509/x_pubkey.c @@ -505,8 +505,8 @@ static EVP_PKEY *d2i_PUBKEY_int(EVP_PKEY **a, } /* For the algorithm specific d2i functions further down */ -static EVP_PKEY *d2i_PUBKEY_legacy(EVP_PKEY **a, - const unsigned char **pp, long length) +EVP_PKEY *ossl_d2i_PUBKEY_legacy(EVP_PKEY **a, const unsigned char **pp, + long length) { return d2i_PUBKEY_int(a, pp, length, NULL, NULL, 1, d2i_X509_PUBKEY); } @@ -583,7 +583,7 @@ RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length) const unsigned char *q; q = *pp; - pkey = d2i_PUBKEY_legacy(NULL, &q, length); + pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; key = EVP_PKEY_get1_RSA(pkey); @@ -624,7 +624,7 @@ DH *ossl_d2i_DH_PUBKEY(DH **a, const unsigned char **pp, long length) const unsigned char *q; q = *pp; - pkey = d2i_PUBKEY_legacy(NULL, &q, length); + pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; if (EVP_PKEY_get_id(pkey) == EVP_PKEY_DH) @@ -665,7 +665,7 @@ DH *ossl_d2i_DHx_PUBKEY(DH **a, const unsigned char **pp, long length) const unsigned char *q; q = *pp; - pkey = d2i_PUBKEY_legacy(NULL, &q, length); + pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; if (EVP_PKEY_get_id(pkey) == EVP_PKEY_DHX) @@ -708,7 +708,7 @@ DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length) const unsigned char *q; q = *pp; - pkey = d2i_PUBKEY_legacy(NULL, &q, length); + pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; key = EVP_PKEY_get1_DSA(pkey); @@ -751,7 +751,7 @@ EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length) int type; q = *pp; - pkey = d2i_PUBKEY_legacy(NULL, &q, length); + pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; type = EVP_PKEY_get_id(pkey); @@ -794,7 +794,7 @@ ECX_KEY *ossl_d2i_ED25519_PUBKEY(ECX_KEY **a, const unsigned char *q; q = *pp; - pkey = d2i_PUBKEY_legacy(NULL, &q, length); + pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; key = ossl_evp_pkey_get1_ED25519(pkey); @@ -835,7 +835,7 @@ ECX_KEY *ossl_d2i_ED448_PUBKEY(ECX_KEY **a, const unsigned char *q; q = *pp; - pkey = d2i_PUBKEY_legacy(NULL, &q, length); + pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; if (EVP_PKEY_get_id(pkey) == EVP_PKEY_ED448) @@ -877,7 +877,7 @@ ECX_KEY *ossl_d2i_X25519_PUBKEY(ECX_KEY **a, const unsigned char *q; q = *pp; - pkey = d2i_PUBKEY_legacy(NULL, &q, length); + pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; if (EVP_PKEY_get_id(pkey) == EVP_PKEY_X25519) @@ -919,7 +919,7 @@ ECX_KEY *ossl_d2i_X448_PUBKEY(ECX_KEY **a, const unsigned char *q; q = *pp; - pkey = d2i_PUBKEY_legacy(NULL, &q, length); + pkey = ossl_d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; if (EVP_PKEY_get_id(pkey) == EVP_PKEY_X448) |