modules: mbedtls: Allow custom mbedtls implementation -The current scheme in zephyr has the two choices MBEDTLS_BUILTIN and MBEDTLS_LIBRARY, but the choice of MBEDTLS_LIBRARY requires setting CONFIG_MBEDTLS_INSTALL_PATH for includes and library linking. This may not be neccesary when an alternative implementation of the library is being used. This adds support for custom choices in MBEDTLS_IMPLEMENTATION which can be added in an out-of-tree Kconfig file. -Made else an elseif(CONFIG_MBEDTLS_LIBRARY. -Removed reduntant assertion between the two choices. Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index a7183c2..8c673d3 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt
@@ -35,8 +35,7 @@ endif () zephyr_library_link_libraries(mbedTLS) -else() - assert(CONFIG_MBEDTLS_LIBRARY "MBEDTLS was enabled, but neither BUILTIN or LIBRARY was selected.") +elseif (CONFIG_MBEDTLS_LIBRARY) # NB: CONFIG_MBEDTLS_LIBRARY is not regression tested and is # therefore susceptible to bit rot @@ -53,6 +52,11 @@ # Lib mbedtls_external depends on libgcc (I assume?) so to allow # mbedtls_external to link with gcc we need to ensure it is placed # after mbedtls_external on the linkers command line. +else() + # If none of either CONFIG_MBEDTLS_BUILTIN or CONFIG_MBEDTLS_LIBRARY + # are defined the users need add a custom Kconfig choice to the + # MBEDTLS_IMPLEMENTATION and manually add the mbedtls library and + # included the required directories for mbedtls in their projects. endif() endif()