summaryrefslogtreecommitdiffstats
path: root/src/network/ssl
diff options
context:
space:
mode:
authorErik van Pienbroek <epienbro@fedoraproject.org>2013-02-06 22:08:40 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-09 13:35:28 +0100
commit3798b129c032dbd2ac1ccab071ad3ad4ebc2edf3 (patch)
treee38a70cbe1cb28d1fa80ec85d4bd2e1ce49a658f /src/network/ssl
parent916f0ff663f7915387085911ceb7e2c704833e4f (diff)
Try harder to locate external OpenSSL libraries on win32
When OpenSSL is built using MSVC then the library names are named ssleay32.dll and libeay32. However, when OpenSSL is built with GCC then different library names are used like libssl-10.dll and libcrypto-10.dll (depending on the version of OpenSSL used) Change-Id: Icb79a5f82d2a511752bfc904f53a58423ce4b86b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Peter Hartmann <phartmann@rim.com> Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src/network/ssl')
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index 31cfa2d00a..e880a2452f 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -447,28 +447,46 @@ static QStringList findAllLibCrypto()
# endif
#ifdef Q_OS_WIN
-static QPair<QSystemLibrary*, QSystemLibrary*> loadOpenSslWin32()
+static bool tryToLoadOpenSslWin32Library(QLatin1String ssleay32LibName, QLatin1String libeay32LibName, QPair<QSystemLibrary*, QSystemLibrary*> &pair)
{
- QPair<QSystemLibrary*,QSystemLibrary*> pair;
pair.first = 0;
pair.second = 0;
- QSystemLibrary *ssleay32 = new QSystemLibrary(QLatin1String("ssleay32"));
+ QSystemLibrary *ssleay32 = new QSystemLibrary(ssleay32LibName);
if (!ssleay32->load(false)) {
- // Cannot find ssleay32.dll
delete ssleay32;
- return pair;
+ return FALSE;
}
- QSystemLibrary *libeay32 = new QSystemLibrary(QLatin1String("libeay32"));
+ QSystemLibrary *libeay32 = new QSystemLibrary(libeay32LibName);
if (!libeay32->load(false)) {
delete ssleay32;
delete libeay32;
- return pair;
+ return FALSE;
}
pair.first = ssleay32;
pair.second = libeay32;
+ return TRUE;
+}
+
+static QPair<QSystemLibrary*, QSystemLibrary*> loadOpenSslWin32()
+{
+ QPair<QSystemLibrary*,QSystemLibrary*> pair;
+ pair.first = 0;
+ pair.second = 0;
+
+ // When OpenSSL is built using MSVC then the libraries are named 'ssleay32.dll' and 'libeay32'dll'.
+ // When OpenSSL is built using GCC then different library names are used (depending on the OpenSSL version)
+ // The oldest version of a GCC-based OpenSSL which can be detected by the code below is 0.9.8g (released in 2007)
+ if (!tryToLoadOpenSslWin32Library(QLatin1String("ssleay32"), QLatin1String("libeay32"), pair)) {
+ if (!tryToLoadOpenSslWin32Library(QLatin1String("libssl-10"), QLatin1String("libcrypto-10"), pair)) {
+ if (!tryToLoadOpenSslWin32Library(QLatin1String("libssl-8"), QLatin1String("libcrypto-8"), pair)) {
+ tryToLoadOpenSslWin32Library(QLatin1String("libssl-7"), QLatin1String("libcrypto-7"), pair);
+ }
+ }
+ }
+
return pair;
}
#else