]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
openssl: define `HAVE_KEYLOG_CALLBACK` before use
authorViktor Szakats <commit@vsz.me>
Mon, 27 Jan 2025 22:04:02 +0000 (23:04 +0100)
committerViktor Szakats <commit@vsz.me>
Tue, 28 Jan 2025 10:15:10 +0000 (11:15 +0100)
Before this patch this macro was used in `vtls/openssl.h` without
setting it first, causing the `keylog_done` member be present in
struct `ossl_ctx` while the code did not use it.

Follow-up to 3210101088dfa3d6a125d213226b092f2f866722 #13172
Closes #16105

lib/vtls/openssl.c
lib/vtls/openssl.h

index ae1862d66444d048d8eac1300036f5415b9d781f..f34ddafef3c82f2cbc77f150c3e8504a8942e84d 100644 (file)
 #define FREE_PKEY_PARAM_BIGNUM(name)
 #endif
 
-/*
- * Whether SSL_CTX_set_keylog_callback is available.
- * OpenSSL: supported since 1.1.1 https://github.com/openssl/openssl/pull/2287
- * BoringSSL: supported since d28f59c27bac (committed 2015-11-19)
- * LibreSSL: not supported. 3.5.0+ has a stub function that does nothing.
- */
-#if (OPENSSL_VERSION_NUMBER >= 0x10101000L && \
-     !defined(LIBRESSL_VERSION_NUMBER)) || \
-    defined(OPENSSL_IS_BORINGSSL)
-#define HAVE_KEYLOG_CALLBACK
-#endif
-
 /* Whether SSL_CTX_set_ciphersuites is available.
  * OpenSSL: supported since 1.1.1 (commit a53b5be6a05)
  * BoringSSL: no
index 5f430a2178298e7e2459f17a058bc21536a794fc..b2940f43099354942d0bd2c6d944e5f5a748b53d 100644 (file)
  * This header should only be needed to get included by vtls.c, openssl.c
  * and ngtcp2.c
  */
+#include <openssl/opensslv.h>
 #include <openssl/ossl_typ.h>
 #include <openssl/ssl.h>
 
 #include "urldata.h"
 
+/*
+ * Whether SSL_CTX_set_keylog_callback is available.
+ * OpenSSL: supported since 1.1.1 https://github.com/openssl/openssl/pull/2287
+ * BoringSSL: supported since d28f59c27bac (committed 2015-11-19)
+ * LibreSSL: not supported. 3.5.0+ has a stub function that does nothing.
+ */
+#if (OPENSSL_VERSION_NUMBER >= 0x10101000L && \
+     !defined(LIBRESSL_VERSION_NUMBER)) || \
+    defined(OPENSSL_IS_BORINGSSL)
+#define HAVE_KEYLOG_CALLBACK
+#endif
+
 struct ssl_peer;
 
 /* Struct to hold a curl OpenSSL instance */