From c21cee827f94d1523301f6fe45b54d993b3a1abc Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 18 May 2017 16:15:39 +0200 Subject: [PATCH] QSslSocket (OpenSSL) make supportsSsl return false, if v >= 1.1 Our OpenSSL backend allows missing symbols and in general protected from possible related failures. Unfortunately, for OpenSSL 1.1 this means not only missing symbols (removed functions), but new incompatible opaque data-structures and our 1.0 code trying to use them and probably accessing some data-members via macros - we end up in UB and crashes. SSLeay, which returns a version number, was removed in 1.1. A failure to resolve this symbol we consider as a version mismatch and we make 'supportsSsl' to return false. Task-number: QTCREATORBUG-18137 Change-Id: I5cd270f9c61a729105149779ee7277816f9467d7 Reviewed-by: Richard J. Moore Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslsocket_openssl_symbols.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 1b2419ef07..c344a94427 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -1028,9 +1028,18 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(d2i_PKCS12_bio) RESOLVEFUNC(PKCS12_free) - symbolsResolved = true; delete libs.first; delete libs.second; + if (!_q_SSLeay || q_SSLeay() >= 0x10100000L) { + // OpenSSL 1.1 deprecated and removed SSLeay. We consider a failure to + // resolve this symbol as a failure to resolve symbols. + // The right operand of '||' above ... a bit of paranoia. + qCWarning(lcSsl, "Incompatible version of OpenSSL"); + return false; + } + + symbolsResolved = true; + return true; } #endif // QT_CONFIG(library)