From 102485a4b8582c5bbe49f92f01684e2956c7792f Mon Sep 17 00:00:00 2001 From: Siddharth Date: Thu, 20 Jun 2024 22:08:38 -0400 Subject: [PATCH 01/13] Add oqsprovider statically (built in) by default --- .gitmodules | 3 +++ src/Mayaqua/3rdparty/oqs-provider | 1 + src/Mayaqua/CMakeLists.txt | 9 +++++++++ src/Mayaqua/Encrypt.c | 16 +++++++++++++++- 4 files changed, 28 insertions(+), 1 deletion(-) create mode 160000 src/Mayaqua/3rdparty/oqs-provider diff --git a/.gitmodules b/.gitmodules index 1dca04b4..c6c61d96 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "src/libhamcore"] path = src/libhamcore url = https://github.com/SoftEtherVPN/libhamcore.git +[submodule "src/Mayaqua/3rdparty/oqs-provider"] + path = src/Mayaqua/3rdparty/oqs-provider + url = https://github.com/open-quantum-safe/oqs-provider.git diff --git a/src/Mayaqua/3rdparty/oqs-provider b/src/Mayaqua/3rdparty/oqs-provider new file mode 160000 index 00000000..bfaf2981 --- /dev/null +++ b/src/Mayaqua/3rdparty/oqs-provider @@ -0,0 +1 @@ +Subproject commit bfaf29819e8e7679eb7b440c20312449d311e86a diff --git a/src/Mayaqua/CMakeLists.txt b/src/Mayaqua/CMakeLists.txt index 32a121a9..e7308d8c 100644 --- a/src/Mayaqua/CMakeLists.txt +++ b/src/Mayaqua/CMakeLists.txt @@ -93,6 +93,15 @@ if(UNIX) $<$:${LIB_RT}> ) + if (SKIP_OQS_PROVIDER) + add_definitions(-DSKIP_OQS_PROVIDER) + else() + set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared) + add_subdirectory(3rdparty/oqs-provider) + set_property(TARGET oqsprovider PROPERTY POSITION_INDEPENDENT_CODE ON) + target_link_libraries(mayaqua PRIVATE oqsprovider) + endif() + if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7l|aarch64|s390x)$" OR NOT HAVE_SYS_AUXV OR SKIP_CPU_FEATURES) add_definitions(-DSKIP_CPU_FEATURES) else() diff --git a/src/Mayaqua/Encrypt.c b/src/Mayaqua/Encrypt.c index fab64387..1b34b831 100644 --- a/src/Mayaqua/Encrypt.c +++ b/src/Mayaqua/Encrypt.c @@ -40,6 +40,10 @@ #include #if OPENSSL_VERSION_NUMBER >= 0x30000000L #include +// Static oqsprovider initialization function +#ifndef SKIP_OQS_PROVIDER + extern OSSL_provider_init_fn oqs_provider_init; +#endif #endif #ifdef _MSC_VER @@ -64,6 +68,10 @@ #endif #endif // _MSC_VER +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + +#endif + // OpenSSL <1.1 Shims #if OPENSSL_VERSION_NUMBER < 0x10100000L # define EVP_PKEY_get0_RSA(obj) ((obj)->pkey.rsa) @@ -4003,7 +4011,13 @@ void InitCryptLibrary() #if OPENSSL_VERSION_NUMBER >= 0x30000000L ossl_provider_default = OSSL_PROVIDER_load(NULL, "legacy"); ossl_provider_legacy = OSSL_PROVIDER_load(NULL, "default"); - ossl_provider_oqsprovider = OSSL_PROVIDER_load(NULL, "oqsprovider"); + + char *oqs_provider_name = "oqsprovider"; + #ifndef SKIP_OQS_PROVIDER + # Registers "oqsprovider" as a provider -- necessary because oqsprovider is built in now. + OSSL_PROVIDER_add_builtin(NULL, oqs_provider_name, oqs_provider_init); + #endif + ossl_provider_oqsprovider = OSSL_PROVIDER_load(NULL, oqs_provider_name); #endif ssl_clientcert_index = SSL_get_ex_new_index(0, "struct SslClientCertInfo *", NULL, NULL, NULL); From 13e6369db379cbb5af63944c7a8cb787ff8890e9 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Fri, 21 Jun 2024 15:14:49 -0400 Subject: [PATCH 02/13] Add liboqs because it isn't normally packaged --- .gitmodules | 3 +++ src/Mayaqua/3rdparty/liboqs | 1 + src/Mayaqua/CMakeLists.txt | 10 ++++++++++ 3 files changed, 14 insertions(+) create mode 160000 src/Mayaqua/3rdparty/liboqs diff --git a/.gitmodules b/.gitmodules index c6c61d96..10ff4bc8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "src/Mayaqua/3rdparty/oqs-provider"] path = src/Mayaqua/3rdparty/oqs-provider url = https://github.com/open-quantum-safe/oqs-provider.git +[submodule "src/Mayaqua/3rdparty/liboqs"] + path = src/Mayaqua/3rdparty/liboqs + url = https://github.com/open-quantum-safe/liboqs.git diff --git a/src/Mayaqua/3rdparty/liboqs b/src/Mayaqua/3rdparty/liboqs new file mode 160000 index 00000000..e3f05cbf --- /dev/null +++ b/src/Mayaqua/3rdparty/liboqs @@ -0,0 +1 @@ +Subproject commit e3f05cbfba4552067e2c0de524c1049a864c5f2d diff --git a/src/Mayaqua/CMakeLists.txt b/src/Mayaqua/CMakeLists.txt index e7308d8c..b472ac4a 100644 --- a/src/Mayaqua/CMakeLists.txt +++ b/src/Mayaqua/CMakeLists.txt @@ -74,6 +74,15 @@ if(WIN32) "ws2_32.lib" "WtsApi32.Lib" ) + if (SKIP_OQS_PROVIDER) + add_definitions(-DSKIP_OQS_PROVIDER) + else() + add_subdirectory(3rdparty/liboqs) + set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared) + add_subdirectory(3rdparty/oqs-provider) + set_property(TARGET oqsprovider PROPERTY POSITION_INDEPENDENT_CODE ON) + target_link_libraries(mayaqua PRIVATE oqsprovider) + endif() endif() if(UNIX) @@ -96,6 +105,7 @@ if(UNIX) if (SKIP_OQS_PROVIDER) add_definitions(-DSKIP_OQS_PROVIDER) else() + add_subdirectory(3rdparty/liboqs) set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared) add_subdirectory(3rdparty/oqs-provider) set_property(TARGET oqsprovider PROPERTY POSITION_INDEPENDENT_CODE ON) From eb66e7d36043692f73182cdbbd5b8c8af62aeed5 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Fri, 21 Jun 2024 15:16:27 -0400 Subject: [PATCH 03/13] That's not how you comment in C! --- src/Mayaqua/Encrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mayaqua/Encrypt.c b/src/Mayaqua/Encrypt.c index 1b34b831..b1644309 100644 --- a/src/Mayaqua/Encrypt.c +++ b/src/Mayaqua/Encrypt.c @@ -4014,7 +4014,7 @@ void InitCryptLibrary() char *oqs_provider_name = "oqsprovider"; #ifndef SKIP_OQS_PROVIDER - # Registers "oqsprovider" as a provider -- necessary because oqsprovider is built in now. + // Registers "oqsprovider" as a provider -- necessary because oqsprovider is built in now. OSSL_PROVIDER_add_builtin(NULL, oqs_provider_name, oqs_provider_init); #endif ossl_provider_oqsprovider = OSSL_PROVIDER_load(NULL, oqs_provider_name); From 7dc3f2240c3f4573ed1171a3c0a3d1d3a485e9ec Mon Sep 17 00:00:00 2001 From: Siddharth Date: Wed, 26 Jun 2024 20:55:09 -0400 Subject: [PATCH 04/13] Add liboqs with find_package --- src/Mayaqua/3rdparty/Findliboqs.cmake | 2 ++ src/Mayaqua/CMakeLists.txt | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 src/Mayaqua/3rdparty/Findliboqs.cmake diff --git a/src/Mayaqua/3rdparty/Findliboqs.cmake b/src/Mayaqua/3rdparty/Findliboqs.cmake new file mode 100644 index 00000000..80900f23 --- /dev/null +++ b/src/Mayaqua/3rdparty/Findliboqs.cmake @@ -0,0 +1,2 @@ +set(oqs_FOUND TRUE) +add_library(OQS::oqs ALIAS oqs) diff --git a/src/Mayaqua/CMakeLists.txt b/src/Mayaqua/CMakeLists.txt index b472ac4a..4bea77a8 100644 --- a/src/Mayaqua/CMakeLists.txt +++ b/src/Mayaqua/CMakeLists.txt @@ -74,12 +74,21 @@ if(WIN32) "ws2_32.lib" "WtsApi32.Lib" ) + if (SKIP_OQS_PROVIDER) add_definitions(-DSKIP_OQS_PROVIDER) else() - add_subdirectory(3rdparty/liboqs) + set(OQS_BUILD_ONLY_LIB ON CACHE BOOL "Set liboqs to build only the library (no tests)") set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared) + list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/Mayaqua/3rdparty/") + + add_subdirectory(3rdparty/liboqs) add_subdirectory(3rdparty/oqs-provider) + + target_include_directories(oqsprovider PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/3rdparty/liboqs/include) + get_target_property(target_include_dirs oqsprovider INCLUDE_DIRECTORIES) + message("Include directories for target_name: ${target_include_dirs}") + set_property(TARGET oqsprovider PROPERTY POSITION_INDEPENDENT_CODE ON) target_link_libraries(mayaqua PRIVATE oqsprovider) endif() @@ -101,13 +110,21 @@ if(UNIX) $<$:${LIB_M}> $<$:${LIB_RT}> ) - + if (SKIP_OQS_PROVIDER) add_definitions(-DSKIP_OQS_PROVIDER) else() - add_subdirectory(3rdparty/liboqs) + set(OQS_BUILD_ONLY_LIB ON CACHE BOOL "Set liboqs to build only the library (no tests)") set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared) + list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/Mayaqua/3rdparty/") + + add_subdirectory(3rdparty/liboqs) add_subdirectory(3rdparty/oqs-provider) + + target_include_directories(oqsprovider PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/3rdparty/liboqs/include) + get_target_property(target_include_dirs oqsprovider INCLUDE_DIRECTORIES) + message("Include directories for target_name: ${target_include_dirs}") + set_property(TARGET oqsprovider PROPERTY POSITION_INDEPENDENT_CODE ON) target_link_libraries(mayaqua PRIVATE oqsprovider) endif() From d15f92c9b232cc4ebf71046b140ce5a0552ea69f Mon Sep 17 00:00:00 2001 From: Siddharth Date: Thu, 27 Jun 2024 19:30:11 -0400 Subject: [PATCH 05/13] Make oqsprovider not build tests --- src/Mayaqua/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Mayaqua/CMakeLists.txt b/src/Mayaqua/CMakeLists.txt index 4bea77a8..50967bbd 100644 --- a/src/Mayaqua/CMakeLists.txt +++ b/src/Mayaqua/CMakeLists.txt @@ -80,6 +80,7 @@ if(WIN32) else() set(OQS_BUILD_ONLY_LIB ON CACHE BOOL "Set liboqs to build only the library (no tests)") set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared) + set(BUILD_TESTING OFF CACHE BOOL "By setting this to OFF, no tests or examples will be compiled.") list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/Mayaqua/3rdparty/") add_subdirectory(3rdparty/liboqs) From c2c1388f8c79384d7747a9da8a0533c52b79b81f Mon Sep 17 00:00:00 2001 From: Siddharth Date: Thu, 27 Jun 2024 19:31:28 -0400 Subject: [PATCH 06/13] Update liboqs and oqs-provider git submodules --- src/Mayaqua/3rdparty/liboqs | 2 +- src/Mayaqua/3rdparty/oqs-provider | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mayaqua/3rdparty/liboqs b/src/Mayaqua/3rdparty/liboqs index e3f05cbf..51ddd33c 160000 --- a/src/Mayaqua/3rdparty/liboqs +++ b/src/Mayaqua/3rdparty/liboqs @@ -1 +1 @@ -Subproject commit e3f05cbfba4552067e2c0de524c1049a864c5f2d +Subproject commit 51ddd33cc04d12bd47c8639c1254714879f4cdf3 diff --git a/src/Mayaqua/3rdparty/oqs-provider b/src/Mayaqua/3rdparty/oqs-provider index bfaf2981..8f37521d 160000 --- a/src/Mayaqua/3rdparty/oqs-provider +++ b/src/Mayaqua/3rdparty/oqs-provider @@ -1 +1 @@ -Subproject commit bfaf29819e8e7679eb7b440c20312449d311e86a +Subproject commit 8f37521d5e27ab4d1e0d69a4b4a5bd17927b24b9 From 0af6c96d88f6ea2c3dffa0c0aad7ed99f4d478a1 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Fri, 28 Jun 2024 00:09:50 -0400 Subject: [PATCH 07/13] Skip tests for oqsprovider --- src/Mayaqua/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Mayaqua/CMakeLists.txt b/src/Mayaqua/CMakeLists.txt index 50967bbd..566b3962 100644 --- a/src/Mayaqua/CMakeLists.txt +++ b/src/Mayaqua/CMakeLists.txt @@ -79,8 +79,8 @@ if(WIN32) add_definitions(-DSKIP_OQS_PROVIDER) else() set(OQS_BUILD_ONLY_LIB ON CACHE BOOL "Set liboqs to build only the library (no tests)") - set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared) set(BUILD_TESTING OFF CACHE BOOL "By setting this to OFF, no tests or examples will be compiled.") + set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared) list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/Mayaqua/3rdparty/") add_subdirectory(3rdparty/liboqs) @@ -116,6 +116,7 @@ if(UNIX) add_definitions(-DSKIP_OQS_PROVIDER) else() set(OQS_BUILD_ONLY_LIB ON CACHE BOOL "Set liboqs to build only the library (no tests)") + set(BUILD_TESTING OFF CACHE BOOL "By setting this to OFF, no tests or examples will be compiled.") set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared) list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/Mayaqua/3rdparty/") From 28ded982a7a70489832330fbf97d6f049fac5b86 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Fri, 28 Jun 2024 14:18:48 -0400 Subject: [PATCH 08/13] Remove empty OpenSSL version guard --- src/Mayaqua/Encrypt.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Mayaqua/Encrypt.c b/src/Mayaqua/Encrypt.c index b1644309..0f419300 100644 --- a/src/Mayaqua/Encrypt.c +++ b/src/Mayaqua/Encrypt.c @@ -68,10 +68,6 @@ #endif #endif // _MSC_VER -#if OPENSSL_VERSION_NUMBER >= 0x30000000L - -#endif - // OpenSSL <1.1 Shims #if OPENSSL_VERSION_NUMBER < 0x10100000L # define EVP_PKEY_get0_RSA(obj) ((obj)->pkey.rsa) From 1f9ce6f9c2b4c70e11105c89d0d7a0b1dfe38fee Mon Sep 17 00:00:00 2001 From: Siddharth Date: Fri, 28 Jun 2024 16:54:03 -0400 Subject: [PATCH 09/13] Skip oqsprovider build when OpenSSL version is less than 3.0 --- src/Mayaqua/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Mayaqua/CMakeLists.txt b/src/Mayaqua/CMakeLists.txt index 566b3962..e2dc265e 100644 --- a/src/Mayaqua/CMakeLists.txt +++ b/src/Mayaqua/CMakeLists.txt @@ -18,6 +18,10 @@ set_target_properties(mayaqua find_package(OpenSSL REQUIRED) +if(OPENSSL_VERSION VERSION_LESS "3") # Disable oqsprovider when OpenSSL version < 3 + set(SKIP_OQS_PROVIDER ON) +endif() + include(CheckSymbolExists) set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) From 1d57ccf94a550a108b7f6716336144876401dba2 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Thu, 4 Jul 2024 06:55:06 -0400 Subject: [PATCH 10/13] Fix engine include errors on Fedora Rawhide --- .github/workflows/fedora-rawhide.yml | 2 +- src/Mayaqua/Encrypt.c | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/fedora-rawhide.yml b/.github/workflows/fedora-rawhide.yml index 59f9500e..66c7116b 100644 --- a/.github/workflows/fedora-rawhide.yml +++ b/.github/workflows/fedora-rawhide.yml @@ -25,7 +25,7 @@ jobs: submodules: true - name: Install dependencies run: | - dnf -y install git cmake ncurses-devel openssl-devel libsodium-devel readline-devel zlib-devel gcc-c++ clang + dnf -y install git cmake ncurses-devel openssl-devel-engine libsodium-devel readline-devel zlib-devel gcc-c++ clang - name: Compile with ${{ matrix.cc }} run: | export CC=${{ matrix.cc }} diff --git a/src/Mayaqua/Encrypt.c b/src/Mayaqua/Encrypt.c index 0f419300..ddb1efc7 100644 --- a/src/Mayaqua/Encrypt.c +++ b/src/Mayaqua/Encrypt.c @@ -20,7 +20,9 @@ #include #include #include +#ifndef OPENSSL_NO_ENGINE #include +#endif #include #include #include @@ -40,10 +42,6 @@ #include #if OPENSSL_VERSION_NUMBER >= 0x30000000L #include -// Static oqsprovider initialization function -#ifndef SKIP_OQS_PROVIDER - extern OSSL_provider_init_fn oqs_provider_init; -#endif #endif #ifdef _MSC_VER @@ -4007,13 +4005,7 @@ void InitCryptLibrary() #if OPENSSL_VERSION_NUMBER >= 0x30000000L ossl_provider_default = OSSL_PROVIDER_load(NULL, "legacy"); ossl_provider_legacy = OSSL_PROVIDER_load(NULL, "default"); - - char *oqs_provider_name = "oqsprovider"; - #ifndef SKIP_OQS_PROVIDER - // Registers "oqsprovider" as a provider -- necessary because oqsprovider is built in now. - OSSL_PROVIDER_add_builtin(NULL, oqs_provider_name, oqs_provider_init); - #endif - ossl_provider_oqsprovider = OSSL_PROVIDER_load(NULL, oqs_provider_name); + ossl_provider_oqsprovider = OSSL_PROVIDER_load(NULL, "oqsprovider"); #endif ssl_clientcert_index = SSL_get_ex_new_index(0, "struct SslClientCertInfo *", NULL, NULL, NULL); From a45219bb7803d26383270b6724f964974b56272e Mon Sep 17 00:00:00 2001 From: Siddharth Date: Thu, 4 Jul 2024 13:15:50 -0400 Subject: [PATCH 11/13] Revert "Fix engine include errors on Fedora Rawhide" This reverts commit 1d57ccf94a550a108b7f6716336144876401dba2. --- .github/workflows/fedora-rawhide.yml | 2 +- src/Mayaqua/Encrypt.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/fedora-rawhide.yml b/.github/workflows/fedora-rawhide.yml index 66c7116b..59f9500e 100644 --- a/.github/workflows/fedora-rawhide.yml +++ b/.github/workflows/fedora-rawhide.yml @@ -25,7 +25,7 @@ jobs: submodules: true - name: Install dependencies run: | - dnf -y install git cmake ncurses-devel openssl-devel-engine libsodium-devel readline-devel zlib-devel gcc-c++ clang + dnf -y install git cmake ncurses-devel openssl-devel libsodium-devel readline-devel zlib-devel gcc-c++ clang - name: Compile with ${{ matrix.cc }} run: | export CC=${{ matrix.cc }} diff --git a/src/Mayaqua/Encrypt.c b/src/Mayaqua/Encrypt.c index ddb1efc7..0f419300 100644 --- a/src/Mayaqua/Encrypt.c +++ b/src/Mayaqua/Encrypt.c @@ -20,9 +20,7 @@ #include #include #include -#ifndef OPENSSL_NO_ENGINE #include -#endif #include #include #include @@ -42,6 +40,10 @@ #include #if OPENSSL_VERSION_NUMBER >= 0x30000000L #include +// Static oqsprovider initialization function +#ifndef SKIP_OQS_PROVIDER + extern OSSL_provider_init_fn oqs_provider_init; +#endif #endif #ifdef _MSC_VER @@ -4005,7 +4007,13 @@ void InitCryptLibrary() #if OPENSSL_VERSION_NUMBER >= 0x30000000L ossl_provider_default = OSSL_PROVIDER_load(NULL, "legacy"); ossl_provider_legacy = OSSL_PROVIDER_load(NULL, "default"); - ossl_provider_oqsprovider = OSSL_PROVIDER_load(NULL, "oqsprovider"); + + char *oqs_provider_name = "oqsprovider"; + #ifndef SKIP_OQS_PROVIDER + // Registers "oqsprovider" as a provider -- necessary because oqsprovider is built in now. + OSSL_PROVIDER_add_builtin(NULL, oqs_provider_name, oqs_provider_init); + #endif + ossl_provider_oqsprovider = OSSL_PROVIDER_load(NULL, oqs_provider_name); #endif ssl_clientcert_index = SSL_get_ex_new_index(0, "struct SslClientCertInfo *", NULL, NULL, NULL); From d4d20e44435af91c4cad34b335792adf17a762cb Mon Sep 17 00:00:00 2001 From: Siddharth Date: Thu, 4 Jul 2024 13:56:13 -0400 Subject: [PATCH 12/13] Remove testing code --- src/Mayaqua/CMakeLists.txt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Mayaqua/CMakeLists.txt b/src/Mayaqua/CMakeLists.txt index e2dc265e..cacbe03c 100644 --- a/src/Mayaqua/CMakeLists.txt +++ b/src/Mayaqua/CMakeLists.txt @@ -90,10 +90,7 @@ if(WIN32) add_subdirectory(3rdparty/liboqs) add_subdirectory(3rdparty/oqs-provider) - target_include_directories(oqsprovider PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/3rdparty/liboqs/include) - get_target_property(target_include_dirs oqsprovider INCLUDE_DIRECTORIES) - message("Include directories for target_name: ${target_include_dirs}") - + target_include_directories(oqsprovider PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/3rdparty/liboqs/include) set_property(TARGET oqsprovider PROPERTY POSITION_INDEPENDENT_CODE ON) target_link_libraries(mayaqua PRIVATE oqsprovider) endif() @@ -128,9 +125,6 @@ if(UNIX) add_subdirectory(3rdparty/oqs-provider) target_include_directories(oqsprovider PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/3rdparty/liboqs/include) - get_target_property(target_include_dirs oqsprovider INCLUDE_DIRECTORIES) - message("Include directories for target_name: ${target_include_dirs}") - set_property(TARGET oqsprovider PROPERTY POSITION_INDEPENDENT_CODE ON) target_link_libraries(mayaqua PRIVATE oqsprovider) endif() From 67fe99e1dcb43984745796ce43a8a70bd2eca1ab Mon Sep 17 00:00:00 2001 From: Siddharth Date: Fri, 5 Jul 2024 20:50:28 -0400 Subject: [PATCH 13/13] Move duplicated code to one place --- src/Mayaqua/CMakeLists.txt | 46 +++++++++++--------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/src/Mayaqua/CMakeLists.txt b/src/Mayaqua/CMakeLists.txt index cacbe03c..51acec0b 100644 --- a/src/Mayaqua/CMakeLists.txt +++ b/src/Mayaqua/CMakeLists.txt @@ -19,7 +19,19 @@ set_target_properties(mayaqua find_package(OpenSSL REQUIRED) if(OPENSSL_VERSION VERSION_LESS "3") # Disable oqsprovider when OpenSSL version < 3 - set(SKIP_OQS_PROVIDER ON) + add_definitions(-DSKIP_OQS_PROVIDER) +else() + set(OQS_BUILD_ONLY_LIB ON CACHE BOOL "Set liboqs to build only the library (no tests)") + set(BUILD_TESTING OFF CACHE BOOL "By setting this to OFF, no tests or examples will be compiled.") + set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared) + list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/Mayaqua/3rdparty/") + + add_subdirectory(3rdparty/liboqs) + add_subdirectory(3rdparty/oqs-provider) + + target_include_directories(oqsprovider PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/3rdparty/liboqs/include) + set_property(TARGET oqsprovider PROPERTY POSITION_INDEPENDENT_CODE ON) + target_link_libraries(mayaqua PRIVATE oqsprovider) endif() include(CheckSymbolExists) @@ -78,22 +90,6 @@ if(WIN32) "ws2_32.lib" "WtsApi32.Lib" ) - - if (SKIP_OQS_PROVIDER) - add_definitions(-DSKIP_OQS_PROVIDER) - else() - set(OQS_BUILD_ONLY_LIB ON CACHE BOOL "Set liboqs to build only the library (no tests)") - set(BUILD_TESTING OFF CACHE BOOL "By setting this to OFF, no tests or examples will be compiled.") - set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared) - list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/Mayaqua/3rdparty/") - - add_subdirectory(3rdparty/liboqs) - add_subdirectory(3rdparty/oqs-provider) - - target_include_directories(oqsprovider PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/3rdparty/liboqs/include) - set_property(TARGET oqsprovider PROPERTY POSITION_INDEPENDENT_CODE ON) - target_link_libraries(mayaqua PRIVATE oqsprovider) - endif() endif() if(UNIX) @@ -112,22 +108,6 @@ if(UNIX) $<$:${LIB_M}> $<$:${LIB_RT}> ) - - if (SKIP_OQS_PROVIDER) - add_definitions(-DSKIP_OQS_PROVIDER) - else() - set(OQS_BUILD_ONLY_LIB ON CACHE BOOL "Set liboqs to build only the library (no tests)") - set(BUILD_TESTING OFF CACHE BOOL "By setting this to OFF, no tests or examples will be compiled.") - set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared) - list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/Mayaqua/3rdparty/") - - add_subdirectory(3rdparty/liboqs) - add_subdirectory(3rdparty/oqs-provider) - - target_include_directories(oqsprovider PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/3rdparty/liboqs/include) - set_property(TARGET oqsprovider PROPERTY POSITION_INDEPENDENT_CODE ON) - target_link_libraries(mayaqua PRIVATE oqsprovider) - endif() if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7l|aarch64|s390x)$" OR NOT HAVE_SYS_AUXV OR SKIP_CPU_FEATURES) add_definitions(-DSKIP_CPU_FEATURES)