summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509/x509_pcons.c
diff options
context:
space:
mode:
authortb <>2024-07-13 15:08:58 +0000
committertb <>2024-07-13 15:08:58 +0000
commitde05eb4f597b95fed408db9aa9e9474eb6daf5e6 (patch)
tree9bceb8f53165bf9b9a2232987ecac3565db027df /src/lib/libcrypto/x509/x509_pcons.c
parentd694a3319273a6e59cc84d958713e0342bfc206d (diff)
downloadopenbsd-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_pcons.c')
-rw-r--r--src/lib/libcrypto/x509/x509_pcons.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_pcons.c b/src/lib/libcrypto/x509/x509_pcons.c
index 8f2109eaad..d6ee9d7e2c 100644
--- a/src/lib/libcrypto/x509/x509_pcons.c
+++ b/src/lib/libcrypto/x509/x509_pcons.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_pcons.c,v 1.4 2024/07/08 14:47:44 beck Exp $ */ 1/* $OpenBSD: x509_pcons.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. 3 * project.
4 */ 4 */
@@ -71,7 +71,7 @@ i2v_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD *method, void *bcons,
71static void *v2i_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD *method, 71static void *v2i_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD *method,
72 X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *values); 72 X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *values);
73 73
74const X509V3_EXT_METHOD v3_policy_constraints = { 74static const X509V3_EXT_METHOD x509v3_ext_policy_constraints = {
75 .ext_nid = NID_policy_constraints, 75 .ext_nid = NID_policy_constraints,
76 .ext_flags = 0, 76 .ext_flags = 0,
77 .it = &POLICY_CONSTRAINTS_it, 77 .it = &POLICY_CONSTRAINTS_it,
@@ -88,6 +88,12 @@ const X509V3_EXT_METHOD v3_policy_constraints = {
88 .usr_data = NULL, 88 .usr_data = NULL,
89}; 89};
90 90
91const X509V3_EXT_METHOD *
92x509v3_ext_method_policy_constraints(void)
93{
94 return &x509v3_ext_policy_constraints;
95}
96
91static const ASN1_TEMPLATE POLICY_CONSTRAINTS_seq_tt[] = { 97static const ASN1_TEMPLATE POLICY_CONSTRAINTS_seq_tt[] = {
92 { 98 {
93 .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_OPTIONAL, 99 .flags = ASN1_TFLG_IMPLICIT | ASN1_TFLG_OPTIONAL,