From 884b4540dc2d2475b78a824ea61d268e87af909c Mon Sep 17 00:00:00 2001 From: Chun-Chieh Li Date: Thu, 5 Dec 2024 13:44:37 +0800 Subject: [PATCH] mbedtls: fix mbed-psa link missing mbed-psa provides one mbed psa implementation which mbedtls needs to link. For example, mbedtls_hardware_poll (mbedtls mbed_trng.cpp) invokes trng_init and friends which are implemented in mbed-psa psa_hrng.c. --- connectivity/mbedtls/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/connectivity/mbedtls/CMakeLists.txt b/connectivity/mbedtls/CMakeLists.txt index 9a06fc3f156..08cbee6d4aa 100644 --- a/connectivity/mbedtls/CMakeLists.txt +++ b/connectivity/mbedtls/CMakeLists.txt @@ -117,6 +117,12 @@ target_compile_definitions(mbed-mbedtls target_link_libraries(mbed-mbedtls PUBLIC mbed-core-flags) +# Link Mbed's PSA implementation on enabled +if(("FEATURE_EXPERIMENTAL_API=1" IN_LIST MBED_TARGET_DEFINITIONS) AND + ("FEATURE_PSA=1" IN_LIST MBED_TARGET_DEFINITIONS)) + target_link_libraries(mbed-mbedtls PUBLIC mbed-psa) +endif() + # Workaround for https://github.com/ARMmbed/mbedtls/issues/1077 # which affects cores without __thumb2__ set by the compiler # due to the lack of full Thumb-2 support