diff options
| author | tb <> | 2024-01-04 17:01:26 +0000 |
|---|---|---|
| committer | tb <> | 2024-01-04 17:01:26 +0000 |
| commit | 9f1cd2582409ac5778c5a0e28dfb77f18d122c98 (patch) | |
| tree | 352dd8b119595c9dcef2c0b2739e1e98f14a4676 /src/lib/libcrypto/ec | |
| parent | 7054693affbb29c6d4c57fe0291eb64b4748ce17 (diff) | |
| download | openbsd-9f1cd2582409ac5778c5a0e28dfb77f18d122c98.tar.gz openbsd-9f1cd2582409ac5778c5a0e28dfb77f18d122c98.tar.bz2 openbsd-9f1cd2582409ac5778c5a0e28dfb77f18d122c98.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/ec')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_ameth.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecx_methods.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c index c22f38b345..7ca5b18020 100644 --- a/src/lib/libcrypto/ec/ec_ameth.c +++ b/src/lib/libcrypto/ec/ec_ameth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_ameth.c,v 1.50 2023/12/29 18:49:06 tb Exp $ */ | 1 | /* $OpenBSD: ec_ameth.c,v 1.51 2024/01/04 17:01:26 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -1049,8 +1049,8 @@ ecdh_cms_encrypt(CMS_RecipientInfo *ri) | |||
| 1049 | #endif | 1049 | #endif |
| 1050 | 1050 | ||
| 1051 | const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = { | 1051 | const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = { |
| 1052 | .base_method = &eckey_asn1_meth, | ||
| 1052 | .pkey_id = EVP_PKEY_EC, | 1053 | .pkey_id = EVP_PKEY_EC, |
| 1053 | .pkey_base_id = EVP_PKEY_EC, | ||
| 1054 | 1054 | ||
| 1055 | .pem_str = "EC", | 1055 | .pem_str = "EC", |
| 1056 | .info = "OpenSSL EC algorithm", | 1056 | .info = "OpenSSL EC algorithm", |
diff --git a/src/lib/libcrypto/ec/ecx_methods.c b/src/lib/libcrypto/ec/ecx_methods.c index 75988d99ad..cd512a447f 100644 --- a/src/lib/libcrypto/ec/ecx_methods.c +++ b/src/lib/libcrypto/ec/ecx_methods.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecx_methods.c,v 1.10 2023/11/09 11:39:13 tb Exp $ */ | 1 | /* $OpenBSD: ecx_methods.c,v 1.11 2024/01/04 17:01:26 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -813,8 +813,8 @@ pkey_ecx_ed_ctrl(EVP_PKEY_CTX *pkey_ctx, int op, int arg1, void *arg2) | |||
| 813 | } | 813 | } |
| 814 | 814 | ||
| 815 | const EVP_PKEY_ASN1_METHOD x25519_asn1_meth = { | 815 | const EVP_PKEY_ASN1_METHOD x25519_asn1_meth = { |
| 816 | .base_method = &x25519_asn1_meth, | ||
| 816 | .pkey_id = EVP_PKEY_X25519, | 817 | .pkey_id = EVP_PKEY_X25519, |
| 817 | .pkey_base_id = EVP_PKEY_X25519, | ||
| 818 | .pkey_flags = 0, | 818 | .pkey_flags = 0, |
| 819 | .pem_str = "X25519", | 819 | .pem_str = "X25519", |
| 820 | .info = "OpenSSL X25519 algorithm", | 820 | .info = "OpenSSL X25519 algorithm", |
| @@ -851,8 +851,8 @@ const EVP_PKEY_METHOD x25519_pkey_meth = { | |||
| 851 | }; | 851 | }; |
| 852 | 852 | ||
| 853 | const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth = { | 853 | const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth = { |
| 854 | .base_method = &ed25519_asn1_meth, | ||
| 854 | .pkey_id = EVP_PKEY_ED25519, | 855 | .pkey_id = EVP_PKEY_ED25519, |
| 855 | .pkey_base_id = EVP_PKEY_ED25519, | ||
| 856 | .pkey_flags = 0, | 856 | .pkey_flags = 0, |
| 857 | .pem_str = "ED25519", | 857 | .pem_str = "ED25519", |
| 858 | .info = "OpenSSL ED25519 algorithm", | 858 | .info = "OpenSSL ED25519 algorithm", |
