From d23d2816fb963c22c330d60bcd0b212b08cc925b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Fri, 15 Oct 2021 14:44:07 +0200 Subject: QOpenSSLBackend: Properly load 3.0 when compiled with 3.0 The naming updated but the version suffix is hardcoded on windows and it was overlooked when work was done to support OpenSSL 3. Fixes: QTBUG-97116 Change-Id: Iec15d772c54ed214940ec5634a0929485478f771 Reviewed-by: Timur Pocheptsov (cherry picked from commit ed3e1ecb2797651c64a7bb88c2c73e83e212190e) --- src/network/ssl/qsslsocket_openssl_symbols.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/network/ssl/qsslsocket_openssl_symbols.cpp') diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 75aef060e0..675343abd4 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -675,7 +675,14 @@ static LoadedOpenSsl loadOpenSsl() LoadedOpenSsl result; // With OpenSSL 1.1 the names have changed to libssl-1_1 and libcrypto-1_1 for builds using - // MSVC and GCC, with architecture suffixes for non-x86 builds. + // MSVC and GCC. For 3.0 the version suffix changed again, to just '3'. + // For non-x86 builds, an architecture suffix is also appended. + +#if (OPENSSL_VERSION_NUMBER >> 28) < 3 +#define QT_OPENSSL_VERSION "1_1" +#elif OPENSSL_VERSION_MAJOR == 3 // Starting with 3.0 this define is available +#define QT_OPENSSL_VERSION "3" +#endif // > 3 intentionally left undefined #if defined(Q_PROCESSOR_X86_64) #define QT_SSL_SUFFIX "-x64" @@ -687,8 +694,8 @@ static LoadedOpenSsl loadOpenSsl() #define QT_SSL_SUFFIX #endif - tryToLoadOpenSslWin32Library(QLatin1String("libssl-1_1" QT_SSL_SUFFIX), - QLatin1String("libcrypto-1_1" QT_SSL_SUFFIX), result); + tryToLoadOpenSslWin32Library(QLatin1String("libssl-" QT_OPENSSL_VERSION QT_SSL_SUFFIX), + QLatin1String("libcrypto-" QT_OPENSSL_VERSION QT_SSL_SUFFIX), result); #undef QT_SSL_SUFFIX return result; -- cgit v1.2.3