From 28fd80a9189b82d0223c35153f8ed6f9cfb59161 Mon Sep 17 00:00:00 2001 From: tb <> Date: Thu, 4 Jan 2024 17:01:26 +0000 Subject: Replace .pkey_base_id with a .base_method pointer Every EVP_PKEY_ASN1_METHOD is either an ASN.1 method or an alias. As such it resolves to an underlying ASN.1 method (in one step). This information can be stored in a base_method pointer in allusion to the pkey_base_id, which is the name for the nid (aka pkey_id aka type) of the underlying method. For an ASN.1 method, the base method is itself, so the base method is set as a pointer to itself. For an alias it is of course a pointer to the underlying method. Then obviously ameth->pkey_base_id is the same as ameth->base_method->pkey_id, so rework all ASN.1 methods to follow that. ok jsing --- src/lib/libcrypto/rsa/rsa_ameth.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib/libcrypto/rsa') diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c index 918e7b8901..b8957c0d1c 100644 --- a/src/lib/libcrypto/rsa/rsa_ameth.c +++ b/src/lib/libcrypto/rsa/rsa_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_ameth.c,v 1.55 2024/01/04 16:41:56 tb Exp $ */ +/* $OpenBSD: rsa_ameth.c,v 1.56 2024/01/04 17:01:26 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -1149,8 +1149,8 @@ rsa_cms_encrypt(CMS_RecipientInfo *ri) #endif const EVP_PKEY_ASN1_METHOD rsa_asn1_meth = { + .base_method = &rsa_asn1_meth, .pkey_id = EVP_PKEY_RSA, - .pkey_base_id = EVP_PKEY_RSA, .pkey_flags = ASN1_PKEY_SIGPARAM_NULL, .pem_str = "RSA", @@ -1182,16 +1182,16 @@ const EVP_PKEY_ASN1_METHOD rsa_asn1_meth = { }; const EVP_PKEY_ASN1_METHOD rsa2_asn1_meth = { + .base_method = &rsa_asn1_meth, .pkey_id = EVP_PKEY_RSA2, - .pkey_base_id = EVP_PKEY_RSA, .pkey_flags = ASN1_PKEY_ALIAS, .pkey_check = rsa_pkey_check, }; const EVP_PKEY_ASN1_METHOD rsa_pss_asn1_meth = { + .base_method = &rsa_pss_asn1_meth, .pkey_id = EVP_PKEY_RSA_PSS, - .pkey_base_id = EVP_PKEY_RSA_PSS, .pkey_flags = ASN1_PKEY_SIGPARAM_NULL, .pem_str = "RSA-PSS", -- cgit v1.2.3-55-g6feb