diff options
author | Peter Hartmann <peter.hartmann@nokia.com> | 2010-07-09 08:44:59 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2010-07-09 11:41:51 (GMT) |
commit | b1a52a071e3741d46df5c45423c6654d517ac4c2 (patch) | |
tree | e1461ca94bea2d6ff2a808390be91792d2ab3123 /src/network | |
parent | 230ab8adb281aabc2d0ebf41ade5f2ec7f11e020 (diff) | |
download | Qt-b1a52a071e3741d46df5c45423c6654d517ac4c2.zip Qt-b1a52a071e3741d46df5c45423c6654d517ac4c2.tar.gz Qt-b1a52a071e3741d46df5c45423c6654d517ac4c2.tar.bz2 |
SSL library loading: load system libs only once
... and make the loading thread-safe.
The global methods for loading the OpenSSL libraries
and the system libraries are accessed from within
different QSslSocket and QSslConfiguration instances,
so they need to be thread-safe.
Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/ssl/qsslsocket_openssl.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index d7088ee..b537582 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -475,27 +475,12 @@ bool QSslSocketPrivate::ensureLibraryLoaded() void QSslSocketPrivate::ensureCiphersAndCertsLoaded() { + QMutexLocker locker(openssl_locks()->initLock()); if (s_loadedCiphersAndCerts) return; s_loadedCiphersAndCerts = true; resetDefaultCiphers(); - setDefaultCaCertificates(systemCaCertificates()); -} - -/*! - \internal - - Declared static in QSslSocketPrivate, makes sure the SSL libraries have - been initialized. -*/ - -void QSslSocketPrivate::ensureInitialized() -{ - if (!supportsSsl()) - return; - - ensureCiphersAndCertsLoaded(); //load symbols needed to receive certificates from system store #if defined(Q_OS_MAC) @@ -532,6 +517,22 @@ void QSslSocketPrivate::ensureInitialized() qWarning("could not load crypt32 library"); // should never happen } #endif + setDefaultCaCertificates(systemCaCertificates()); +} + +/*! + \internal + + Declared static in QSslSocketPrivate, makes sure the SSL libraries have + been initialized. +*/ + +void QSslSocketPrivate::ensureInitialized() +{ + if (!supportsSsl()) + return; + + ensureCiphersAndCertsLoaded(); } /*! |