diff options
author | tb <> | 2024-07-13 15:08:58 +0000 |
---|---|---|
committer | tb <> | 2024-07-13 15:08:58 +0000 |
commit | de05eb4f597b95fed408db9aa9e9474eb6daf5e6 (patch) | |
tree | 9bceb8f53165bf9b9a2232987ecac3565db027df /src/lib/libcrypto/x509/x509_info.c | |
parent | d694a3319273a6e59cc84d958713e0342bfc206d (diff) | |
download | openbsd-de05eb4f597b95fed408db9aa9e9474eb6daf5e6.tar.gz openbsd-de05eb4f597b95fed408db9aa9e9474eb6daf5e6.tar.bz2 openbsd-de05eb4f597b95fed408db9aa9e9474eb6daf5e6.zip |
Unify X.509v3 extension methods
Use C99 initializers for all structs (some were forgotten).
Make all the structs static, call them x509v3_ext_* matching NID_*.
Add accessors called x509v3_ext_method_* and use these to implement
X509V3_EXT_get_nid().
This adds consistency and avoids a few contortions like grouping
a few extensions in arrays to save a couple externs.
ok beck jsing
Diffstat (limited to 'src/lib/libcrypto/x509/x509_info.c')
-rw-r--r-- | src/lib/libcrypto/x509/x509_info.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/lib/libcrypto/x509/x509_info.c b/src/lib/libcrypto/x509/x509_info.c index 9372b066ae..d1de346ee6 100644 --- a/src/lib/libcrypto/x509/x509_info.c +++ b/src/lib/libcrypto/x509/x509_info.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_info.c,v 1.4 2024/07/08 14:47:44 beck Exp $ */ | 1 | /* $OpenBSD: x509_info.c,v 1.5 2024/07/13 15:08:58 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 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -71,7 +71,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS( | |||
71 | static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS( | 71 | static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS( |
72 | X509V3_EXT_METHOD *method, X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); | 72 | X509V3_EXT_METHOD *method, X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); |
73 | 73 | ||
74 | const X509V3_EXT_METHOD v3_info = { | 74 | static const X509V3_EXT_METHOD x509v3_ext_info_access = { |
75 | .ext_nid = NID_info_access, | 75 | .ext_nid = NID_info_access, |
76 | .ext_flags = X509V3_EXT_MULTILINE, | 76 | .ext_flags = X509V3_EXT_MULTILINE, |
77 | .it = &AUTHORITY_INFO_ACCESS_it, | 77 | .it = &AUTHORITY_INFO_ACCESS_it, |
@@ -88,7 +88,13 @@ const X509V3_EXT_METHOD v3_info = { | |||
88 | .usr_data = NULL, | 88 | .usr_data = NULL, |
89 | }; | 89 | }; |
90 | 90 | ||
91 | const X509V3_EXT_METHOD v3_sinfo = { | 91 | const X509V3_EXT_METHOD * |
92 | x509v3_ext_method_info_access(void) | ||
93 | { | ||
94 | return &x509v3_ext_info_access; | ||
95 | } | ||
96 | |||
97 | static const X509V3_EXT_METHOD x509v3_ext_sinfo_access = { | ||
92 | .ext_nid = NID_sinfo_access, | 98 | .ext_nid = NID_sinfo_access, |
93 | .ext_flags = X509V3_EXT_MULTILINE, | 99 | .ext_flags = X509V3_EXT_MULTILINE, |
94 | .it = &AUTHORITY_INFO_ACCESS_it, | 100 | .it = &AUTHORITY_INFO_ACCESS_it, |
@@ -105,6 +111,12 @@ const X509V3_EXT_METHOD v3_sinfo = { | |||
105 | .usr_data = NULL, | 111 | .usr_data = NULL, |
106 | }; | 112 | }; |
107 | 113 | ||
114 | const X509V3_EXT_METHOD * | ||
115 | x509v3_ext_method_sinfo_access(void) | ||
116 | { | ||
117 | return &x509v3_ext_sinfo_access; | ||
118 | } | ||
119 | |||
108 | static const ASN1_TEMPLATE ACCESS_DESCRIPTION_seq_tt[] = { | 120 | static const ASN1_TEMPLATE ACCESS_DESCRIPTION_seq_tt[] = { |
109 | { | 121 | { |
110 | .flags = 0, | 122 | .flags = 0, |