Merge branch 'fix/mbedtls_enable_threading_pthread_v6.0' into 'release/v6.0'

fix(mbedtls): enable pthread threading by default (v6.0)

See merge request espressif/esp-idf!45838
This commit is contained in:
Mahavir Jain
2026-02-13 09:18:00 +05:30
9 changed files with 17 additions and 10 deletions
@@ -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;
@@ -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;
@@ -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
@@ -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
+3 -3
View File
@@ -32,7 +32,7 @@ menu "mbedTLS"
config MBEDTLS_THREADING_C
bool "Enable the threading abstraction layer"
default n
default y
help
If you do intend to use contexts between threads, you will need to enable
this layer to prevent race conditions.
@@ -40,14 +40,14 @@ menu "mbedTLS"
config MBEDTLS_THREADING_ALT
bool "Enable threading alternate implementation"
depends on MBEDTLS_THREADING_C
default y
default n
help
Enable threading alt to allow your own alternate threading implementation.
config MBEDTLS_THREADING_PTHREAD
bool "Enable threading pthread implementation"
depends on MBEDTLS_THREADING_C
default n
default y
help
Enable the pthread wrapper layer for the threading layer.
@@ -4,7 +4,7 @@
# Core Configuration
CONFIG_MBEDTLS_FS_IO=y
CONFIG_MBEDTLS_THREADING_C=n
CONFIG_MBEDTLS_THREADING_C=y
CONFIG_MBEDTLS_ERROR_STRINGS=y
CONFIG_MBEDTLS_VERSION_C=n
CONFIG_MBEDTLS_HAVE_TIME=y
@@ -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
@@ -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);