QSslContext: Use 0 instead of TLS_MAX_VERSION

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 <perezmeyer@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
bb10
Dmitry Shachnev 2018-09-11 20:35:13 +03:00 committed by Lisandro Damián Nicanor Pérez Meyer
parent 4b7ff8e98c
commit 6948bf20a7
1 changed files with 4 additions and 4 deletions

View File

@ -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