diff options
author | Brian Prodoehl <bprodoehl@connectify.me> | 2015-05-19 11:10:28 -0400 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-05-19 22:54:42 +0200 |
commit | a393d64456b60abee0806f4e118239412c44fb63 (patch) | |
tree | 5c0b1b4ac2bb487a1b3c3b9fd754c3b9ec3cb26c /lib/vtls | |
parent | 265f83a9f02880d34a82a6b6143ab4059002615a (diff) |
openssl: Use SSL_CTX_set_msg_callback and SSL_CTX_set_msg_callback_arg
BoringSSL removed support for direct callers of SSL_CTX_callback_ctrl
and SSL_CTX_ctrl, so move to a way that should work on BoringSSL and
OpenSSL.
re #275
Diffstat (limited to 'lib/vtls')
-rw-r--r-- | lib/vtls/openssl.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 16053a768..667e76a55 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -1537,8 +1537,8 @@ static const char *tls_rt_type(int type) * Our callback from the SSL/TLS layers. */ static void ssl_tls_trace(int direction, int ssl_ver, int content_type, - const void *buf, size_t len, const SSL *ssl, - struct connectdata *conn) + const void *buf, size_t len, SSL *ssl, + void *userp) { struct SessionHandle *data; const char *msg_name, *tls_rt_name; @@ -1546,6 +1546,7 @@ static void ssl_tls_trace(int direction, int ssl_ver, int content_type, char unknown[32]; int msg_type, txt_len; const char *verstr; + struct connectdata *conn = userp; if(!conn || !conn->data || !conn->data->set.fdebug || (direction != 0 && direction != 1)) @@ -1805,16 +1806,9 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex) #ifdef SSL_CTRL_SET_MSG_CALLBACK if(data->set.fdebug && data->set.verbose) { - /* the SSL trace callback is only used for verbose logging so we only - inform about failures of setting it */ - if(!SSL_CTX_callback_ctrl(connssl->ctx, SSL_CTRL_SET_MSG_CALLBACK, - (void (*)(void))ssl_tls_trace)) { - infof(data, "SSL: couldn't set callback!\n"); - } - else if(!SSL_CTX_ctrl(connssl->ctx, SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, - conn)) { - infof(data, "SSL: couldn't set callback argument!\n"); - } + /* the SSL trace callback is only used for verbose logging */ + SSL_CTX_set_msg_callback(connssl->ctx, ssl_tls_trace); + SSL_CTX_set_msg_callback_arg(connssl->ctx, conn); } #endif |