diff options
author | Matt Caswell <matt@openssl.org> | 2021-06-08 11:49:06 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-06-14 09:43:01 +0100 |
commit | 8c7c1c84cbaa38a4053404883d666ea8dff81b3a (patch) | |
tree | e775c97857d6cf816b94573bcbad11e68ed691fb /include | |
parent | 1c49be8673713d2ceb03a63be03531d9b28a46bd (diff) | |
download | openssl-new-8c7c1c84cbaa38a4053404883d666ea8dff81b3a.tar.gz |
Add a generic SubjectPublicKeyInfo decoder
Previously all the SubjectPublicKeyInfo decoders were specific to a key
type. We would iterate over all them until a match was found for the correct
key type. Each one would fully decode the key before then testing whether
it was a match or not - throwing it away if not. This was very inefficient.
Instead we introduce a generic SubjectPublicKeyInfo decoder which figures
out what type of key is contained within it, before subsequently passing on
the data to a key type specific SubjectPublicKeyInfo decoder.
Fixes #15646
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15662)
Diffstat (limited to 'include')
-rw-r--r-- | include/crypto/ec.h | 1 | ||||
-rw-r--r-- | include/crypto/x509.h | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/include/crypto/ec.h b/include/crypto/ec.h index acb14effc9..77972c3650 100644 --- a/include/crypto/ec.h +++ b/include/crypto/ec.h @@ -80,6 +80,7 @@ int ossl_ec_key_fromdata(EC_KEY *ecx, const OSSL_PARAM params[], int ossl_ec_key_otherparams_fromdata(EC_KEY *ec, const OSSL_PARAM params[]); int ossl_ec_key_is_foreign(const EC_KEY *ec); EC_KEY *ossl_ec_key_dup(const EC_KEY *key, int selection); +int ossl_x509_algor_is_sm2(const X509_ALGOR *palg); EC_KEY *ossl_ec_key_param_from_x509_algor(const X509_ALGOR *palg, OSSL_LIB_CTX *libctx, const char *propq); diff --git a/include/crypto/x509.h b/include/crypto/x509.h index acb1d7b64a..db83db0c92 100644 --- a/include/crypto/x509.h +++ b/include/crypto/x509.h @@ -332,6 +332,10 @@ int ossl_x509_PUBKEY_get0_libctx(OSSL_LIB_CTX **plibctx, const char **ppropq, /* Calculate default key identifier according to RFC 5280 section 4.2.1.2 (1) */ ASN1_OCTET_STRING *ossl_x509_pubkey_hash(X509_PUBKEY *pubkey); +X509_PUBKEY *ossl_d2i_X509_PUBKEY_INTERNAL(const unsigned char **pp, + long len, OSSL_LIB_CTX *libctx); +void ossl_X509_PUBKEY_INTERNAL_free(X509_PUBKEY *xpub); + RSA *ossl_d2i_RSA_PSS_PUBKEY(RSA **a, const unsigned char **pp, long length); int ossl_i2d_RSA_PSS_PUBKEY(const RSA *a, unsigned char **pp); # ifndef OPENSSL_NO_DH |