diff --git a/CMakeLists.txt b/CMakeLists.txt index abeec4ff0..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,10 +1954,12 @@ elseif(APPLE) ${SECURITY_FRAMEWORK}) endif() else() - # DH requires math (m) library - target_link_libraries(wolfssl - PUBLIC - m) + if(WOLFSSL_DH AND NOT WOLFSSL_DH_CONST) + # DH requires math (m) library + target_link_libraries(wolfssl + PUBLIC + m) + endif() endif() ####################################################