From 45f5e5da1235b13220599fa04b7a648f29db80c3 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Sat, 13 Jan 2024 18:32:33 -0500 Subject: [PATCH] Move CRL_REASON_* back to x509v3.h strongswan defines conflicting symbols and has been relying on them only being defined in . Defining the constants in would break strongswan, so move them back for now. Long term, we would like for new code to only need , so I've left a TODO to introduce properly namespaced versions of these constants and, separately, see if we can fix strongswan to similarly avoid the conflict. Between OpenSSL, strongswan, and wincrypt.h all defining these constants, it seems best for everyone to just avoid them going forward. Change-Id: I23ce4c5013a80a831e0dc74fda8623027017190c Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65387 Commit-Queue: Bob Beck Auto-Submit: David Benjamin Reviewed-by: Bob Beck Commit-Queue: David Benjamin --- crypto/x509/v3_enum.c | 1 + crypto/x509/x_crl.c | 1 + include/openssl/x509.h | 12 ------------ include/openssl/x509v3.h | 24 ++++++++++++++++++++++++ 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/crypto/x509/v3_enum.c b/crypto/x509/v3_enum.c index 3efbca52b..e24fc6b32 100644 --- a/crypto/x509/v3_enum.c +++ b/crypto/x509/v3_enum.c @@ -59,6 +59,7 @@ #include #include #include +#include #include "internal.h" diff --git a/crypto/x509/x_crl.c b/crypto/x509/x_crl.c index 76b74e926..758fccb7b 100644 --- a/crypto/x509/x_crl.c +++ b/crypto/x509/x_crl.c @@ -63,6 +63,7 @@ #include #include #include +#include #include diff --git a/include/openssl/x509.h b/include/openssl/x509.h index 099d5ef82..90bd7ec1b 100644 --- a/include/openssl/x509.h +++ b/include/openssl/x509.h @@ -4245,18 +4245,6 @@ typedef struct DIST_POINT_NAME_st { // All existing reasons #define CRLDP_ALL_REASONS 0x807f -#define CRL_REASON_NONE (-1) -#define CRL_REASON_UNSPECIFIED 0 -#define CRL_REASON_KEY_COMPROMISE 1 -#define CRL_REASON_CA_COMPROMISE 2 -#define CRL_REASON_AFFILIATION_CHANGED 3 -#define CRL_REASON_SUPERSEDED 4 -#define CRL_REASON_CESSATION_OF_OPERATION 5 -#define CRL_REASON_CERTIFICATE_HOLD 6 -#define CRL_REASON_REMOVE_FROM_CRL 8 -#define CRL_REASON_PRIVILEGE_WITHDRAWN 9 -#define CRL_REASON_AA_COMPROMISE 10 - struct DIST_POINT_st { DIST_POINT_NAME *distpoint; ASN1_BIT_STRING *reasons; diff --git a/include/openssl/x509v3.h b/include/openssl/x509v3.h index 80edd940e..fef070302 100644 --- a/include/openssl/x509v3.h +++ b/include/openssl/x509v3.h @@ -20,6 +20,30 @@ // However, due to conflicts, some deprecated symbols are defined here. #include + +// CRL reason constants. + +// TODO(davidben): These constants live here because strongswan defines +// conflicting symbols and has been relying on them only being defined in +// . Defining the constants in would break +// strongswan, but we would also like for new code to only need +// . Introduce properly namespaced versions of these constants +// and, separately, see if we can fix strongswan to similarly avoid the +// conflict. Between OpenSSL, strongswan, and wincrypt.h all defining these +// constants, it seems best for everyone to just avoid them going forward. +#define CRL_REASON_NONE (-1) +#define CRL_REASON_UNSPECIFIED 0 +#define CRL_REASON_KEY_COMPROMISE 1 +#define CRL_REASON_CA_COMPROMISE 2 +#define CRL_REASON_AFFILIATION_CHANGED 3 +#define CRL_REASON_SUPERSEDED 4 +#define CRL_REASON_CESSATION_OF_OPERATION 5 +#define CRL_REASON_CERTIFICATE_HOLD 6 +#define CRL_REASON_REMOVE_FROM_CRL 8 +#define CRL_REASON_PRIVILEGE_WITHDRAWN 9 +#define CRL_REASON_AA_COMPROMISE 10 + + // Deprecated constants. // The following constants are legacy aliases for |X509v3_KU_*|. They are