From 0b6843f2edf4962018832b9f47e637be0cb8e5ac 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/mbedtls/esp_tee/esp_tee_mbedtls_config.h | 3 +++ components/mbedtls/test_apps/include/crypto_performance.h | 4 ++-- components/mbedtls/test_apps/main/test_sha_perf.c | 3 ++- 5 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 a96613c4cc..88d3ed123f 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 4f455aa8e4..23b373738c 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/mbedtls/esp_tee/esp_tee_mbedtls_config.h b/components/mbedtls/esp_tee/esp_tee_mbedtls_config.h index 8a333c814d..2cd6c33b09 100644 --- a/components/mbedtls/esp_tee/esp_tee_mbedtls_config.h +++ b/components/mbedtls/esp_tee/esp_tee_mbedtls_config.h @@ -190,3 +190,6 @@ #undef PSA_WANT_ALG_TLS12_PRF #undef PSA_WANT_ALG_PBKDF2_HMAC #undef PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 + +/* ESP-TEE is single threaded so we can disable threading in mbedTLS */ +#undef MBEDTLS_THREADING_C diff --git a/components/mbedtls/test_apps/include/crypto_performance.h b/components/mbedtls/test_apps/include/crypto_performance.h index c4c2bde579..ffef876ffc 100644 --- a/components/mbedtls/test_apps/include/crypto_performance.h +++ b/components/mbedtls/test_apps/include/crypto_performance.h @@ -22,7 +22,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 @@ -40,7 +40,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/test_apps/main/test_sha_perf.c b/components/mbedtls/test_apps/main/test_sha_perf.c index 7d70c6e05f..0cde845011 100644 --- a/components/mbedtls/test_apps/main/test_sha_perf.c +++ b/components/mbedtls/test_apps/main/test_sha_perf.c @@ -38,7 +38,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); @@ -47,6 +47,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);