mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Add checks to for CONFIG_MBEDTLS_SSL_ALPN
Merges https://github.com/espressif/esp-idf/pull/2569
This commit is contained in:
parent
b5c58557fc
commit
0c9f7271a9
@ -236,6 +236,7 @@ IoT_Error_t iot_tls_connect(Network *pNetwork, TLSConnectParams *params) {
|
||||
|
||||
mbedtls_ssl_conf_read_timeout(&(tlsDataParams->conf), pNetwork->tlsConnectParams.timeout_ms);
|
||||
|
||||
#ifdef CONFIG_MBEDTLS_SSL_ALPN
|
||||
/* Use the AWS IoT ALPN extension for MQTT, if port 443 is requested */
|
||||
if (pNetwork->tlsConnectParams.DestinationPort == 443) {
|
||||
const char *alpnProtocols[] = { "x-amzn-mqtt-ca", NULL };
|
||||
@ -244,6 +245,7 @@ IoT_Error_t iot_tls_connect(Network *pNetwork, TLSConnectParams *params) {
|
||||
return SSL_CONNECTION_ERROR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if((ret = mbedtls_ssl_setup(&(tlsDataParams->ssl), &(tlsDataParams->conf))) != 0) {
|
||||
ESP_LOGE(TAG, "failed! mbedtls_ssl_setup returned -0x%x", -ret);
|
||||
|
@ -252,9 +252,11 @@ static int create_ssl_handle(esp_tls_t *tls, const char *hostname, size_t hostle
|
||||
goto exit;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MBEDTLS_SSL_ALPN
|
||||
if (cfg->alpn_protos) {
|
||||
mbedtls_ssl_conf_alpn_protocols(&tls->conf, cfg->alpn_protos);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (cfg->use_global_ca_store == true) {
|
||||
if (global_cacert == NULL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user