File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff 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, "
You can’t perform that action at this time.
0 commit comments