diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2018-11-02 16:04:50 +0100 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2018-11-23 08:22:51 +0000 |
commit | 5ee35abc39fe35ecf51faac01938ba7ca94e9fb8 (patch) | |
tree | 3027f055cb1b8fc68299396adc0db52a7842b4d1 | |
parent | bac5a37663249edb9a9746687a7128c013af0309 (diff) | |
download | qtwebsockets-5ee35abc39fe35ecf51faac01938ba7ca94e9fb8.tar.gz |
tst_qwebsocketserver: force TLS 1.2 for the PSK test
When using TLS 1.3 the psk callback is called on the start of a
connection. Force TLS 1.2 to avoid this.
Task-number: QTBUG-71560
Change-Id: I97df3a9d2f100d10b4a1d2e8d0e4696688ec66ac
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 7022a1f7e8f703815022bc7d0956da54f9f7a3c1)
-rw-r--r-- | tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp b/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp index 8a3760d..9b3d5b6 100644 --- a/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp +++ b/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp @@ -35,6 +35,7 @@ #ifndef QT_NO_SSL #include <QtNetwork/qsslcipher.h> #include <QtNetwork/qsslkey.h> +#include <QtNetwork/qsslsocket.h> #endif #include <QtWebSockets/QWebSocketServer> #include <QtWebSockets/QWebSocket> @@ -389,6 +390,8 @@ void tst_QWebSocketServer::tst_preSharedKey() list << cipher; QSslConfiguration config = QSslConfiguration::defaultConfiguration(); + if (QSslSocket::sslLibraryVersionNumber() >= 0x10101000L) + config.setProtocol(QSsl::TlsV1_2); // With TLS 1.3 there are some issues with PSK, force 1.2 config.setCiphers(list); config.setPeerVerifyMode(QSslSocket::VerifyNone); config.setPreSharedKeyIdentityHint(PSK_SERVER_IDENTITY_HINT); @@ -409,6 +412,8 @@ void tst_QWebSocketServer::tst_preSharedKey() QWebSocket socket; QSslConfiguration socketConfig = QSslConfiguration::defaultConfiguration(); + if (QSslSocket::sslLibraryVersionNumber() >= 0x10101000L) + socketConfig.setProtocol(QSsl::TlsV1_2); // With TLS 1.3 there are some issues with PSK, force 1.2 socketConfig.setPeerVerifyMode(QSslSocket::VerifyNone); socketConfig.setCiphers(list); socket.setSslConfiguration(socketConfig); |