summaryrefslogtreecommitdiffstats
path: root/src/plugins/tls
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2023-11-07 10:52:49 +0100
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2023-11-08 18:24:17 +0100
commit3159b337f01767412f51c649d30a72ac8417989b (patch)
tree6a0af64cb81f981461d547f3a95d6589753db685 /src/plugins/tls
parent01d55f0203e70e1345b068d940bc31026f181bf3 (diff)
Openssl V3: try to work around the lack of SHLIB_VERSION_NUMBER
It's no more defined in opensslv.h, try to use OPENSSL_SHLIB_VERSION instead. Pick-to: 6.6 6.5 Fixes: QTBUG-116295 Change-Id: Ie465f4147e0ec95897bd8d35f71241884bf64b4e Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/plugins/tls')
-rw-r--r--src/plugins/tls/openssl/qsslsocket_openssl_symbols.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/plugins/tls/openssl/qsslsocket_openssl_symbols.cpp b/src/plugins/tls/openssl/qsslsocket_openssl_symbols.cpp
index 373f38a397..2d6e0e2567 100644
--- a/src/plugins/tls/openssl/qsslsocket_openssl_symbols.cpp
+++ b/src/plugins/tls/openssl/qsslsocket_openssl_symbols.cpp
@@ -749,10 +749,22 @@ static LoadedOpenSsl loadOpenSsl()
#ifdef Q_OS_OPENBSD
libcrypto->setLoadHints(QLibrary::ExportExternalSymbolsHint);
#endif
-#if defined(SHLIB_VERSION_NUMBER) && !defined(Q_OS_QNX) // on QNX, the libs are always libssl.so and libcrypto.so
+
+#if !defined(Q_OS_QNX) // on QNX, the libs are always libssl.so and libcrypto.so
+
+#if defined(OPENSSL_SHLIB_VERSION)
+ // OpenSSL v.3 does not have SLIB_VERSION_NUMBER but has OPENSSL_SHLIB_VERSION.
+ // The comment about OPENSSL_SHLIB_VERSION in opensslv.h is a bit troublesome:
+ // "This is defined in free form."
+ auto shlibVersion = QString("%1"_L1).arg(OPENSSL_SHLIB_VERSION).toLatin1();
+ libssl->setFileNameAndVersion("ssl"_L1, shlibVersion);
+ libcrypto->setFileNameAndVersion("crypto"_L1, shlibVersion);
+#elif defined(SHLIB_VERSION_NUMBER)
// first attempt: the canonical name is libssl.so.<SHLIB_VERSION_NUMBER>
libssl->setFileNameAndVersion("ssl"_L1, SHLIB_VERSION_NUMBER ""_L1);
libcrypto->setFileNameAndVersion("crypto"_L1, SHLIB_VERSION_NUMBER ""_L1);
+#endif // OPENSSL_SHLIB_VERSION
+
if (libcrypto->load() && libssl->load()) {
// libssl.so.<SHLIB_VERSION_NUMBER> and libcrypto.so.<SHLIB_VERSION_NUMBER> found
return result;
@@ -760,7 +772,7 @@ static LoadedOpenSsl loadOpenSsl()
libssl->unload();
libcrypto->unload();
}
-#endif
+#endif // !defined(Q_OS_QNX)
#ifndef Q_OS_DARWIN
// second attempt: find the development files libssl.so and libcrypto.so