Skip to content

Commit 017446b

Browse files
vantigalak
authored andcommitted
drivers: wifi: simplelink: Return success when TLS_PEER_VERIFY is set
mqtt_client_tls_connect() calls setsockopt() to set the TLS_PEER_VERIFY option to require verfication. To enable mqtt, we need to return success at a minimum when this option is set to 2. Signed-off-by: Vincent Wan <[email protected]>
1 parent 7816827 commit 017446b

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

drivers/wifi/simplelink/simplelink_sockets.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,30 @@ static int simplelink_setsockopt(int sd, int level, int optname,
671671
_SEC_DOMAIN_VERIF,
672672
(const char *)optval, optlen);
673673
break;
674-
case TLS_CIPHERSUITE_LIST:
675674
case TLS_PEER_VERIFY:
675+
if (optval) {
676+
/*
677+
* Not currently supported. Verification
678+
* is automatically performed if a CA
679+
* certificate is set. We are returning
680+
* success here to allow
681+
* mqtt_client_tls_connect()
682+
* to proceed, given it requires
683+
* verification and it is indeed
684+
* performed when the cert is set.
685+
*/
686+
if (*(u32_t *)optval != 2) {
687+
retval = slcb_SetErrno(ENOTSUP);
688+
goto exit;
689+
} else {
690+
retval = 0;
691+
}
692+
} else {
693+
retval = slcb_SetErrno(EINVAL);
694+
goto exit;
695+
}
696+
break;
697+
case TLS_CIPHERSUITE_LIST:
676698
case TLS_DTLS_ROLE:
677699
/* Not yet supported: */
678700
retval = slcb_SetErrno(ENOTSUP);

0 commit comments

Comments
 (0)