SecPathBuilderSetCheckRevocationOnline(pvc->builder);
}
+static void SecPolicyCheckRevocationIfTrusted(SecPVCRef pvc, CFStringRef key) {
+ SecPathBuilderSetCheckRevocationIfTrusted(pvc->builder);
+}
+
static void SecPolicyCheckNoNetworkAccess(SecPVCRef pvc,
CFStringRef key) {
SecPolicyRef policy = SecPVCGetPolicy(pvc);
for (policyIX = 0; policyIX < policyCount; ++policyIX) {
SecPolicyRef policy = (SecPolicyRef)CFArrayGetValueAtIndex(policies, policyIX);
CFStringRef policyName = SecPolicyGetName(policy);
- if (CFEqualSafe(policyName, CFSTR("sslServer"))) {
+ if (CFEqualSafe(policyName, kSecPolicyNameSSLServer)) {
/* policy required pinning, but we didn't use a pinning policy */
if (!SecPVCSetResult(pvc, key, 0, kCFBooleanFalse)) {
return;
}
}
+static bool SecPVCIsSSLServerAuthenticationPolicy(SecPVCRef pvc) {
+ if (!pvc || !pvc->policies) {
+ return false;
+ }
+ SecPolicyRef policy = (SecPolicyRef)CFArrayGetValueAtIndex(pvc->policies, 0);
+ if (!policy) {
+ return false;
+ }
+ CFStringRef policyName = SecPolicyGetName(policy);
+ if (CFEqualSafe(policyName, kSecPolicyNameSSLServer)) {
+ return true;
+ }
+ CFDictionaryRef options = policy->_options;
+ if (options && CFDictionaryGetValue(options, kSecPolicyCheckSSLHostname)) {
+ return true;
+ }
+ return false;
+}
+
/* AUDIT[securityd](done):
policy->_options is a caller provided dictionary, only its cf type has
been checked.
/* Check that this path meets CT constraints. */
if (!SecCertificatePathVCIsCT(path)) {
SecPathCTPolicy ctp = SecCertificatePathVCRequiresCT(path);
- if (ctp > kSecPathCTNotRequired) {
+ if (ctp > kSecPathCTNotRequired && SecPVCIsSSLServerAuthenticationPolicy(pvc)) {
/* CT was required. Error is always set on leaf certificate. */
SecPVCSetResultForced(pvc, kSecPolicyCheckCTRequired,
0, kCFBooleanFalse, true);