openssl: remove get_ssl_version_txt in favor of SSL_get_version

openssl: use SSL_get_version to get connection protocol

Replace our bespoke get_ssl_version_txt in favor of SSL_get_version.
We can get rid of few lines of code, since SSL_get_version achieve
the exact same thing

Closes #6665
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Signed-off-by: Jean-Philippe Menil <jpmenil@gmail.com>
This commit is contained in:
Jean-Philippe Menil 2021-02-26 09:10:18 +01:00 committed by Daniel Gustafsson
parent 09a5bff1c9
commit 8779bfe77b
1 changed files with 1 additions and 30 deletions

View File

@ -2254,35 +2254,6 @@ select_next_proto_cb(SSL *ssl,
}
#endif /* HAS_NPN */
#ifndef CURL_DISABLE_VERBOSE_STRINGS
static const char *
get_ssl_version_txt(SSL *ssl)
{
if(!ssl)
return "";
switch(SSL_version(ssl)) {
#ifdef TLS1_3_VERSION
case TLS1_3_VERSION:
return "TLSv1.3";
#endif
#if OPENSSL_VERSION_NUMBER >= 0x1000100FL
case TLS1_2_VERSION:
return "TLSv1.2";
case TLS1_1_VERSION:
return "TLSv1.1";
#endif
case TLS1_VERSION:
return "TLSv1.0";
case SSL3_VERSION:
return "SSLv3";
case SSL2_VERSION:
return "SSLv2";
}
return "unknown";
}
#endif
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) /* 1.1.0 */
static CURLcode
set_ssl_version_min_max(SSL_CTX *ctx, struct connectdata *conn)
@ -3386,7 +3357,7 @@ static CURLcode ossl_connect_step2(struct Curl_easy *data,
/* Informational message */
infof(data, "SSL connection using %s / %s\n",
get_ssl_version_txt(backend->handle),
SSL_get_version(backend->handle),
SSL_get_cipher(backend->handle));
#ifdef HAS_ALPN