diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2024-09-14 20:40:58 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2024-12-26 22:25:08 +0100 |
commit | af915e9ce74ca793f6f7c272985a92671887a88e (patch) | |
tree | d482f2a7bb1a1d4c2ce144ad77e0cd3f3da94a9e /CMakeLists.txt | |
parent | ef7033878f878c9a4c51ab73353db7b93a4f99e3 (diff) |
lib: add Crypto MbedTLS plugin support
Implement message digest, and RSA and ECDSA signing
and verification.
Add NIST curve alises in order to support the same curve names
in crypto-mbetls and crypto-openssl:
* P-192
* P-224
* P-256
* P-384
* P-521
* brainpoolP256r1
* brainpoolP384r1
* brainpoolP512r1
Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bdf0738..a494a31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ find_library(libuci NAMES uci) find_library(libubox NAMES ubox) find_library(libubus NAMES ubus) find_library(libblobmsg_json NAMES blobmsg_json) +find_library(libmbedtls NAMES mbedtls) find_package(ZLIB) find_library(libmd NAMES libmd.a md) @@ -59,6 +60,10 @@ if(libmd) set(DEFAULT_DIGEST_SUPPORT ON) endif() +if(libmbedtls) + set(DEFAULT_CRYPTO_MBEDTLS_SUPPORT ON) +endif() + option(DEBUG_SUPPORT "Debug plugin support" ON) option(FS_SUPPORT "Filesystem plugin support" ON) option(MATH_SUPPORT "Math plugin support" ON) @@ -74,6 +79,7 @@ option(SOCKET_SUPPORT "Socket plugin support" ON) option(ZLIB_SUPPORT "Zlib plugin support" ${DEFAULT_ZLIB_SUPPORT}) option(DIGEST_SUPPORT "Digest plugin support" ${DEFAULT_DIGEST_SUPPORT}) option(DIGEST_SUPPORT_EXTENDED "Enable additional hash algorithms" ${DEFAULT_DIGEST_SUPPORT}) +option(CRYPTO_MBEDTLS_SUPPORT "Crypto Mbed-TLS plugin support" ${DEFAULT_CRYPTO_MBEDTLS_SUPPORT}) set(LIB_SEARCH_PATH "${CMAKE_INSTALL_PREFIX}/lib/ucode/*.so:${CMAKE_INSTALL_PREFIX}/share/ucode/*.uc:./*.so:./*.uc" CACHE STRING "Default library search path") string(REPLACE ":" "\", \"" LIB_SEARCH_DEFINE "${LIB_SEARCH_PATH}") @@ -310,6 +316,14 @@ if(DIGEST_SUPPORT) target_link_libraries(digest_lib ${libmd}) endif() +if(CRYPTO_MBEDTLS_SUPPORT) + set(LIBRARIES ${LIBRARIES} crypto_mbedtls_lib) + add_library(crypto_mbedtls_lib MODULE lib/crypto-mbedtls.c) + set_target_properties(crypto_mbedtls_lib PROPERTIES OUTPUT_NAME crypto_mbedtls PREFIX "") + target_link_options(crypto_mbedtls_lib PRIVATE ${UCODE_MODULE_LINK_OPTIONS} -Wl,-no-as-needed) + target_link_libraries(crypto_mbedtls_lib ${libmbedtls}) +endif() + if(UNIT_TESTING) enable_testing() add_definitions(-DUNIT_TESTING) |