Silenced function pointer cast warnings for BIO_callback_ctrl

This commit is contained in:
Armin Novak 2019-02-21 13:50:16 +01:00
parent 5364cf37b1
commit 4ad0770a7e
2 changed files with 12 additions and 4 deletions

View File

@ -300,7 +300,7 @@ BOOL transport_connect_tls(rdpTransport* transport)
transport->frontBio = tls->bio; transport->frontBio = tls->bio;
BIO_callback_ctrl(tls->bio, BIO_CTRL_SET_CALLBACK, 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); SSL_set_app_data(tls->ssl, transport);
if (!transport->frontBio) if (!transport->frontBio)

View File

@ -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) 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; BIO_RDP_TLS* tls;
if (!bio) if (!bio)
@ -496,8 +496,15 @@ static long bio_rdp_tls_callback_ctrl(BIO* bio, int cmd, bio_info_cb* fp)
switch (cmd) switch (cmd)
{ {
case BIO_CTRL_SET_CALLBACK: case BIO_CTRL_SET_CALLBACK:
SSL_set_info_callback(tls->ssl, (void (*)(const SSL*, int, int)) fp); {
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; status = 1;
}
break; break;
default: default:
@ -1058,6 +1065,7 @@ BOOL tls_send_alert(rdpTls* tls)
if (tls->ssl->s3->wbuf.left == 0) if (tls->ssl->s3->wbuf.left == 0)
tls->ssl->method->ssl_dispatch_alert(tls->ssl); tls->ssl->method->ssl_dispatch_alert(tls->ssl);
} }
#endif #endif
return TRUE; return TRUE;
} }