From 4b8c9d1bd7a158054b8ba7778e9bff086f82d709 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Thu, 15 Nov 2018 15:58:19 +0000 Subject: [PATCH] Replace SSL_get_version(). --- src/openssl/tls.c | 7 +++++++ src/openssl/tls.h | 8 ++++++++ src/stub.c | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/openssl/tls.c b/src/openssl/tls.c index ad940ef8..635ba5ee 100644 --- a/src/openssl/tls.c +++ b/src/openssl/tls.c @@ -342,6 +342,13 @@ _getdns_tls_session* _getdns_tls_connection_get_session(_getdns_tls_connection* return res; } +const char* _getdns_tls_connection_get_version(_getdns_tls_connection* conn) +{ + if (!conn || !conn->ssl) + return NULL; + return SSL_get_version(conn->ssl); +} + getdns_return_t _getdns_tls_connection_do_handshake(_getdns_tls_connection* conn) { int r; diff --git a/src/openssl/tls.h b/src/openssl/tls.h index dda05030..7e95a165 100644 --- a/src/openssl/tls.h +++ b/src/openssl/tls.h @@ -83,6 +83,14 @@ getdns_return_t _getdns_tls_connection_set_curves_list(_getdns_tls_connection* c getdns_return_t _getdns_tls_connection_set_session(_getdns_tls_connection* conn, _getdns_tls_session* s); _getdns_tls_session* _getdns_tls_connection_get_session(_getdns_tls_connection* conn); +/** + * Report the TLS version of the connection. + * + * @param conn the connection. + * @return string with the connection description, NULL on error. + */ +const char* _getdns_tls_connection_get_version(_getdns_tls_connection* conn); + /** * Attempt TLS handshake. * diff --git a/src/stub.c b/src/stub.c index 75ee576d..fdcc9db6 100644 --- a/src/stub.c +++ b/src/stub.c @@ -1865,7 +1865,7 @@ upstream_write_cb(void *userarg) cert, &netreq->debug_tls_peer_cert.data); X509_free(cert); } - netreq->debug_tls_version = SSL_get_version(netreq->upstream->tls_obj->ssl); + netreq->debug_tls_version = _getdns_tls_connection_get_version(netreq->upstream->tls_obj); } /* Need this because auth status is reset on connection close */ netreq->debug_tls_auth_status = netreq->upstream->tls_auth_state;