summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@nokia.com>2011-11-24 12:15:18 (GMT)
committerJoão Abecasis <joao.abecasis@nokia.com>2011-11-28 10:00:23 (GMT)
commite4bdb5d8144f62d803f1d904275db91c155d3561 (patch)
tree0bb2015f9b960affdee51029a38b25a8aa686a50
parentf48870f8efbcf7ca4e344e48e4f61334f35b9c6c (diff)
downloadQt-e4bdb5d8144f62d803f1d904275db91c155d3561.zip
Qt-e4bdb5d8144f62d803f1d904275db91c155d3561.tar.gz
Qt-e4bdb5d8144f62d803f1d904275db91c155d3561.tar.bz2
SSL: fix build when compiled with -openssl-linked
... and only resolve the functions when the methods are available. SSL 2 functionality is not always available in OpenSSL anymore. Change-Id: Ia3178685b26c67ac55447476789e06710b596181 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Shane Kearns <shane.kearns@accenture.com> (cherry picked from commit 09404c072fec2e195d8114dc4d95ce3683c341cf)
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp4
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp8
2 files changed, 12 insertions, 0 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 5f520f7..872b19c 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -254,7 +254,11 @@ bool QSslSocketBackendPrivate::initSslContext()
init_context:
switch (configuration.protocol) {
case QSsl::SslV2:
+#ifndef OPENSSL_NO_SSL2
ctx = q_SSL_CTX_new(client ? q_SSLv2_client_method() : q_SSLv2_server_method());
+#else
+ ctx = 0; // SSL 2 not supported by the system, but chosen deliberately -> error
+#endif
break;
case QSsl::SslV3:
ctx = q_SSL_CTX_new(client ? q_SSLv3_client_method() : q_SSLv3_server_method());
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index 90a840f..51ecf5d 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -222,11 +222,15 @@ DEFINEFUNC(void, SSL_set_accept_state, SSL *a, a, return, DUMMYARG)
DEFINEFUNC(void, SSL_set_connect_state, SSL *a, a, return, DUMMYARG)
DEFINEFUNC(int, SSL_shutdown, SSL *a, a, return -1, return)
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+#ifndef OPENSSL_NO_SSL2
DEFINEFUNC(const SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return)
+#endif
DEFINEFUNC(const SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(const SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(const SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return)
+#ifndef OPENSSL_NO_SSL2
DEFINEFUNC(const SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, return)
+#endif
DEFINEFUNC(const SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(const SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(const SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return)
@@ -741,11 +745,15 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(SSL_set_connect_state)
RESOLVEFUNC(SSL_shutdown)
RESOLVEFUNC(SSL_write)
+#ifndef OPENSSL_NO_SSL2
RESOLVEFUNC(SSLv2_client_method)
+#endif
RESOLVEFUNC(SSLv3_client_method)
RESOLVEFUNC(SSLv23_client_method)
RESOLVEFUNC(TLSv1_client_method)
+#ifndef OPENSSL_NO_SSL2
RESOLVEFUNC(SSLv2_server_method)
+#endif
RESOLVEFUNC(SSLv3_server_method)
RESOLVEFUNC(SSLv23_server_method)
RESOLVEFUNC(TLSv1_server_method)