From a2de1ca576e3a00e39956ad78ede7f637c0ddd9e Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Fri, 9 Aug 2024 15:30:35 +0530 Subject: [PATCH] fix(mbedtls): link esp-cryptoauthlib to mbedcrypto library If the certificate bundle feature is disabled then the mbedtls component library becomes interface only component and hence adding esp-cryptoauthlib as its PRIVATE dependency does not work. Instead the esp-cryptoauthlib should be added as PRIVATE dependency for mbedcrypto library (for alternate ECDSA implementation). --- components/mbedtls/CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/components/mbedtls/CMakeLists.txt b/components/mbedtls/CMakeLists.txt index 6791015b81..ea1003c4d3 100644 --- a/components/mbedtls/CMakeLists.txt +++ b/components/mbedtls/CMakeLists.txt @@ -333,7 +333,16 @@ if(CONFIG_ESP_TLS_USE_DS_PERIPHERAL) set_property(TARGET mbedcrypto APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 6) endif() -# Link esp-cryptoauthlib to mbedtls +# Additional optional dependencies for the mbedcrypto library +function(mbedcrypto_optional_deps component_name) + idf_build_get_property(components BUILD_COMPONENTS) + if(${component_name} IN_LIST components) + idf_component_get_property(lib_name ${component_name} COMPONENT_LIB) + target_link_libraries(mbedcrypto PRIVATE ${lib_name}) + endif() +endfunction() + +# Link esp-cryptoauthlib to mbedcrypto if(CONFIG_ATCA_MBEDTLS_ECDSA) - idf_component_optional_requires(PRIVATE espressif__esp-cryptoauthlib esp-cryptoauthlib) + mbedcrypto_optional_deps(espressif__esp-cryptoauthlib esp-cryptoauthlib) endif()