Skip to content

Commit f82878b

Browse files
committed
ANCV: support server-side policy creation
1 parent b93751a commit f82878b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/internal.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42028,12 +42028,17 @@ static int DoAppleNativeCertValidation(WOLFSSL* ssl,
4202842028
kCFAllocatorDefault, (const char*)ssl->buffers.domainName.buffer,
4202942029
kCFStringEncodingUTF8);
4203042030
}
42031-
if (hostname != NULL) {
42032-
policy = SecPolicyCreateSSL(true, hostname);
42033-
}
42034-
else {
42035-
policy = SecPolicyCreateSSL(true, NULL);
42031+
42032+
/* If we're the client, we're validating the server's cert - use server
42033+
* policy (true). If we're the server, we're validating the client's cert -
42034+
* use client policy (false). Hostname validation only applies to server
42035+
* certs. */
42036+
{
42037+
int isServerCert = (ssl->options.side == WOLFSSL_CLIENT_END);
42038+
policy = SecPolicyCreateSSL(isServerCert,
42039+
isServerCert ? hostname : NULL);
4203642040
}
42041+
4203742042
status = SecTrustCreateWithCertificates(certArray, policy, &trust);
4203842043
if (status != errSecSuccess) {
4203942044
WOLFSSL_MSG_EX("Error creating trust object, "

0 commit comments

Comments
 (0)