mirror of
https://github.com/openssl/openssl.git
synced 2025-01-24 13:55:42 +08:00
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/4596)
This commit is contained in:
parent
751148e2b0
commit
d85722d31a
@ -137,6 +137,11 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
|
|||||||
|
|
||||||
int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth)
|
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) {
|
if (app_methods == NULL) {
|
||||||
app_methods = sk_EVP_PKEY_ASN1_METHOD_new(ameth_cmp);
|
app_methods = sk_EVP_PKEY_ASN1_METHOD_new(ameth_cmp);
|
||||||
if (app_methods == NULL)
|
if (app_methods == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user