diff options
author | tb <> | 2024-01-04 16:41:56 +0000 |
---|---|---|
committer | tb <> | 2024-01-04 16:41:56 +0000 |
commit | 7a63cf228d8c89efdb78c641551b9bac57739698 (patch) | |
tree | 42c88a97ebc87bb0e93b4c3ce66bffb8d866247f /src/lib/libcrypto/evp/p_lib.c | |
parent | 5476a9d1ff0475bb9440b5e67a3837b7ed91fd7c (diff) | |
download | openbsd-7a63cf228d8c89efdb78c641551b9bac57739698.tar.gz openbsd-7a63cf228d8c89efdb78c641551b9bac57739698.tar.bz2 openbsd-7a63cf228d8c89efdb78c641551b9bac57739698.zip |
Split ameth arrays into individual methods
For some reason DSA, GOST, and RSA had their ASN.1 methods stored in
an array. This is clumsy and the only benefit is that one saves a few
externs in p_lib.c. They were also arranged by ascending NID because
of bsearch() madness.
Split them up and arrange the methods by name, which is much saner
and simpler.
ok jsing
Diffstat (limited to 'src/lib/libcrypto/evp/p_lib.c')
-rw-r--r-- | src/lib/libcrypto/evp/p_lib.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index b64977bab8..f46666a008 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.52 2024/01/01 15:23:00 tb Exp $ */ | 1 | /* $OpenBSD: p_lib.c,v 1.53 2024/01/04 16:41:56 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 | * |
@@ -133,33 +133,40 @@ | |||
133 | 133 | ||
134 | extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth; | 134 | extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth; |
135 | extern const EVP_PKEY_ASN1_METHOD dh_asn1_meth; | 135 | extern const EVP_PKEY_ASN1_METHOD dh_asn1_meth; |
136 | extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[]; | 136 | extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meth; |
137 | extern const EVP_PKEY_ASN1_METHOD dsa1_asn1_meth; | ||
138 | extern const EVP_PKEY_ASN1_METHOD dsa2_asn1_meth; | ||
139 | extern const EVP_PKEY_ASN1_METHOD dsa3_asn1_meth; | ||
140 | extern const EVP_PKEY_ASN1_METHOD dsa4_asn1_meth; | ||
137 | extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth; | 141 | extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth; |
138 | extern const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth; | 142 | extern const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth; |
139 | extern const EVP_PKEY_ASN1_METHOD gostimit_asn1_meth; | 143 | extern const EVP_PKEY_ASN1_METHOD gostimit_asn1_meth; |
140 | extern const EVP_PKEY_ASN1_METHOD gostr01_asn1_meths[]; | 144 | extern const EVP_PKEY_ASN1_METHOD gostr01_asn1_meth; |
145 | extern const EVP_PKEY_ASN1_METHOD gostr12_256_asn1_meth; | ||
146 | extern const EVP_PKEY_ASN1_METHOD gostr12_512_asn1_meth; | ||
141 | extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth; | 147 | extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth; |
142 | extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[]; | 148 | extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meth; |
149 | extern const EVP_PKEY_ASN1_METHOD rsa2_asn1_meth; | ||
143 | extern const EVP_PKEY_ASN1_METHOD rsa_pss_asn1_meth; | 150 | extern const EVP_PKEY_ASN1_METHOD rsa_pss_asn1_meth; |
144 | extern const EVP_PKEY_ASN1_METHOD x25519_asn1_meth; | 151 | extern const EVP_PKEY_ASN1_METHOD x25519_asn1_meth; |
145 | 152 | ||
146 | static const EVP_PKEY_ASN1_METHOD *asn1_methods[] = { | 153 | static const EVP_PKEY_ASN1_METHOD *asn1_methods[] = { |
147 | &cmac_asn1_meth, | 154 | &cmac_asn1_meth, |
148 | &dh_asn1_meth, | 155 | &dh_asn1_meth, |
149 | &dsa_asn1_meths[0], | 156 | &dsa_asn1_meth, |
150 | &dsa_asn1_meths[1], | 157 | &dsa1_asn1_meth, |
151 | &dsa_asn1_meths[2], | 158 | &dsa2_asn1_meth, |
152 | &dsa_asn1_meths[3], | 159 | &dsa3_asn1_meth, |
153 | &dsa_asn1_meths[4], | 160 | &dsa4_asn1_meth, |
154 | &eckey_asn1_meth, | 161 | &eckey_asn1_meth, |
155 | &ed25519_asn1_meth, | 162 | &ed25519_asn1_meth, |
156 | &gostimit_asn1_meth, | 163 | &gostimit_asn1_meth, |
157 | &gostr01_asn1_meths[0], | 164 | &gostr01_asn1_meth, |
158 | &gostr01_asn1_meths[1], | 165 | &gostr12_256_asn1_meth, |
159 | &gostr01_asn1_meths[2], | 166 | &gostr12_512_asn1_meth, |
160 | &hmac_asn1_meth, | 167 | &hmac_asn1_meth, |
161 | &rsa_asn1_meths[0], | 168 | &rsa_asn1_meth, |
162 | &rsa_asn1_meths[1], | 169 | &rsa2_asn1_meth, |
163 | &rsa_pss_asn1_meth, | 170 | &rsa_pss_asn1_meth, |
164 | &x25519_asn1_meth, | 171 | &x25519_asn1_meth, |
165 | }; | 172 | }; |