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 <vincent.wan@linaro.org>
This commit is contained in:
Vincent Wan 2019-03-11 18:01:31 -07:00 committed by Kumar Gala
commit 017446ba20

View file

@ -671,8 +671,30 @@ static int simplelink_setsockopt(int sd, int level, int optname,
_SEC_DOMAIN_VERIF,
(const char *)optval, optlen);
break;
case TLS_CIPHERSUITE_LIST:
case TLS_PEER_VERIFY:
if (optval) {
/*
* Not currently supported. Verification
* is automatically performed if a CA
* certificate is set. We are returning
* success here to allow
* mqtt_client_tls_connect()
* to proceed, given it requires
* verification and it is indeed
* performed when the cert is set.
*/
if (*(u32_t *)optval != 2) {
retval = slcb_SetErrno(ENOTSUP);
goto exit;
} else {
retval = 0;
}
} else {
retval = slcb_SetErrno(EINVAL);
goto exit;
}
break;
case TLS_CIPHERSUITE_LIST:
case TLS_DTLS_ROLE:
/* Not yet supported: */
retval = slcb_SetErrno(ENOTSUP);