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>
This commit is contained in:
Frank Audun Kvamtrø 2021-05-25 13:04:46 +02:00 committed by Christopher Friedt
commit fb90efef1b

View file

@ -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()