tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit d11d1ded896083d96b8286122f4937009b347ba9
parent ba88ad6b09ab2b4a222503a9f758c32932d37096
Author: orbea <orbea@riseup.net>
Date:   Wed, 30 Apr 2025 11:47:13 -0700

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 <orbea@riseup.net>

Diffstat:
Msrc/lib/crypt_ops/compat_openssl.h | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 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