diff options
author | Eneas U de Queiroz <cotequeiroz@gmail.com> | 2023-02-17 08:12:40 -0300 |
---|---|---|
committer | Eneas U de Queiroz <cotequeiroz@gmail.com> | 2023-03-17 17:22:53 -0300 |
commit | 4662adef2ad02dc5903516f69da017dcecf392c9 (patch) | |
tree | d41fcffca79a0ef3d2247f57cd44ec6b23896a26 /package/utils/uencrypt/src/CMakeLists.txt | |
parent | 6ac6f2402da7ced5b6295e446693a78179923fdd (diff) | |
download | upstream-4662adef2ad02dc5903516f69da017dcecf392c9.tar.gz upstream-4662adef2ad02dc5903516f69da017dcecf392c9.tar.bz2 upstream-4662adef2ad02dc5903516f69da017dcecf392c9.zip |
uencrypt: add support for mbedtls
This commit includes some additional changes:
- better handling of iv and keys in openssl/wolfssl variants
- fix compiler warnings and whitespace
- build all 3 variants as separate packages
- adjust the new package name in targets' DEVICE_PACKAGES
- remove PKG_FLAGS:=nonshared
[Beeline SmartBox Flash - OK]
Tested-by: Mikhail Zhilkin <csharper2005@gmail.com>
[after test: replaced a hardcoded IV size of 16 by cipher_info->iv_size]
Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Diffstat (limited to 'package/utils/uencrypt/src/CMakeLists.txt')
-rw-r--r-- | package/utils/uencrypt/src/CMakeLists.txt | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/package/utils/uencrypt/src/CMakeLists.txt b/package/utils/uencrypt/src/CMakeLists.txt index cd25d2f12f..eadb2eadb3 100644 --- a/package/utils/uencrypt/src/CMakeLists.txt +++ b/package/utils/uencrypt/src/CMakeLists.txt @@ -5,16 +5,27 @@ cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) project(uencrypt LANGUAGES C) option(USE_WOLFSSL "Use WolfSSL as crypto provider" OFF) -if (USE_WOLFSSL) - add_definitions(-DUSE_WOLFSSL) - find_library(WOLFSSL_LIBRARY wolfssl REQUIRED) - set(CRYPTO_LIBRARIES ${WOLFSSL_LIBRARY}) +option(USE_MBEDTLS "Use mbedTLS as crypto provider" OFF) +if (USE_MBEDTLS) + if (USE_WOLFSSL) + message(WARNING "USE_MBEDTLS and USE_WOLFSSL are both set. Building with USE_MBEDTLS.") + endif() + add_definitions(-DUSE_MBEDTLS) + find_library(MBEDCRYPTO_LIBRARY mbedcrypto REQUIRED) + set(CRYPTO_LIBRARIES ${MBEDCRYPTO_LIBRARY}) + add_executable(${PROJECT_NAME} ${PROJECT_NAME}-mbedtls.c) else() - find_package(OpenSSL REQUIRED) - set(CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) + add_executable(${PROJECT_NAME} ${PROJECT_NAME}-openssl.c) + if (USE_WOLFSSL) + add_definitions(-DUSE_WOLFSSL) + find_library(WOLFSSL_LIBRARY wolfssl REQUIRED) + set(CRYPTO_LIBRARIES ${WOLFSSL_LIBRARY}) + else() + find_package(OpenSSL REQUIRED) + set(CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) + endif() endif() -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c) target_link_libraries(${PROJECT_NAME} ${CRYPTO_LIBRARIES}) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) |