From: orbea Date: Wed, 30 Apr 2025 18:47:13 +0000 (-0700) Subject: compat_openssl: fix for LibreSSL 4.1.0 X-Git-Tag: tor-0.4.8.17~9^2~1 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=d11d1ded896083d96b8286122f4937009b347ba9;p=thirdparty%2Ftor.git compat_openssl: fix for LibreSSL 4.1.0 Starting with LibreSSL 4.1.0 this now causes a build failure: src/lib/tls/tortls_openssl.c: In function 'tor_tls_setup_session_secret_cb': src/lib/tls/tortls_openssl.c:1059:39: error: passing argument 2 of 'SSL_set_session_secret_cb' from incompatible pointer type [-Wincompatible-pointer-types] 1059 | SSL_set_session_secret_cb(tls->ssl, tor_tls_session_secret_cb, NULL); | ^~~~~~~~~~~~~~~~~~~~~~~~~ | | | int (*)(SSL *, void *, int *, struct stack_st_SSL_CIPHER *, SSL_CIPHER **, void *) {aka int (*)(struct ssl_st *, void *, int *, struct stack_st_SSL_CIPHER *, struct ssl_cipher_st **, void *)} In file included from src/lib/tls/tortls_openssl.c:48: /usr/include/openssl/ssl.h:1489:30: note: expected 'tls_session_secret_cb_fn' {aka 'int (*)(struct ssl_st *, void *, int *, struct stack_st_SSL_CIPHER *, const struct ssl_cipher_st **, void *)'} but argument is of type 'int (*)(SSL *, void *, int *, struct stack_st_SSL_CIPHER *, SSL_CIPHER **, void *)' {aka 'int (*)(struct ssl_st *, void *, int *, struct stack_st_SSL_CIPHER *, struct ssl_cipher_st **, void *)'} 1489 | tls_session_secret_cb_fn tls_session_secret_cb, void *arg); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ Signed-off-by: orbea --- diff --git a/src/lib/crypt_ops/compat_openssl.h b/src/lib/crypt_ops/compat_openssl.h index c5eccdb015..07efc53402 100644 --- a/src/lib/crypt_ops/compat_openssl.h +++ b/src/lib/crypt_ops/compat_openssl.h @@ -37,10 +37,15 @@ (((st) == SSL3_ST_SW_SRVR_HELLO_A) || \ ((st) == SSL3_ST_SW_SRVR_HELLO_B)) #define OSSL_HANDSHAKE_STATE int -#define CONST_IF_OPENSSL_1_1_API #else #define STATE_IS_SW_SERVER_HELLO(st) \ ((st) == TLS_ST_SW_SRVR_HELLO) +#endif + +#if !defined(OPENSSL_1_1_API) || (defined(LIBRESSL_VERSION_NUMBER) && \ + LIBRESSL_VERSION_NUMBER < 0x4010000fL) +#define CONST_IF_OPENSSL_1_1_API +#else #define CONST_IF_OPENSSL_1_1_API const #endif