diff options
Diffstat (limited to 'src/lib/libcrypto/x509/x509_trs.c')
-rw-r--r-- | src/lib/libcrypto/x509/x509_trs.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/lib/libcrypto/x509/x509_trs.c b/src/lib/libcrypto/x509/x509_trs.c index a967edf933..23eca4927b 100644 --- a/src/lib/libcrypto/x509/x509_trs.c +++ b/src/lib/libcrypto/x509/x509_trs.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_trs.c,v 1.26 2022/11/10 16:52:19 beck Exp $ */ | 1 | /* $OpenBSD: x509_trs.c,v 1.27 2022/11/13 18:37:32 beck 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 | */ |
@@ -110,8 +110,8 @@ int | |||
110 | return oldtrust; | 110 | return oldtrust; |
111 | } | 111 | } |
112 | 112 | ||
113 | int | 113 | static int |
114 | X509_check_trust(X509 *x, int id, int flags) | 114 | X509_check_trust_internal(X509 *x, int id, int flags, int compat) |
115 | { | 115 | { |
116 | X509_TRUST *pt; | 116 | X509_TRUST *pt; |
117 | int idx; | 117 | int idx; |
@@ -132,7 +132,7 @@ X509_check_trust(X509 *x, int id, int flags) | |||
132 | rv = obj_trust(NID_anyExtendedKeyUsage, x, 0); | 132 | rv = obj_trust(NID_anyExtendedKeyUsage, x, 0); |
133 | if (rv != X509_TRUST_UNTRUSTED) | 133 | if (rv != X509_TRUST_UNTRUSTED) |
134 | return rv; | 134 | return rv; |
135 | return trust_compat(NULL, x, 0); | 135 | return compat && trust_compat(NULL, x, 0); |
136 | } | 136 | } |
137 | idx = X509_TRUST_get_by_id(id); | 137 | idx = X509_TRUST_get_by_id(id); |
138 | if (idx == -1) | 138 | if (idx == -1) |
@@ -142,6 +142,18 @@ X509_check_trust(X509 *x, int id, int flags) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | int | 144 | int |
145 | X509_check_trust(X509 *x, int id, int flags) | ||
146 | { | ||
147 | return X509_check_trust_internal(x, id, flags, /*compat =*/1); | ||
148 | } | ||
149 | |||
150 | int | ||
151 | x509_check_trust_no_compat(X509 *x, int id, int flags) | ||
152 | { | ||
153 | return X509_check_trust_internal(x, id, flags, /*compat =*/0); | ||
154 | } | ||
155 | |||
156 | int | ||
145 | X509_TRUST_get_count(void) | 157 | X509_TRUST_get_count(void) |
146 | { | 158 | { |
147 | if (!trtable) | 159 | if (!trtable) |