Skip to content

Commit 01a0dcd

Browse files
davidbenandrewhop
authored andcommitted
Remove X509_TRUST_DEFAULT
This is only used internally, for X509_PURPOSE_ANY to mark that it has no corresponding trust value. Countrary to the name, this doesn't mean to use the default X509_TRUST behavior, but to make it impossible to configure via X509_STORE_CTX_set_purpose. Since it's only used in one place, as any value that fails lookup, I've just put a local define in v3_purp.c. Change-Id: Id3e44c08528a303132ef09d0a94521af67cc2230 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65212 Auto-Submit: David Benjamin <[email protected]> Reviewed-by: Bob Beck <[email protected]> Commit-Queue: David Benjamin <[email protected]> (cherry picked from commit 5a1a5fbdb865fa58f1da0fd8bf6426f801ea37ac)
1 parent bda01b4 commit 01a0dcd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

crypto/x509/v3_purp.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509 *x,
9494
static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca);
9595
static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca);
9696

97+
// X509_TRUST_NONE is not a valid |X509_TRUST_*| constant. It is used by
98+
// |X509_PURPOSE_ANY| to indicate that it has no corresponding trust type and
99+
// cannot be used with |X509_STORE_CTX_set_purpose|.
100+
#define X509_TRUST_NONE (-1)
101+
97102
static const X509_PURPOSE xstandard[] = {
98103
{X509_PURPOSE_SSL_CLIENT, X509_TRUST_SSL_CLIENT, 0,
99104
check_purpose_ssl_client, (char *)"SSL client", (char *)"sslclient", NULL},
@@ -109,7 +114,7 @@ static const X509_PURPOSE xstandard[] = {
109114
(char *)"smimeencrypt", NULL},
110115
{X509_PURPOSE_CRL_SIGN, X509_TRUST_COMPAT, 0, check_purpose_crl_sign,
111116
(char *)"CRL signing", (char *)"crlsign", NULL},
112-
{X509_PURPOSE_ANY, X509_TRUST_DEFAULT, 0, no_check, (char *)"Any Purpose",
117+
{X509_PURPOSE_ANY, X509_TRUST_NONE, 0, no_check, (char *)"Any Purpose",
113118
(char *)"any", NULL},
114119
{X509_PURPOSE_OCSP_HELPER, X509_TRUST_COMPAT, 0, ocsp_helper,
115120
(char *)"OCSP helper", (char *)"ocsphelper", NULL},

include/openssl/x509.h

-4
Original file line numberDiff line numberDiff line change
@@ -4407,10 +4407,6 @@ struct x509_trust_st {
44074407

44084408
DEFINE_STACK_OF(X509_TRUST)
44094409

4410-
// standard trust ids
4411-
4412-
#define X509_TRUST_DEFAULT (-1) // Only valid in purpose settings
4413-
44144410
OPENSSL_EXPORT const char *X509_get_default_cert_area(void);
44154411
OPENSSL_EXPORT const char *X509_get_default_cert_dir(void);
44164412
OPENSSL_EXPORT const char *X509_get_default_cert_file(void);

0 commit comments

Comments
 (0)