esp_tls_wolfssl : Add domain name check

This commit is contained in:
Aditya Patwardhan 2020-12-23 13:32:30 +05:30
parent 788e9fa49a
commit 39b446f9fe

View File

@ -241,8 +241,8 @@ static esp_err_t set_client_config(const char *hostname, size_t hostlen, esp_tls
return ESP_ERR_NO_MEM;
}
/* Hostname set here should match CN in server certificate */
if ((ret = wolfSSL_set_tlsext_host_name( (WOLFSSL *)tls->priv_ssl, use_host))!= WOLFSSL_SUCCESS) {
ESP_LOGE(TAG, "wolfSSL_set_tlsext_host_name returned -0x%x", -ret);
if ((ret = (wolfSSL_check_domain_name( (WOLFSSL *)tls->priv_ssl, use_host))) != WOLFSSL_SUCCESS) {
ESP_LOGE(TAG, "wolfSSL_check_domain_name returned -0x%x", -ret);
ESP_INT_EVENT_TRACKER_CAPTURE(tls->error_handle, ESP_TLS_ERR_TYPE_WOLFSSL, -ret);
free(use_host);
return ESP_ERR_WOLFSSL_SSL_SET_HOSTNAME_FAILED;