diff options
author | tb <> | 2024-01-04 17:01:26 +0000 |
---|---|---|
committer | tb <> | 2024-01-04 17:01:26 +0000 |
commit | 28fd80a9189b82d0223c35153f8ed6f9cfb59161 (patch) | |
tree | 352dd8b119595c9dcef2c0b2739e1e98f14a4676 /src/lib/libcrypto/evp/p_lib.c | |
parent | 6ac39f8daa6e59d602f970b08d9bc152a63fd7a5 (diff) | |
download | openbsd-28fd80a9189b82d0223c35153f8ed6f9cfb59161.tar.gz openbsd-28fd80a9189b82d0223c35153f8ed6f9cfb59161.tar.bz2 openbsd-28fd80a9189b82d0223c35153f8ed6f9cfb59161.zip |
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
Diffstat (limited to 'src/lib/libcrypto/evp/p_lib.c')
-rw-r--r-- | src/lib/libcrypto/evp/p_lib.c | 6 |
1 files changed, 3 insertions, 3 deletions
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 @@ | |||
1 | /* $OpenBSD: p_lib.c,v 1.53 2024/01/04 16:41:56 tb Exp $ */ | 1 | /* $OpenBSD: p_lib.c,v 1.54 2024/01/04 17:01:26 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -222,7 +222,7 @@ EVP_PKEY_asn1_find(ENGINE **pe, int type) | |||
222 | break; | 222 | break; |
223 | if ((mp->pkey_flags & ASN1_PKEY_ALIAS) == 0) | 223 | if ((mp->pkey_flags & ASN1_PKEY_ALIAS) == 0) |
224 | break; | 224 | break; |
225 | type = mp->pkey_base_id; | 225 | type = mp->base_method->pkey_id; |
226 | } | 226 | } |
227 | 227 | ||
228 | return mp; | 228 | return mp; |
@@ -259,7 +259,7 @@ EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id, int *ppkey_flags, | |||
259 | if (ppkey_id) | 259 | if (ppkey_id) |
260 | *ppkey_id = ameth->pkey_id; | 260 | *ppkey_id = ameth->pkey_id; |
261 | if (ppkey_base_id) | 261 | if (ppkey_base_id) |
262 | *ppkey_base_id = ameth->pkey_base_id; | 262 | *ppkey_base_id = ameth->base_method->pkey_id; |
263 | if (ppkey_flags) | 263 | if (ppkey_flags) |
264 | *ppkey_flags = ameth->pkey_flags; | 264 | *ppkey_flags = ameth->pkey_flags; |
265 | if (pinfo) | 265 | if (pinfo) |