]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: do not include wolfSSL header in `curl_setup.h`
authorViktor Szakats <commit@vsz.me>
Wed, 25 Feb 2026 19:55:03 +0000 (20:55 +0100)
committerViktor Szakats <commit@vsz.me>
Thu, 26 Feb 2026 00:36:16 +0000 (01:36 +0100)
To fix building tests/server with cmake and both wolfSSL and OpenSSL
enabled (MultiSSL).

tests/server do not have libcurl dependency header paths setup because
it does not use libcurl. The code however includes `curl_setup.h`, which
tried including `wolfssl/version.h` before this patch to verify if the
wolfSSL coexist feature is available. Without a header path, it failed:
```
In file included from bld/tests/server/servers.c:3:
In file included from tests/server/first.h:40:
lib/curl_setup.h:737:12: fatal error: 'wolfssl/version.h' file not found
  737 | #  include <wolfssl/version.h>
      |            ^~~~~~~~~~~~~~~~~~~
1 error generated.
```
Ref: https://github.com/curl/curl/actions/runs/22410066319/job/64880787424#step:46:76

Fix by moving the include and version check to `vtls/wolfssl.c`.

Also: add an early version check to cmake.

Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973
Cherry-picked from #20720

Closes #20726

CMakeLists.txt
lib/curl_setup.h
lib/vtls/wolfssl.c

index b13ba6248c33728906f6f27ab49ae200a8c59a50..2419de626cbbe03b907bd2874d44edffd88156b0 100644 (file)
@@ -883,6 +883,10 @@ if(CURL_USE_WOLFSSL)
   endif()
   set(_curl_ca_bundle_supported TRUE)
 
+  if(USE_OPENSSL AND WOLFSSL_VERSION VERSION_LESS 5.7.6)
+    message(FATAL_ERROR "wolfSSL 5.7.6 or newer is required to coexist with OpenSSL.")
+  endif()
+
   set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "WOLFSSL_OPTIONS_IGNORE_SYS")
 endif()
 
index 2a1f75d441e9537192a5c9c07f5fa425aa02fb01..b7c030c00656d79a613eef6fead9f37db286b2a9 100644 (file)
 #endif
 
 #if defined(USE_OPENSSL) && defined(USE_WOLFSSL)
-#  include <wolfssl/version.h>
-#  if LIBWOLFSSL_VERSION_HEX >= 0x05007006
-#    ifndef OPENSSL_COEXIST
-#    define OPENSSL_COEXIST
-#    endif
-#  else
-#    error "OpenSSL can only coexist with wolfSSL v5.7.6 or upper"
-#  endif
+#ifndef OPENSSL_COEXIST
+#define OPENSSL_COEXIST
+#endif
 #endif
 
 #if defined(USE_WOLFSSL) && defined(USE_GNUTLS)
index 89310adfaecfe153e34376d5d7c35a8d11212ebe..c2d134f7b8884027ad7d1cfcd865037dccc081cb 100644 (file)
@@ -36,6 +36,9 @@
 #if LIBWOLFSSL_VERSION_HEX < 0x03004006 /* wolfSSL 3.4.6 (2015) */
 #error "wolfSSL version should be at least 3.4.6"
 #endif
+#if defined(OPENSSL_COEXIST) && LIBWOLFSSL_VERSION_HEX < 0x05007006
+#error "wolfSSL 5.7.6 or newer is required to coexist with OpenSSL"
+#endif
 
 /* To determine what functions are available we rely on one or both of:
    - the user's options.h generated by wolfSSL