Merge branch 'feature/config_option_for_mbedtls_debug_level' into 'master'

mbedtls: add config option for setting debug level

See merge request idf/esp-idf!5154
This commit is contained in:
Mahavir Jain 2019-06-10 11:44:40 +08:00
commit bb4ca8c508
3 changed files with 27 additions and 3 deletions

View File

@ -327,7 +327,7 @@ static int create_ssl_handle(esp_tls_t *tls, const char *hostname, size_t hostle
mbedtls_ssl_conf_rng(&tls->conf, mbedtls_ctr_drbg_random, &tls->ctr_drbg);
#ifdef CONFIG_MBEDTLS_DEBUG
mbedtls_esp_enable_debug_log(&tls->conf, 4);
mbedtls_esp_enable_debug_log(&tls->conf, CONFIG_MBEDTLS_DEBUG_LEVEL);
#endif
if ((ret = mbedtls_ssl_setup(&tls->ssl, &tls->conf)) != 0) {
@ -555,4 +555,4 @@ int esp_tls_conn_http_new_async(const char *url, const esp_tls_cfg_t *cfg, esp_t
/* Connect to host */
return esp_tls_conn_new_async(&url[u.field_data[UF_HOST].off], u.field_data[UF_HOST].len,
get_port(url, &u), cfg, tls);
}
}

View File

@ -92,6 +92,30 @@ menu "mbedTLS"
at runtime in order to enable mbedTLS debug output via the ESP
log mechanism.
choice MBEDTLS_DEBUG_LEVEL
bool "Set mbedTLS debugging level"
depends on MBEDTLS_DEBUG
default MBEDTLS_DEBUG_LEVEL_VERBOSE
help
Set mbedTLS debugging level
config MBEDTLS_DEBUG_LEVEL_WARN
bool "Warning"
config MBEDTLS_DEBUG_LEVEL_INFO
bool "Info"
config MBEDTLS_DEBUG_LEVEL_DEBUG
bool "Debug"
config MBEDTLS_DEBUG_LEVEL_VERBOSE
bool "Verbose"
endchoice
config MBEDTLS_DEBUG_LEVEL
int
default 1 if MBEDTLS_DEBUG_LEVEL_WARN
default 2 if MBEDTLS_DEBUG_LEVEL_INFO
default 3 if MBEDTLS_DEBUG_LEVEL_DEBUG
default 4 if MBEDTLS_DEBUG_LEVEL_VERBOSE
config MBEDTLS_HARDWARE_AES
bool "Enable hardware AES acceleration"
default y

View File

@ -142,7 +142,7 @@ static void https_get_task(void *pvParameters)
mbedtls_ssl_conf_ca_chain(&conf, &cacert, NULL);
mbedtls_ssl_conf_rng(&conf, mbedtls_ctr_drbg_random, &ctr_drbg);
#ifdef CONFIG_MBEDTLS_DEBUG
mbedtls_esp_enable_debug_log(&conf, 4);
mbedtls_esp_enable_debug_log(&conf, CONFIG_MBEDTLS_DEBUG_LEVEL);
#endif
if ((ret = mbedtls_ssl_setup(&ssl, &conf)) != 0)