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_pku.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_pku.c')
-rw-r--r-- | src/lib/libcrypto/x509/x509_pku.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_pku.c b/src/lib/libcrypto/x509/x509_pku.c index 05c9ff2431..6753f0f733 100644 --- a/src/lib/libcrypto/x509/x509_pku.c +++ b/src/lib/libcrypto/x509/x509_pku.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_pku.c,v 1.4 2024/07/08 14:47:44 beck Exp $ */ | 1 | /* $OpenBSD: x509_pku.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 | */ |
@@ -65,7 +65,7 @@ | |||
65 | static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method, | 65 | static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method, |
66 | PKEY_USAGE_PERIOD *usage, BIO *out, int indent); | 66 | PKEY_USAGE_PERIOD *usage, BIO *out, int indent); |
67 | 67 | ||
68 | const X509V3_EXT_METHOD v3_pkey_usage_period = { | 68 | static const X509V3_EXT_METHOD x509v3_ext_private_key_usage_period = { |
69 | .ext_nid = NID_private_key_usage_period, | 69 | .ext_nid = NID_private_key_usage_period, |
70 | .ext_flags = 0, | 70 | .ext_flags = 0, |
71 | .it = &PKEY_USAGE_PERIOD_it, | 71 | .it = &PKEY_USAGE_PERIOD_it, |
@@ -82,6 +82,12 @@ const X509V3_EXT_METHOD v3_pkey_usage_period = { | |||
82 | .usr_data = NULL, | 82 | .usr_data = NULL, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | const X509V3_EXT_METHOD * | ||
86 | x509v3_ext_method_private_key_usage_period(void) | ||
87 | { | ||
88 | return &x509v3_ext_private_key_usage_period; | ||
89 | } | ||
90 | |||
85 | static const ASN1_TEMPLATE PKEY_USAGE_PERIOD_seq_tt[] = { | 91 | static const ASN1_TEMPLATE PKEY_USAGE_PERIOD_seq_tt[] = { |
86 | { | 92 | { |
87 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_OPTIONAL, | 93 | .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_OPTIONAL, |