From 8cf3998f1a95f7890379262df0d568c071418a8f Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Thu, 14 Jan 2021 15:11:13 +0100 Subject: [PATCH] tls-crypto: Only log modified TLS versions if successfully set If no cipher suites are available, the new versions are the previous values but reversed (i.e. the versions were not changed but we still ended up with a log message saying "TLS min/max TLS 1.3/TLS 1.0 ..."). Also switched to using the numeric version names to avoid the repeated "TLS" prefix. --- src/libtls/tls_crypto.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libtls/tls_crypto.c b/src/libtls/tls_crypto.c index e8126c000..23c36374e 100644 --- a/src/libtls/tls_crypto.c +++ b/src/libtls/tls_crypto.c @@ -1222,12 +1222,12 @@ static void build_cipher_suite_list(private_tls_crypto_t *this) new_max_version = min(new_max_version, max_version); new_min_version = max(new_min_version, min_version); - if (min_version != new_min_version || max_version != new_max_version) + if ((min_version != new_min_version || max_version != new_max_version) && + this->tls->set_version(this->tls, new_min_version, new_max_version)) { - this->tls->set_version(this->tls, new_min_version, new_max_version); DBG2(DBG_TLS, "TLS min/max %N/%N according to the cipher suites", - tls_version_names, new_min_version, - tls_version_names, new_max_version); + tls_numeric_version_names, new_min_version, + tls_numeric_version_names, new_max_version); } }