From 131a84613e6d9cd731c77e93e456c968e571ecc5 Mon Sep 17 00:00:00 2001 From: rjbrown2 Date: Thu, 2 May 2024 15:15:53 +0000 Subject: [PATCH 1/3] [nasa/cryptolib#240] Custom Module Paths - CMake updates --- CMakeLists.txt | 38 ++++++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 6 +++--- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a9b79b3..b7216ca1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,15 @@ cmake_minimum_required(VERSION 3.14.0) project(crypto C) +# +# CUSTOM PATH Definiton +# +set(SA_CUSTOM_PATH_DEFAULT "../../sa/custom") +set(SA_CUSTOM_KEY_DEFAULT "../../key/custom") +set(SA_CUSTOM_MC_DEFAULT "../../mc/custom") + + + # # Define Build Flags # The default value is captured in line, change with flag `-DXYZ=1` @@ -29,12 +38,15 @@ option(CRYPTO_KMC "Cryptography Module - KMC" OFF) option(CRYPTO_WOLFSSL "Cryptography Module - WolfSSL" OFF) option(DEBUG "Debug" OFF) option(KEY_CUSTOM "Key Module - Custom" OFF) +option(KEY_CUSTOM_PATH "Custom Key Path" OFF) option(KEY_INTERNAL "Key Module - Internal" ON) option(KEY_KMC "Key Module - KMC" OFF) option(MC_CUSTOM "Monitoring and Control - Custom" OFF) +option(MC_CUSTOM_PATH "Custom Monitoring and Control path" OFF) option(MC_DISABLED "Monitoring and Control - Disabled" OFF) option(MC_INTERNAL "Monitoring and Control - Internal" ON) option(SA_CUSTOM "Security Association - Custom" OFF) +option(SA_CUSTOM_PATH "Custion Security Association Path" OFF) option(SA_INTERNAL "Security Association - Internal" ON) option(SA_MARIADB "Security Association - MariaDB" OFF) option(SUPPORT "Support" OFF) @@ -46,6 +58,32 @@ OPTION(KMC_MDB_RH "KMC-MDB-RedHat-Integration-Testing" OFF) #Disabled by default OPTION(KMC_MDB_DB "KMC-MDB-Debian-Integration-Testing" OFF) #Disabled by default, enable with: -DKMC_MDB_DB=ON OPTION(KMC_CFFI_EXCLUDE "KMC-Exclude-Problematic-CFFI-Code" OFF) #Disabled by default, enable with: -DKMC_CFFI_EXCLUDE=ON + +# +# Custom Module Paths +# +if(KEY_CUSTOM) + if(NOT DEFINED ${KEY_CUSTOM_PATH}) + set(KEY_CUSTOM_PATH ${KEY_CUSTOM_PATH_DEFAULT}) + endif() + message(STATUS "KEY_CUSTOM being utilized. Path set to: ${KEY_CUSTOM_PATH}") +endif() + +if(MC_CUSTOM) + if(NOT DEFINED ${KEY_CUSTOM_PATH}) + set(MC_CUSTOM_PATH ${MC_CUSTOM_PATH_DEFAULT}) + endif() + message(STATUS "MC_CUSTOM being utilized. Path set to: ${MC_CUSTOM_PATH}") +endif() + +if(SA_CUSTOM) + if(NOT DEFINED ${SA_CUSTOM_PATH}) + set(SA_CUSTOM_PATH ${SA_CUSTOM_PATH_DEFAULT}) + endif() + message(STATUS "SA_CUSTOM being utilized. Path set to: ${SA_CUSTOM_PATH}") +endif() + + # # Build Flag Logic # diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 48249225..dec1fb70 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,7 +45,7 @@ endif() if(KEY_CUSTOM) # Assumes CryptoLib is a Git submodule to project and custom directories and definitions exist at top level - aux_source_directory(../../key/custom KEY_CUSTOM_FILES) + aux_source_directory(KEY_CUSTOM_PATH KEY_CUSTOM_FILES) list(APPEND LIB_SRC_FILES ${KEY_CUSTOM_FILES}) else() aux_source_directory(key/custom_stub KEY_CUSTOM_FILES) @@ -70,7 +70,7 @@ endif() if(MC_CUSTOM) # Assumes CryptoLib is a Git submodule to project and custom directories and definitions exist at top level - aux_source_directory(../../mc/custom MC_CUSTOM_FILES) + aux_source_directory(MC_CUSTOM_PATH MC_CUSTOM_FILES) list(APPEND LIB_SRC_FILES ${MC_CUSTOM_FILES}) else() aux_source_directory(mc/custom_stub MC_CUSTOM_FILES) @@ -95,7 +95,7 @@ endif() if(SA_CUSTOM) # Assumes CryptoLib is a Git submodule to project and custom directories and definitions exist at top level - aux_source_directory(../../sa/custom SA_CUSTOM_FILES) + aux_source_directory(SA_CUSTOM_PATH SA_CUSTOM_FILES) list(APPEND LIB_SRC_FILES ${SA_CUSTOM_FILES}) else() aux_source_directory(sa/custom_stub SA_CUSTOM_FILES) From 7263751e72689d2b331c0dbc9ab61f5c45c249b5 Mon Sep 17 00:00:00 2001 From: rjbrown2 Date: Thu, 2 May 2024 15:18:14 +0000 Subject: [PATCH 2/3] [nasa/cryptolib#240] Custom Module Paths - CMake updates --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7216ca1..ec88dcec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,8 @@ project(crypto C) # CUSTOM PATH Definiton # set(SA_CUSTOM_PATH_DEFAULT "../../sa/custom") -set(SA_CUSTOM_KEY_DEFAULT "../../key/custom") -set(SA_CUSTOM_MC_DEFAULT "../../mc/custom") +set(KEY_CUSTOM_PATH_DEFAULT "../../key/custom") +set(MC_CUSTOM_PATH_DEFAULT "../../mc/custom") From 510e9dc95e5c8134c520c8716f87c18d231e608e Mon Sep 17 00:00:00 2001 From: rjbrown2 Date: Thu, 2 May 2024 15:29:44 +0000 Subject: [PATCH 3/3] [nasa/cryptolib#239] Custom Crypto Module - CMake updates --- CMakeLists.txt | 10 ++++++++++ src/CMakeLists.txt | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec88dcec..4e92c721 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ project(crypto C) set(SA_CUSTOM_PATH_DEFAULT "../../sa/custom") set(KEY_CUSTOM_PATH_DEFAULT "../../key/custom") set(MC_CUSTOM_PATH_DEFAULT "../../mc/custom") +set(CRYPTO_CUSTOM_PATH_DEFAULT "../../crypto/custom") @@ -36,6 +37,8 @@ option(CODECOV "Code Coverage" OFF) option(CRYPTO_LIBGCRYPT "Cryptography Module - Libgcrypt" ON) option(CRYPTO_KMC "Cryptography Module - KMC" OFF) option(CRYPTO_WOLFSSL "Cryptography Module - WolfSSL" OFF) +option(CRYPTO_CUSTOM "Cryptography Module - CUSTOM" OFF) +option(CRYPTO_CUSTOM_PATH "Cryptography Module - CUSTOM PATH" OFF) option(DEBUG "Debug" OFF) option(KEY_CUSTOM "Key Module - Custom" OFF) option(KEY_CUSTOM_PATH "Custom Key Path" OFF) @@ -83,6 +86,13 @@ if(SA_CUSTOM) message(STATUS "SA_CUSTOM being utilized. Path set to: ${SA_CUSTOM_PATH}") endif() +if(CRYPTO_CUSTOM) + if(NOT DEFINED ${CRYPTO_CUSTOM_PATH}) + set(CRYPTO_CUSTOM_PATH ${CRYPTO_CUSTOM_PATH_DEFAULT}) + endif() + message(STATUS "CRYPTO_CUSTOM being utilized. Path set to: ${CRYPTO_CUSTOM_PATH}") +endif() + # # Build Flag Logic diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dec1fb70..26e32e0c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,6 +19,14 @@ include_directories(../include) aux_source_directory(core LIB_SRC_FILES) +if(CRYPTO_CUSTOM) + aux_source_directory(CRYPTO_CUSTOM_PATH CRYPTO_FILES) + list(APPEND LIB_SRC_FILES ${CRYPTO_FILES}) +else() + aux_source_directory(crypto/custom_stub CRYPTO_FILES) + list(APPEND LIB_SRC_FILES ${CRYPTO_FILES}) +endif() + if(CRYPTO_LIBGCRYPT) aux_source_directory(crypto/libgcrypt LIBGCRYPT_FILES) list(APPEND LIB_SRC_FILES ${LIBGCRYPT_FILES})