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/evp/p_lib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib/libcrypto/evp/p_lib.c') diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index f46666a008..b43a0fcd5d 100644 --- a/src/lib/libcrypto/evp/p_lib.c +++ b/src/lib/libcrypto/evp/p_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_lib.c,v 1.53 2024/01/04 16:41:56 tb Exp $ */ +/* $OpenBSD: p_lib.c,v 1.54 2024/01/04 17:01:26 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -222,7 +222,7 @@ EVP_PKEY_asn1_find(ENGINE **pe, int type) break; if ((mp->pkey_flags & ASN1_PKEY_ALIAS) == 0) break; - type = mp->pkey_base_id; + type = mp->base_method->pkey_id; } return mp; @@ -259,7 +259,7 @@ EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id, int *ppkey_flags, if (ppkey_id) *ppkey_id = ameth->pkey_id; if (ppkey_base_id) - *ppkey_base_id = ameth->pkey_base_id; + *ppkey_base_id = ameth->base_method->pkey_id; if (ppkey_flags) *ppkey_flags = ameth->pkey_flags; if (pinfo) -- cgit v1.2.3-55-g6feb