diff --git a/components/mbedtls/mbedtls b/components/mbedtls/mbedtls index 99c88bb7bd..6465247f67 160000 --- a/components/mbedtls/mbedtls +++ b/components/mbedtls/mbedtls @@ -1 +1 @@ -Subproject commit 99c88bb7bd7c2d91c6873abd6e6d5ee04f4f164c +Subproject commit 6465247f67167518b8813ae2faaf422704e4b1a3 diff --git a/components/mbedtls/test/test_esp_crt_bundle.c b/components/mbedtls/test/test_esp_crt_bundle.c index 9d7e7803d8..af70e523ce 100644 --- a/components/mbedtls/test/test_esp_crt_bundle.c +++ b/components/mbedtls/test/test_esp_crt_bundle.c @@ -165,6 +165,9 @@ void server_task(void *pvParameters) goto exit; } + /* Signal that server is up and hence client task can start now */ + xSemaphoreGive(*sema); + bool connected = false; while (!exit_flag) { @@ -269,8 +272,6 @@ int client_task(const uint8_t *bundle, esp_crt_validate_res_t *res) esp_crt_bundle_set(bundle); } - - ESP_LOGI(TAG, "Connecting to %s:%s...", SERVER_ADDRESS, SERVER_PORT); if ((ret = mbedtls_net_connect(&client.client_fd, SERVER_ADDRESS, SERVER_PORT, MBEDTLS_NET_PROTO_TCP)) != 0) { ESP_LOGE(TAG, "mbedtls_net_connect returned -%x", -ret); @@ -315,13 +316,16 @@ TEST_CASE("custom certificate bundle", "[mbedtls]") test_case_uses_tcpip(); - xSemaphoreHandle exit_sema = xSemaphoreCreateBinary(); + xSemaphoreHandle signal_sem = xSemaphoreCreateBinary(); + TEST_ASSERT_NOT_NULL(signal_sem); exit_flag = false; - xTaskCreate(server_task, "server task", 8192, &exit_sema, 10, NULL); + xTaskCreate(server_task, "server task", 8192, &signal_sem, 10, NULL); // Wait for the server to start up - vTaskDelay(100 / portTICK_PERIOD_MS); + if (!xSemaphoreTake(signal_sem, 10000 / portTICK_PERIOD_MS)) { + TEST_FAIL_MESSAGE("signal_sem not released, server start failed"); + } /* Test with default crt bundle that doesnt contain the ca crt */ client_task(NULL, &validate_res); @@ -333,11 +337,11 @@ TEST_CASE("custom certificate bundle", "[mbedtls]") exit_flag = true; - if (!xSemaphoreTake(exit_sema, 10000 / portTICK_PERIOD_MS)) { - TEST_FAIL_MESSAGE("exit_sem not released by server task"); + if (!xSemaphoreTake(signal_sem, 10000 / portTICK_PERIOD_MS)) { + TEST_FAIL_MESSAGE("signal_sem not released, server exit failed"); } - vSemaphoreDelete(exit_sema); + vSemaphoreDelete(signal_sem); } TEST_CASE("custom certificate bundle - weak hash", "[mbedtls]")