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_crld.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_crld.c')
-rw-r--r-- | src/lib/libcrypto/x509/x509_crld.c | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/src/lib/libcrypto/x509/x509_crld.c b/src/lib/libcrypto/x509/x509_crld.c index dfb5d27f65..e9252a247a 100644 --- a/src/lib/libcrypto/x509/x509_crld.c +++ b/src/lib/libcrypto/x509/x509_crld.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_crld.c,v 1.6 2024/07/08 14:47:44 beck Exp $ */ | 1 | /* $OpenBSD: x509_crld.c,v 1.7 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 | */ |
@@ -72,7 +72,7 @@ static void *v2i_crld(const X509V3_EXT_METHOD *method, | |||
72 | static int i2r_crldp(const X509V3_EXT_METHOD *method, void *pcrldp, BIO *out, | 72 | static int i2r_crldp(const X509V3_EXT_METHOD *method, void *pcrldp, BIO *out, |
73 | int indent); | 73 | int indent); |
74 | 74 | ||
75 | const X509V3_EXT_METHOD v3_crld = { | 75 | static const X509V3_EXT_METHOD x509v3_ext_crl_distribution_points = { |
76 | .ext_nid = NID_crl_distribution_points, | 76 | .ext_nid = NID_crl_distribution_points, |
77 | .ext_flags = 0, | 77 | .ext_flags = 0, |
78 | .it = &CRL_DIST_POINTS_it, | 78 | .it = &CRL_DIST_POINTS_it, |
@@ -89,7 +89,13 @@ const X509V3_EXT_METHOD v3_crld = { | |||
89 | .usr_data = NULL, | 89 | .usr_data = NULL, |
90 | }; | 90 | }; |
91 | 91 | ||
92 | const X509V3_EXT_METHOD v3_freshest_crl = { | 92 | const X509V3_EXT_METHOD * |
93 | x509v3_ext_method_crl_distribution_points(void) | ||
94 | { | ||
95 | return &x509v3_ext_crl_distribution_points; | ||
96 | } | ||
97 | |||
98 | static const X509V3_EXT_METHOD x509v3_ext_freshest_crl = { | ||
93 | .ext_nid = NID_freshest_crl, | 99 | .ext_nid = NID_freshest_crl, |
94 | .ext_flags = 0, | 100 | .ext_flags = 0, |
95 | .it = &CRL_DIST_POINTS_it, | 101 | .it = &CRL_DIST_POINTS_it, |
@@ -106,6 +112,12 @@ const X509V3_EXT_METHOD v3_freshest_crl = { | |||
106 | .usr_data = NULL, | 112 | .usr_data = NULL, |
107 | }; | 113 | }; |
108 | 114 | ||
115 | const X509V3_EXT_METHOD * | ||
116 | x509v3_ext_method_freshest_crl(void) | ||
117 | { | ||
118 | return &x509v3_ext_freshest_crl; | ||
119 | } | ||
120 | |||
109 | static STACK_OF(GENERAL_NAME) * | 121 | static STACK_OF(GENERAL_NAME) * |
110 | gnames_from_sectname(X509V3_CTX *ctx, char *sect) | 122 | gnames_from_sectname(X509V3_CTX *ctx, char *sect) |
111 | { | 123 | { |
@@ -655,17 +667,29 @@ static int i2r_idp(const X509V3_EXT_METHOD *method, void *pidp, BIO *out, | |||
655 | static void *v2i_idp(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | 667 | static void *v2i_idp(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, |
656 | STACK_OF(CONF_VALUE) *nval); | 668 | STACK_OF(CONF_VALUE) *nval); |
657 | 669 | ||
658 | const X509V3_EXT_METHOD v3_idp = { | 670 | static const X509V3_EXT_METHOD x509v3_ext_issuing_distribution_point = { |
659 | NID_issuing_distribution_point, X509V3_EXT_MULTILINE, | 671 | .ext_nid = NID_issuing_distribution_point, |
660 | &ISSUING_DIST_POINT_it, | 672 | .ext_flags = X509V3_EXT_MULTILINE, |
661 | 0, 0, 0, 0, | 673 | .it = &ISSUING_DIST_POINT_it, |
662 | 0, 0, | 674 | .ext_new = NULL, |
663 | 0, | 675 | .ext_free = NULL, |
664 | v2i_idp, | 676 | .d2i = NULL, |
665 | i2r_idp, 0, | 677 | .i2d = NULL, |
666 | NULL | 678 | .i2s = NULL, |
679 | .s2i = NULL, | ||
680 | .i2v = NULL, | ||
681 | .v2i = v2i_idp, | ||
682 | .i2r = i2r_idp, | ||
683 | .r2i = NULL, | ||
684 | .usr_data = NULL, | ||
667 | }; | 685 | }; |
668 | 686 | ||
687 | const X509V3_EXT_METHOD * | ||
688 | x509v3_ext_method_issuing_distribution_point(void) | ||
689 | { | ||
690 | return &x509v3_ext_issuing_distribution_point; | ||
691 | } | ||
692 | |||
669 | static void * | 693 | static void * |
670 | v2i_idp(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | 694 | v2i_idp(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, |
671 | STACK_OF(CONF_VALUE) *nval) | 695 | STACK_OF(CONF_VALUE) *nval) |