From 68520e3f0b76fc6f3ca3fe04e671e3686fcf6b90 Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Tue, 17 Jan 2023 16:28:36 -0600 Subject: [PATCH 1/2] Fix Cmake to exclude libm when DH is not enabled --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abeec4ff0..901267e6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1949,10 +1949,12 @@ elseif(APPLE) ${SECURITY_FRAMEWORK}) endif() else() - # DH requires math (m) library - target_link_libraries(wolfssl - PUBLIC - m) + if(WOLFSSL_DH) + # DH requires math (m) library + target_link_libraries(wolfssl + PUBLIC + m) + endif() endif() #################################################### From 9f7e82a081e35c1e55a5800cc3a8b2fee3d2f90d Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Fri, 20 Jan 2023 08:39:44 -0600 Subject: [PATCH 2/2] Add WOLFSSL_DH_CONST option to Cmake --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 901267e6c..7adbe5bcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -931,7 +931,7 @@ endif() # DH add_option("WOLFSSL_DH" "Enable DH (default: enabled)" - "yes" "yes;no") + "yes" "yes;no;const") if(WOLFSSL_OPENSSH) override_cache(WOLFSSL_DH "yes") @@ -946,6 +946,11 @@ else() endif() endif() +if("${WOLFSSL_DH}" STREQUAL "const") + list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_DH_CONST") + set(WOLFSSL_DH_CONST "yes") +endif() + # TODO: - Anonymous # ASN @@ -1949,7 +1954,7 @@ elseif(APPLE) ${SECURITY_FRAMEWORK}) endif() else() - if(WOLFSSL_DH) + if(WOLFSSL_DH AND NOT WOLFSSL_DH_CONST) # DH requires math (m) library target_link_libraries(wolfssl PUBLIC