From cb91021678700aee109be2ae6fc74f70ceb2318e Mon Sep 17 00:00:00 2001 From: Ashish Sharma Date: Wed, 11 Feb 2026 17:39:43 +0800 Subject: [PATCH] fix(mbedtls): updates crypto performance numbers --- components/esp_wifi/test_apps/wifi_connect/main/app_main.c | 2 +- components/esp_wifi/test_apps/wifi_nvs_config/main/app_main.c | 2 +- components/idf_test/include/esp32/idf_performance_target.h | 2 +- components/idf_test/include/esp32s2/idf_performance_target.h | 2 +- components/mbedtls/esp_tee/esp_tee_mbedtls_config.h | 3 +++ components/mbedtls/test_apps/main/test_sha_perf.c | 3 ++- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/components/esp_wifi/test_apps/wifi_connect/main/app_main.c b/components/esp_wifi/test_apps/wifi_connect/main/app_main.c index a96613c4cce..88d3ed123f3 100644 --- a/components/esp_wifi/test_apps/wifi_connect/main/app_main.c +++ b/components/esp_wifi/test_apps/wifi_connect/main/app_main.c @@ -13,7 +13,7 @@ #include "esp_heap_caps.h" // Some resources are lazy allocated in wifi and lwip -#define TEST_MEMORY_LEAK_THRESHOLD (-1596) +#define TEST_MEMORY_LEAK_THRESHOLD (-1896) static size_t before_free_8bit; static size_t before_free_32bit; diff --git a/components/esp_wifi/test_apps/wifi_nvs_config/main/app_main.c b/components/esp_wifi/test_apps/wifi_nvs_config/main/app_main.c index 4f455aa8e4f..23b373738cf 100644 --- a/components/esp_wifi/test_apps/wifi_nvs_config/main/app_main.c +++ b/components/esp_wifi/test_apps/wifi_nvs_config/main/app_main.c @@ -16,7 +16,7 @@ // #define TEST_MEMORY_LEAK_THRESHOLD (-1546) // With PSA Migration, there is an increase in memory usage. // TODO: Check why this is happening and fix it. -#define TEST_MEMORY_LEAK_THRESHOLD (-1750) +#define TEST_MEMORY_LEAK_THRESHOLD (-1850) static size_t before_free_8bit; static size_t before_free_32bit; diff --git a/components/idf_test/include/esp32/idf_performance_target.h b/components/idf_test/include/esp32/idf_performance_target.h index 9f39fefe9c8..c14f04df94a 100644 --- a/components/idf_test/include/esp32/idf_performance_target.h +++ b/components/idf_test/include/esp32/idf_performance_target.h @@ -21,7 +21,7 @@ #define IDF_PERFORMANCE_MAX_TIME_SHA1_32KB 5000 #define IDF_PERFORMANCE_MAX_TIME_SHA512_32KB 4500 -#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 19000 +#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 21500 #define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 750000 #define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 33000 #define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 950000 diff --git a/components/idf_test/include/esp32s2/idf_performance_target.h b/components/idf_test/include/esp32s2/idf_performance_target.h index 1ef64601a7b..3895361dee7 100644 --- a/components/idf_test/include/esp32s2/idf_performance_target.h +++ b/components/idf_test/include/esp32s2/idf_performance_target.h @@ -16,7 +16,7 @@ #define IDF_PERFORMANCE_MAX_TIME_SHA1_32KB 900 #define IDF_PERFORMANCE_MAX_TIME_SHA512_32KB 900 -#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 15500 +#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 17000 #define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 650000 #define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 36000 #define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 960000 diff --git a/components/mbedtls/esp_tee/esp_tee_mbedtls_config.h b/components/mbedtls/esp_tee/esp_tee_mbedtls_config.h index 563ab82f64a..38ce68da37d 100644 --- a/components/mbedtls/esp_tee/esp_tee_mbedtls_config.h +++ b/components/mbedtls/esp_tee/esp_tee_mbedtls_config.h @@ -187,3 +187,6 @@ #if SOC_AES_SUPPORTED #define MBEDTLS_AES_FEWER_TABLES #endif + +/* ESP-TEE is single threaded so we can disable threading in mbedTLS */ +#undef MBEDTLS_THREADING_C diff --git a/components/mbedtls/test_apps/main/test_sha_perf.c b/components/mbedtls/test_apps/main/test_sha_perf.c index 53ba6078728..14061f39b3e 100644 --- a/components/mbedtls/test_apps/main/test_sha_perf.c +++ b/components/mbedtls/test_apps/main/test_sha_perf.c @@ -37,7 +37,7 @@ TEST_CASE("psa SHA256 performance", "[mbedtls]") TEST_ASSERT_NOT_NULL(buf); memset(buf, 0x55, CALL_SZ); - ccomp_timer_start(); + TEST_ESP_OK(ccomp_timer_start()); for (int c = 0; c < CALLS; c++) { status = psa_hash_update(&operation, buf, CALL_SZ); TEST_ASSERT_EQUAL(PSA_SUCCESS, status); @@ -46,6 +46,7 @@ TEST_CASE("psa SHA256 performance", "[mbedtls]") status = psa_hash_finish(&operation, sha256, sizeof(sha256), &hash_length); TEST_ASSERT_EQUAL(PSA_SUCCESS, status); elapsed_usec = ccomp_timer_stop(); + TEST_ASSERT_GREATER_THAN(0, elapsed_usec); free(buf);