From 6948bf20a73d09e867fd7c2d89052237d94b7d6a Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Tue, 11 Sep 2018 20:35:13 +0300 Subject: QSslContext: Use 0 instead of TLS_MAX_VERSION MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to the SSL_CTX_set_max_proto_version manpage [1]: > Setting the minimum or maximum version to 0, will enable protocol > versions down to the lowest version, or up to the highest version > supported by the library, respectively. This should make it possible to use Qt Network with older versions of libssl than it was compiled against. In particular, use with 1.1.0 when compiled against 1.1.1. Also, one of OpenSSL developers is suggesting to remove TLS_MAX_VERSION from the public header in the future [2]. [1] https://www.openssl.org/docs/man1.1.0/ssl/SSL_CTX_set_max_proto_version.html#DESCRIPTION [2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908567#59 Change-Id: Ie76054b917daa8e54d5c0156e848dbaca7bb8a82 Reviewed-by: Lisandro Damián Nicanor Pérez Meyer Reviewed-by: Edward Welbourne Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslcontext_openssl11.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/ssl/qsslcontext_openssl11.cpp b/src/network/ssl/qsslcontext_openssl11.cpp index 5c68ed41db..4fb33cb0a4 100644 --- a/src/network/ssl/qsslcontext_openssl11.cpp +++ b/src/network/ssl/qsslcontext_openssl11.cpp @@ -124,20 +124,20 @@ init_context: case QSsl::TlsV1SslV3: case QSsl::AnyProtocol: minVersion = SSL3_VERSION; - maxVersion = TLS_MAX_VERSION; + maxVersion = 0; break; case QSsl::SecureProtocols: case QSsl::TlsV1_0OrLater: minVersion = TLS1_VERSION; - maxVersion = TLS_MAX_VERSION; + maxVersion = 0; break; case QSsl::TlsV1_1OrLater: minVersion = TLS1_1_VERSION; - maxVersion = TLS_MAX_VERSION; + maxVersion = 0; break; case QSsl::TlsV1_2OrLater: minVersion = TLS1_2_VERSION; - maxVersion = TLS_MAX_VERSION; + maxVersion = 0; break; case QSsl::SslV2: // This protocol is not supported by OpenSSL 1.1 and we handle -- cgit v1.2.3