From fb90efef1b4585780baf052d4003e3a8e27e00e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Tue, 25 May 2021 13:04:46 +0200 Subject: [PATCH] modules: mbedtls: Allow custom mbedtls implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -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ø --- modules/mbedtls/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index a7183c20e99..8c673d31ff4 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -35,8 +35,7 @@ if(CONFIG_ARCH_POSIX AND CONFIG_ASAN AND NOT CONFIG_64BIT) 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 @@ else() # 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()