diff --git a/examples/protocols/https_request/main/Kconfig.projbuild b/examples/protocols/https_request/main/Kconfig.projbuild index 7b8c60d01175..60a72c61dd62 100644 --- a/examples/protocols/https_request/main/Kconfig.projbuild +++ b/examples/protocols/https_request/main/Kconfig.projbuild @@ -1,5 +1,10 @@ menu "Example Configuration" + config EXAMPLE_USING_ESP_TLS_MBEDTLS + bool + depends on ESP_TLS_USING_MBEDTLS + default y + config EXAMPLE_CLIENT_SESSION_TICKETS bool "Enable Client session ticket support" default n diff --git a/examples/protocols/https_request/main/https_request_example_main.c b/examples/protocols/https_request/main/https_request_example_main.c index 9b2981c3d289..774aa62fbe8f 100644 --- a/examples/protocols/https_request/main/https_request_example_main.c +++ b/examples/protocols/https_request/main/https_request_example_main.c @@ -40,7 +40,7 @@ #include "esp_tls.h" #include "sdkconfig.h" -#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE +#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE && CONFIG_EXAMPLE_USING_ESP_TLS_MBEDTLS #include "esp_crt_bundle.h" #endif #include "time_sync.h" @@ -84,8 +84,10 @@ extern const uint8_t server_root_cert_pem_end[] asm("_binary_server_root_cert_ extern const uint8_t local_server_cert_pem_start[] asm("_binary_local_server_cert_pem_start"); extern const uint8_t local_server_cert_pem_end[] asm("_binary_local_server_cert_pem_end"); +#if CONFIG_EXAMPLE_USING_ESP_TLS_MBEDTLS static const int server_supported_ciphersuites[] = {MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384, MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, 0}; static const int server_unsupported_ciphersuites[] = {MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256, 0}; +#endif #ifdef CONFIG_EXAMPLE_CLIENT_SESSION_TICKETS static esp_tls_client_session_t *tls_client_session = NULL; static bool save_client_session = false; @@ -173,7 +175,7 @@ static void https_get_request(esp_tls_cfg_t cfg, const char *WEB_SERVER_URL, con } } -#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE +#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE && CONFIG_EXAMPLE_USING_ESP_TLS_MBEDTLS static void https_get_request_using_crt_bundle(void) { ESP_LOGI(TAG, "https_request using crt bundle"); @@ -182,7 +184,7 @@ static void https_get_request_using_crt_bundle(void) }; https_get_request(cfg, WEB_URL, HOWSMYSSL_REQUEST); } -#endif // CONFIG_MBEDTLS_CERTIFICATE_BUNDLE +#endif // CONFIG_MBEDTLS_CERTIFICATE_BUNDLE && CONFIG_EXAMPLE_USING_ESP_TLS_MBEDTLS static void https_get_request_using_cacert_buf(void) { @@ -196,6 +198,8 @@ static void https_get_request_using_cacert_buf(void) static void https_get_request_using_specified_ciphersuites(void) { +#if CONFIG_EXAMPLE_USING_ESP_TLS_MBEDTLS + ESP_LOGI(TAG, "https_request using server supported ciphersuites"); esp_tls_cfg_t cfg = { .cacert_buf = (const unsigned char *) server_root_cert_pem_start, @@ -210,6 +214,7 @@ static void https_get_request_using_specified_ciphersuites(void) cfg.ciphersuites_list = server_unsupported_ciphersuites; https_get_request(cfg, WEB_URL, HOWSMYSSL_REQUEST); +#endif } static void https_get_request_using_global_ca_store(void) @@ -280,7 +285,7 @@ static void https_request_task(void *pvparameters) https_get_request_using_already_saved_session(server_url); #endif -#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE +#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE && CONFIG_EXAMPLE_USING_ESP_TLS_MBEDTLS https_get_request_using_crt_bundle(); #endif ESP_LOGI(TAG, "Minimum free heap size: %" PRIu32 " bytes", esp_get_minimum_free_heap_size()); diff --git a/examples/protocols/https_request/sdkconfig.defaults b/examples/protocols/https_request/sdkconfig.defaults index 4fe81b2f335c..ec3edfc8b9be 100644 --- a/examples/protocols/https_request/sdkconfig.defaults +++ b/examples/protocols/https_request/sdkconfig.defaults @@ -1,2 +1,3 @@ CONFIG_MBEDTLS_HAVE_TIME_DATE=y CONFIG_LWIP_SNTP_MAX_SERVERS=2 +CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y