diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2024-01-04 17:01:27 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2024-01-04 17:01:27 +0000 |
commit | 2c4b111fba1317ee5a15319a903809eec21fbd99 (patch) | |
tree | f6ba736f5241f7b37a5fa751d09eb3f3cd9717db /lib/libcrypto/gost | |
parent | dac9b6c46b49def383c859a08230dbfac9a4309b (diff) |
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 'lib/libcrypto/gost')
-rw-r--r-- | lib/libcrypto/gost/gost89imit_ameth.c | 4 | ||||
-rw-r--r-- | lib/libcrypto/gost/gostr341001_ameth.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/libcrypto/gost/gost89imit_ameth.c b/lib/libcrypto/gost/gost89imit_ameth.c index e300b528016..76e285b2d8d 100644 --- a/lib/libcrypto/gost/gost89imit_ameth.c +++ b/lib/libcrypto/gost/gost89imit_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gost89imit_ameth.c,v 1.4 2022/11/26 16:08:53 tb Exp $ */ +/* $OpenBSD: gost89imit_ameth.c,v 1.5 2024/01/04 17:01:26 tb Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> * Copyright (c) 2005-2006 Cryptocom LTD @@ -75,8 +75,8 @@ mac_ctrl_gost(EVP_PKEY *pkey, int op, long arg1, void *arg2) } const EVP_PKEY_ASN1_METHOD gostimit_asn1_meth = { + .base_method = &gostimit_asn1_meth, .pkey_id = EVP_PKEY_GOSTIMIT, - .pkey_base_id = EVP_PKEY_GOSTIMIT, .pkey_flags = ASN1_PKEY_SIGPARAM_NULL, .pem_str = "GOST-MAC", diff --git a/lib/libcrypto/gost/gostr341001_ameth.c b/lib/libcrypto/gost/gostr341001_ameth.c index f917827f7a7..e8e8c8aa821 100644 --- a/lib/libcrypto/gost/gostr341001_ameth.c +++ b/lib/libcrypto/gost/gostr341001_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gostr341001_ameth.c,v 1.23 2024/01/04 16:41:56 tb Exp $ */ +/* $OpenBSD: gostr341001_ameth.c,v 1.24 2024/01/04 17:01:26 tb Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> * Copyright (c) 2005-2006 Cryptocom LTD @@ -683,8 +683,8 @@ pkey_ctrl_gost01(EVP_PKEY *pkey, int op, long arg1, void *arg2) } const EVP_PKEY_ASN1_METHOD gostr01_asn1_meth = { + .base_method = &gostr01_asn1_meth, .pkey_id = EVP_PKEY_GOSTR01, - .pkey_base_id = EVP_PKEY_GOSTR01, .pkey_flags = ASN1_PKEY_SIGPARAM_NULL, .pem_str = "GOST2001", @@ -713,14 +713,14 @@ const EVP_PKEY_ASN1_METHOD gostr01_asn1_meth = { }; const EVP_PKEY_ASN1_METHOD gostr12_256_asn1_meth = { + .base_method = &gostr01_asn1_meth, .pkey_id = EVP_PKEY_GOSTR12_256, - .pkey_base_id = EVP_PKEY_GOSTR01, .pkey_flags = ASN1_PKEY_ALIAS, }; const EVP_PKEY_ASN1_METHOD gostr12_512_asn1_meth = { + .base_method = &gostr01_asn1_meth, .pkey_id = EVP_PKEY_GOSTR12_512, - .pkey_base_id = EVP_PKEY_GOSTR01, .pkey_flags = ASN1_PKEY_ALIAS, }; |