diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-28 22:23:32 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-28 22:23:32 (GMT) |
commit | e391d5bb96e08db99ecb5e9efcda439450922dcc (patch) | |
tree | 2bc37edc3790e2b3ffd36faeb5a052b6387d080c /src/network | |
parent | 54155c773c7a879d967e577e1d24ce828850c90a (diff) | |
parent | 2b599833c61de7bb164b0dffb5e28194d311972b (diff) | |
download | Qt-e391d5bb96e08db99ecb5e9efcda439450922dcc.zip Qt-e391d5bb96e08db99ecb5e9efcda439450922dcc.tar.gz Qt-e391d5bb96e08db99ecb5e9efcda439450922dcc.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
Enable SSE2 for MSVC x64 builds, as it was incorrectly disabled
Updated JavaScriptCore from /home/khansen/dev/qtwebkit-qtscript-integration to javascriptcore-snapshot-28062010 ( 0fccd26d3624e80cf68873701ef70ad72ca66bec )
ignore *.vcxproj.user
doc: Added more DITA output to the XML generator
Don't load ciphers and system certificates for QSslSocket::supportsSsl()
Doc: Fixed whitespace issues and added missing files to lists.
Doc: Fixed links in the QML documentation.
Doc: Changed links to explicitly refer to QML objects.
qdoc: Added a workaround for QML/Qt class name clashes.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/ssl/qsslsocket.cpp | 2 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_openssl.cpp | 50 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_p.h | 10 |
3 files changed, 50 insertions, 12 deletions
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index a8c602a..f85fa84 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1556,7 +1556,7 @@ QList<QSslError> QSslSocket::sslErrors() const */ bool QSslSocket::supportsSsl() { - return QSslSocketPrivate::ensureInitialized(); + return QSslSocketPrivate::supportsSsl(); } /*! diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 9bd93a2..fa26fe8 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -72,6 +72,9 @@ QT_BEGIN_NAMESPACE +bool QSslSocketPrivate::s_libraryLoaded = false; +bool QSslSocketPrivate::s_loadedCiphersAndCerts = false; + // Useful defines #define SSL_ERRORSTR() QString::fromLocal8Bit(q_ERR_error_string(q_ERR_get_error(), NULL)) @@ -398,19 +401,24 @@ void QSslSocketPrivate::deinitialize() /*! \internal - Declared static in QSslSocketPrivate, makes sure the SSL libraries have - been initialized. + Does the minimum amount of initialization to determine whether SSL + is supported or not. */ -bool QSslSocketPrivate::ensureInitialized() + +bool QSslSocketPrivate::supportsSsl() +{ + return ensureLibraryLoaded(); +} + +bool QSslSocketPrivate::ensureLibraryLoaded() { if (!q_resolveOpenSslSymbols()) return false; // Check if the library itself needs to be initialized. QMutexLocker locker(openssl_locks()->initLock()); - static int q_initialized = false; - if (!q_initialized) { - q_initialized = true; + if (!s_libraryLoaded) { + s_libraryLoaded = true; // Initialize OpenSSL. q_CRYPTO_set_id_callback(id_function); @@ -447,10 +455,33 @@ bool QSslSocketPrivate::ensureInitialized() if (!attempts) return false; } - - resetDefaultCiphers(); - setDefaultCaCertificates(systemCaCertificates()); } + return true; +} + +void QSslSocketPrivate::ensureCiphersAndCertsLoaded() +{ + 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) @@ -481,7 +512,6 @@ bool QSslSocketPrivate::ensureInitialized() qWarning("could not load crypt32 library"); // should never happen } #endif - return true; } /*! diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index d3c3858..09775bc 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -108,7 +108,8 @@ public: // that was used for connecting to. QString verificationPeerName; - static bool ensureInitialized(); + static bool supportsSsl(); + static void ensureInitialized(); static void deinitialize(); static QList<QSslCipher> defaultCiphers(); static QList<QSslCipher> supportedCiphers(); @@ -154,6 +155,13 @@ public: virtual void disconnectFromHost() = 0; virtual void disconnected() = 0; virtual QSslCipher sessionCipher() const = 0; + +private: + static bool ensureLibraryLoaded(); + static void ensureCiphersAndCertsLoaded(); + + static bool s_libraryLoaded; + static bool s_loadedCiphersAndCerts; }; QT_END_NAMESPACE |