From 4ad0770a7e3d5091efd67df7c5d18ac66d0d9be2 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 21 Feb 2019 13:50:16 +0100 Subject: [PATCH] Silenced function pointer cast warnings for BIO_callback_ctrl --- libfreerdp/core/transport.c | 2 +- libfreerdp/crypto/tls.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index ee64eb9b8..bf3bc1127 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -300,7 +300,7 @@ BOOL transport_connect_tls(rdpTransport* transport) transport->frontBio = tls->bio; BIO_callback_ctrl(tls->bio, BIO_CTRL_SET_CALLBACK, - (bio_info_cb*) transport_ssl_cb); + (bio_info_cb*)(void*) transport_ssl_cb); SSL_set_app_data(tls->ssl, transport); if (!transport->frontBio) diff --git a/libfreerdp/crypto/tls.c b/libfreerdp/crypto/tls.c index 6b21835fb..6e00571b1 100644 --- a/libfreerdp/crypto/tls.c +++ b/libfreerdp/crypto/tls.c @@ -482,7 +482,7 @@ static int bio_rdp_tls_free(BIO* bio) static long bio_rdp_tls_callback_ctrl(BIO* bio, int cmd, bio_info_cb* fp) { - int status = 0; + long status = 0; BIO_RDP_TLS* tls; if (!bio) @@ -496,8 +496,15 @@ static long bio_rdp_tls_callback_ctrl(BIO* bio, int cmd, bio_info_cb* fp) switch (cmd) { case BIO_CTRL_SET_CALLBACK: - SSL_set_info_callback(tls->ssl, (void (*)(const SSL*, int, int)) fp); - status = 1; + { + typedef void (*fkt_t)(const SSL*, int, int); + /* Documented since https://www.openssl.org/docs/man1.1.1/man3/BIO_set_callback.html + * the argument is not really of type bio_info_cb* and must be cast + * to the required type */ + fkt_t fkt = (fkt_t)(void*)fp; + SSL_set_info_callback(tls->ssl, fkt); + status = 1; + } break; default: @@ -1058,6 +1065,7 @@ BOOL tls_send_alert(rdpTls* tls) if (tls->ssl->s3->wbuf.left == 0) tls->ssl->method->ssl_dispatch_alert(tls->ssl); } + #endif return TRUE; }