summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2023-04-21 06:11:57 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2023-04-21 06:11:57 +0000
commit59f68df7df120e226545e997a763b33041c79e8c (patch)
treea523622a84ca1dfb59d08344b7aea422ec50e341
parent56a91a24534cf89727ffd1d31d53b3e44bb8f17b (diff)
Move the CRL reason method into x509_bitst.c
The CRL extension handler is completely misplaced in x509_enum.c. Move it to x509_bitst.c until we find a better home for it. This way it is next to the other two extension methods that have the extra usr_data contortion.
-rw-r--r--lib/libcrypto/x509/x509_bitst.c33
-rw-r--r--lib/libcrypto/x509/x509_enum.c33
2 files changed, 33 insertions, 33 deletions
diff --git a/lib/libcrypto/x509/x509_bitst.c b/lib/libcrypto/x509/x509_bitst.c
index cacbe8efe7c..97c630d8b71 100644
--- a/lib/libcrypto/x509/x509_bitst.c
+++ b/lib/libcrypto/x509/x509_bitst.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_bitst.c,v 1.3 2023/02/16 08:38:17 tb Exp $ */
+/* $OpenBSD: x509_bitst.c,v 1.4 2023/04/21 06:11:56 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
@@ -88,6 +88,20 @@ static BIT_STRING_BITNAME key_usage_type_table[] = {
{-1, NULL, NULL}
};
+static BIT_STRING_BITNAME crl_reasons[] = {
+ {CRL_REASON_UNSPECIFIED, "Unspecified", "unspecified"},
+ {CRL_REASON_KEY_COMPROMISE, "Key Compromise", "keyCompromise"},
+ {CRL_REASON_CA_COMPROMISE, "CA Compromise", "CACompromise"},
+ {CRL_REASON_AFFILIATION_CHANGED, "Affiliation Changed", "affiliationChanged"},
+ {CRL_REASON_SUPERSEDED, "Superseded", "superseded"},
+ {CRL_REASON_CESSATION_OF_OPERATION, "Cessation Of Operation", "cessationOfOperation"},
+ {CRL_REASON_CERTIFICATE_HOLD, "Certificate Hold", "certificateHold"},
+ {CRL_REASON_REMOVE_FROM_CRL, "Remove From CRL", "removeFromCRL"},
+ {CRL_REASON_PRIVILEGE_WITHDRAWN, "Privilege Withdrawn", "privilegeWithdrawn"},
+ {CRL_REASON_AA_COMPROMISE, "AA Compromise", "AACompromise"},
+ {-1, NULL, NULL}
+};
+
const X509V3_EXT_METHOD v3_nscert = {
.ext_nid = NID_netscape_cert_type,
.ext_flags = 0,
@@ -122,6 +136,23 @@ const X509V3_EXT_METHOD v3_key_usage = {
.usr_data = key_usage_type_table,
};
+const X509V3_EXT_METHOD v3_crl_reason = {
+ .ext_nid = NID_crl_reason,
+ .ext_flags = 0,
+ .it = &ASN1_ENUMERATED_it,
+ .ext_new = NULL,
+ .ext_free = NULL,
+ .d2i = NULL,
+ .i2d = NULL,
+ .i2s = (X509V3_EXT_I2S)i2s_ASN1_ENUMERATED_TABLE,
+ .s2i = NULL,
+ .i2v = NULL,
+ .v2i = NULL,
+ .i2r = NULL,
+ .r2i = NULL,
+ .usr_data = crl_reasons,
+};
+
STACK_OF(CONF_VALUE) *
i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, ASN1_BIT_STRING *bits,
STACK_OF(CONF_VALUE) *ret)
diff --git a/lib/libcrypto/x509/x509_enum.c b/lib/libcrypto/x509/x509_enum.c
index 0f3bfea4c74..9e8a29155a4 100644
--- a/lib/libcrypto/x509/x509_enum.c
+++ b/lib/libcrypto/x509/x509_enum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_enum.c,v 1.6 2023/04/21 06:07:10 tb Exp $ */
+/* $OpenBSD: x509_enum.c,v 1.7 2023/04/21 06:11:56 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
@@ -61,34 +61,3 @@
#include <openssl/asn1.h>
#include <openssl/x509v3.h>
-
-static BIT_STRING_BITNAME crl_reasons[] = {
- {CRL_REASON_UNSPECIFIED, "Unspecified", "unspecified"},
- {CRL_REASON_KEY_COMPROMISE, "Key Compromise", "keyCompromise"},
- {CRL_REASON_CA_COMPROMISE, "CA Compromise", "CACompromise"},
- {CRL_REASON_AFFILIATION_CHANGED, "Affiliation Changed", "affiliationChanged"},
- {CRL_REASON_SUPERSEDED, "Superseded", "superseded"},
- {CRL_REASON_CESSATION_OF_OPERATION, "Cessation Of Operation", "cessationOfOperation"},
- {CRL_REASON_CERTIFICATE_HOLD, "Certificate Hold", "certificateHold"},
- {CRL_REASON_REMOVE_FROM_CRL, "Remove From CRL", "removeFromCRL"},
- {CRL_REASON_PRIVILEGE_WITHDRAWN, "Privilege Withdrawn", "privilegeWithdrawn"},
- {CRL_REASON_AA_COMPROMISE, "AA Compromise", "AACompromise"},
- {-1, NULL, NULL}
-};
-
-const X509V3_EXT_METHOD v3_crl_reason = {
- .ext_nid = NID_crl_reason,
- .ext_flags = 0,
- .it = &ASN1_ENUMERATED_it,
- .ext_new = NULL,
- .ext_free = NULL,
- .d2i = NULL,
- .i2d = NULL,
- .i2s = (X509V3_EXT_I2S)i2s_ASN1_ENUMERATED_TABLE,
- .s2i = NULL,
- .i2v = NULL,
- .v2i = NULL,
- .i2r = NULL,
- .r2i = NULL,
- .usr_data = crl_reasons,
-};