diff options
author | Richard Levitte <levitte@openssl.org> | 2017-10-27 22:42:04 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2017-10-31 09:21:32 +0100 |
commit | 605fa68efaf2ebc891330ed1ae9e5053a2228c1e (patch) | |
tree | f6511f2071203b53eef008f637b1859fb62024d6 /crypto/asn1 | |
parent | 6088fb79f110d34ac66093f4a33dc82612674d78 (diff) |
EVP_PKEY_asn1_add0(): Check that this method isn't already registered
No two public key ASN.1 methods with the same pkey_id can be
registered at the same time.
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/4620)
Diffstat (limited to 'crypto/asn1')
-rw-r--r-- | crypto/asn1/ameth_lib.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c index cfde49ab02..dca5affc90 100644 --- a/crypto/asn1/ameth_lib.c +++ b/crypto/asn1/ameth_lib.c @@ -176,6 +176,11 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth) { + if (pkey_asn1_find(ameth->pkey_id) != NULL) { + EVPerr(EVP_F_EVP_PKEY_ASN1_ADD0, + EVP_R_PKEY_ASN1_METHOD_ALREADY_REGISTERED); + return 0; + } if (app_methods == NULL) { app_methods = sk_EVP_PKEY_ASN1_METHOD_new(ameth_cmp); if (app_methods == NULL) |