summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/ssl
Commit message (Collapse)AuthorAgeFilesLines
* Tests: check the output of QFile::openGiuseppe D'Angelo2024-03-271-7/+7
| | | | | | | | | | Wrap the call in QVERIFY. tst_QTextStream::read0d0d0a was also faulty as it *never* opened the file because of a broken path. Fix it with QFINDTESTDATA. Change-Id: I61a8f83beddf098d37fda13cb3bfb4aaa4913fc5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Correct license for tools filesLucie Gérard2024-03-053-3/+3
| | | | | | | | | | | | According to QUIP-18 [1], all tools file should be LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: Icd5d5be2e04819617e68ff142924de1773bebbad Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Change license for tests filesLucie Gérard2024-02-0420-20/+20
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Fix the qopenssl_symbols.h copy in the autotestMårten Nordheim2023-12-131-2/+9
| | | | | | | | It was forgotten when we originally fixed the hardcoded 1_1 version. Pick-to: 6.7 6.6 6.5 Change-Id: Iff3148d79466dac2830fe9a63d954aead96fb0ac Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Adapt ASN.1 datetime parsing to use the new century controlEdward Welbourne2023-12-081-3/+0
| | | | | | | | | | | | It previously had to kludge a 1900-to-1999 date into a 1950-to-2049 range; it can now tell QDTP to do that for it. In particular, this fixes a problem with 00-02-29, which failed to parse using 1900 as base year so couldn't be corrected to 2000-02-29, which is now the date it finds directly. Task-number: QTBUG-46843 Change-Id: I7ac936bdfb15b78daed5d237c5d921c800af4951 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Tests: remove blacklisted CIs no longer availableChristian Ehrlicher2023-12-061-5/+0
| | | | | | | | | | | | | | | | Remove the following CIs from BLACKLIST files as they are no longer used: - msvc-2015 - msvc-2017 - windows-7sp1 - opensuse-42.3 - ubuntu 16.04/18.04/20.04 - rhel 6.6/7.4/7.6 - redhatenterpriselinuxworkstation-6.6 Change-Id: Ief9550e3455a1ed211d978933262c8d5557b0fec Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Restore ASN.1 Element tests after move to pluginEdward Welbourne2023-11-283-2/+7
| | | | | | | | | | | | | | When SSL backends were broken out as plugins, various tests were suppressed since the code they test is now in a plugin, no longer part of the network libraries. The ASN.1 test is, however, fairly self-contained, so just compile it with the relevant plugin sources (which are likewise self-contained) and brute-force the paths to line up for the test. Task-number: QTBUG-46843 Change-Id: I778489e68b7361a7fd55c88d2a35257ad6a58c46 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* ASN1: speed up parsing of certificate timestampsMårten Nordheim2023-11-271-0/+6
| | | | | | | | | | | | | | | | | | | | | By parsing QDate and QTime separately it will internally parse the values as-if-by UTC. This means we avoid the overhead of figuring out what the local timezone is repeatedly for each certificate. On Windows, with Schannel, this brings QAsn1Element::toDateTime from consuming more than 97% of the test time to below 10%. The test being tst_QSslSocket::systemCaCertificates. It also goes from taking 1 minute in debug, to 1 second. As a drive-by: add a (currently) failing test for Feb 29 2000, which fails because we decode the date as 1900 before adjusting it to 2000. But there is no 1900-02-29, so it returns an invalid date. As spotted by Eddy. Pick-to: 6.6 6.5 Change-Id: Iefa73a01d710129faf6412c4fa8bc2b5d7c98bbb Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use SSL_CTX_set_dh_auto if DHparam is emptyAndré Klitzing2023-10-251-6/+10
| | | | | | | | | | [ChangeLog][QtNetwork][QSslDiffieHellmanParameters] An empty Diffie-Hellmann parameter enables auto selection of openssl backend. Fixes: QTBUG-117666 Change-Id: Ic2e0529d48542752ca801bcb4d609988e5ddff25 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSslSocket: Remove compile-time #ifdef checkVolker Hilsheimer2023-10-231-4/+0
| | | | | | | | | | | Since we use runtime plugins now and the test doesn't use any symbols from openssl Amends 486b1aec1606d6d778da6203e28640cd79ae0291 Pick-to: 6.6 6.5 Change-Id: Ib66d1ca15835c41fe138c7830ce3edd0bdce0d5f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSslSocket: remove #if openssl check for a definitionMårten Nordheim2023-10-201-2/+0
| | | | | | | | | | The declaration was moved out of the #if QT_CONFIG(openssl) block at some point, but the definition was not. This caused compilation errors when building without OpenSSL configured. Pick-to: 6.6 6.5 Change-Id: I41ed85fd57f5a912498e0f2517761b81a7b8673c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_qsslkey: Fix CMake conditionAxel Spoerl2023-09-011-2/+2
| | | | | | | | | | | | | | | Private libraries and WrapOpenSSL were linked conditional to QT_FEATURE_private_tests in the CMake file. qsslkey_p.h and open ssl symbols were included conditional to developer build. A developer build fails, with test enabled and private tests disabled. => Change the CMake condition to QT_FEATURE_developer_build, to resolve mismatch between CMake and cpp file. Pick-to: 6.6 6.5 Change-Id: I3ac93b02701e467a0b548c35d441d35a45c4568b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_QSslSocket: don't use deprecated RSA apiTimur Pocheptsov2023-08-291-0/+2
| | | | | | | | | OpenSSL 3.1.2 can be configured with no-deprecated option, in this case test fails to build. Pick-to: 6.6 6.5 6.2 Change-Id: Icaf457f55fb001b632922856dbe4bbb5bdba220e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtNetwork auto tests: compile with QT_NO_FOREACHAhmad Samir2023-08-223-6/+0
| | | | | | | | | | | | | Remove all "#undef QT_NO_FOREACH" white-listing from source files. Previous commits have removed all remaining Q_FOREACH/foreach uses in this sub-tree. Also remove one source file from NO_PCH_SOURCES in CMakeLists.txt. Task-number: QTBUG-115839 Change-Id: I02cf994eda720c028e613407342fbd6658fa62b1 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSslCertificate: port Q_FOREACH to ranged-for [5]Ahmad Samir2023-08-221-2/+1
| | | | | | | | | | | | The toString() method's parameter is a const&, the loop body doesn't change the container; and the container the parameter refers to isn't changed during iteration. Drive-by, remove braces from single-line if blocks. Task-number: QTBUG-115839 Change-Id: I363e1ed37c0f75fa6a9f8eac3393a6c10d756c1b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtNetwork auto tests: port Q_FOREACH to ranged-for [4]Ahmad Samir2023-08-221-4/+11
| | | | | | | | | | | | | Straightforward ports where the container could be made const. Use C arrays instead of QList if the data is known at compile time. Drive-by, where appropriate make the for-loop variable a const& (e.g. QString) instead of copying it for no reason. Task-number: QTBUG-115839 Change-Id: I273a386e414e5923e750072f0407226efcd4531e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtNetwork auto tests: port Q_FOREACH to ranged-for [3]Ahmad Samir2023-08-222-6/+6
| | | | | | | | | | In both cases, the container is a member of the unittest, initialized in initTestCase(), then not changed after that. So use std::as_const. Task-number: QTBUG-115839 Change-Id: I3b66127e10ac94137260d99f354de9f66a74bec7 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtNetwork auto tests: port Q_FOREACH to ranged-for [2]Ahmad Samir2023-08-221-1/+1
| | | | | | | | | | | | | | | | | The containers are created locally in the top level test functions, they can't be made const due to the way they are filled, however the loop body don't change them; even if the code in a loop would cause re-entrance du due to signal emittance or events processing, those containers aren't affected and aren't changed during iteration because the top-level test functions themselves aren't re-entered, hence use std::as_const. Drive-by change: take QHostAddress by const& when it's used as a for-loop variable (it has a QExplicitlySharedDataPointer d-pointer). Task-number: QTBUG-115839 Change-Id: I443169e10d973aba2f62854aba200fc2dc2c80aa Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtNetwork auto tests: port Q_FOREACH to ranged-for [1]Ahmad Samir2023-08-221-2/+4
| | | | | | | | | | | | | The loops were iterating over a temporary, so use a local const auto variable to hold it, and use ranged-for. Drive-by, make the for-loop variable const& instead of copying it, for any object that has a d-pointer (QNetworkAddressEntry, QHostAddress, QNetworkInterface). Task-number: QTBUG-115839 Change-Id: If96c0b2a6142fe2fa2ed45ed7e2435cc1f80e005 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSslSocket: skip tests requiring TLS v 1.0 downgradeTimur Pocheptsov2023-08-221-0/+24
| | | | | | | | | | If OpenSSL version is 3.1.1 or above - this version moved the protocol under security level 0, but the default one is 1. Pick-to: 6.6 6.5 6.2 5.15 Fixes: QTBUG-116166 Change-Id: Iaabb2cf33e2a9f280d6167233ee16080dee808b0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QDtls: use DTLS v 1.0 test data conditionallyTimur Pocheptsov2023-08-211-9/+17
| | | | | | | | | | | | Starting from OpenSSL v 3.1.1 DTLS 1.0 is only available, if the security level is 0, which is not the case most of the time. So we consider this version number to be a 'threshold' after which we don't test v 1.0 anymore. Pick-to: 6.5 6.6 6.2 5.15 Task-number: QTBUG-116166 Change-Id: I9763703f36ae742e1d3c7cb17872cf8d0d82ab85 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Mark all of Qt as free of Q_FOREACH, except where it isn'tMarc Mutz2023-08-193-0/+5
| | | | | | | | | | | | | | | | | | | | | | The density of Q_FOREACH uses in this and some other modules is still extremely high, too high for anyone to tackle in a short amount of time. Even if they're not concentrated in just a few TUs, we need to make progress on a global QT_NO_FOREACH default, so grab the nettle and stick to our strategy: Mark the whole of Qt with QT_NO_FOREACH, to prevent new uses from creeping in, and whitelist the affected TUs by #undef'ing QT_NO_FOREACH locally, at the top of each file. For TUs that are part of a larger executable, this requires these files to be compiled separately, so add them to NO_PCH_SOURCES (which implies NO_UNITY_BUILD_SOURCES, too). In tst_qglobal.cpp and tst_qcollections.cpp change the comment on the #undef QT_NO_FOREACH to indicate that these actually test the macro. Task-number: QTBUG-115839 Change-Id: Iecc444eb7d43d7e4d037f6e155abe0e14a00a5d6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tests: port assorted trivial uses of Q_FOREACH to ranged for loopsMarc Mutz2023-08-141-2/+2
| | | | | | | | | | | | | | | | | | | | All of these fall into the trivial category: loops over (readily made) const local containers. As such, they cannot possibly depend on the safety copy that Q_FOREACH performs, so are safe to port as-is to ranged for loops. There may be more where these came from, but these were the ones that stood out as immediately obvious when scanning the 100s of uses in qtbase, so I preferred to directly fix them over white-listing their files with QT_NO_FOREACH (which still may be necessary for some files, as this patch may not port all uses in that file). Pick-to: 6.6 6.5 Task-nubmber: QTBUG-115839 Change-Id: I7b7893bec8254f902660dac24167113aca855029 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* CMake: Make network tests standalone projectsAlexandru Croitor2023-07-0515-0/+90
| | | | | | | | | | | | | | | | | Add the boilerplate standalone test prelude to each test, so that they can be opened with an IDE without the qt-cmake-standalone-test script, but directly with qt-cmake or cmake. Boilerplate was added using the following scripts: https://git.qt.io/alcroito/cmake_refactor Manual adjustments were made where the code was inserted in the wrong location. Task-number: QTBUG-93020 Change-Id: I000cd3b0809b6417c3b1ab520e4de746afee71fc Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Android: explicitly bundle the OpenSSL libs for testsAssam Boudjelthia2023-06-2115-0/+15
| | | | | | | | | | Use the new argument to bundle the OpenSSL prebuilt libararies so that ssl operations are actually tested at runtime. Task-number: QTBUG-110025 Pick-to: 6.6 6.5 Change-Id: I0d73fed463a1724a9e0ee84ba603aa2ff1bc649b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSslSocket: ignore order of sslErrors listMårten Nordheim2023-06-081-1/+8
| | | | | | | | | In Schannel it is not guaranteed CertificateBlacklisted will be the first error emitted. And it really does not make a difference anyway. Pick-to: 6.6 6.5 6.2 Change-Id: If041f913db9e78ac54e6f8bb2ba1bda110e7d64a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_QSslSocket: skip tests with specific cipher if unsupportedMårten Nordheim2023-06-081-2/+11
| | | | | Change-Id: If107ec596abc6d5fd82206e8deff9875dfb308c8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Skip diffie-hellman parameter test when not supportedMårten Nordheim2023-05-241-0/+2
| | | | | | | Pick-to: 6.5 Change-Id: I0c21aeea813ee48f8c62689dafce6f7fb9620001 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_QSslCertificate: Make it easier to check which backend is usedMårten Nordheim2023-04-251-19/+40
| | | | | | | | | | | | Instead of having one member signaling !openssl let's just add booleans for openssl, schannel and securetransport. The latter two of which are not currently used but may be in the future. As a drive-by, make a compile-time check into a runtime one. Change-Id: Id2f51f5396383a3f5836ac708996bfce8ae35c91 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_QSslSocket_onDemandCertificates_member: Blacklist Windows & debugAxel Spoerl2023-03-302-8/+17
| | | | | | | | | | | | | | | The test function occasionally can fail on CI/Windows, when a certificate update on www.qt.io requires installing a new root certificate on the test VM. This patch blacklists the test class (which has only one test function) on Windows. It adds diagnostic output, so future failure reasons can be established from CI artifacts. Pick-to: 6.5 Task-number: QTBUG-63481 Change-Id: If686d006f379fe6dbfb0d11d80b8455f72fdbb09 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Revert "Skip socket and server tests on Ubuntu 22.04 and QEMU"Mårten Nordheim2023-03-201-6/+0
| | | | | | | | | This reverts commit 9286d46ee25f84d24a509e703e294f792cba1483. Reason for revert: Should be fixed by 5c6814fb18760f65bab0f8b9cd623ee5c874a58d Change-Id: I3a161df445af8dcbb61138d57e931a093a319027 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QTestEventLoop: add enterLoop(std::chrono::milliseconds) overloadAhmad Samir2023-03-034-38/+46
| | | | | | | Task-number: QTBUG-110059 Change-Id: Ibf1d76afd313e390103be4a22e44af7fb41ace1b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tests: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-1715-127/+3
| | | | | | | Pick-to: 6.5 Change-Id: I8d106554bb86ac1ec9bb7a4083de4c376bcbab1d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Skip socket and server tests on Ubuntu 22.04 and QEMUVille Voutilainen2023-02-051-0/+6
| | | | | | | Task-number: QTBUG-107696 Change-Id: Ic9cecd0c8624e7e8211633ef8a8ce0339662b4f6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Adapt to QTimeZone replacing Qt::TimeSpec usageEdward Welbourne2022-12-102-13/+22
| | | | | | | | | | | | In the process actually handle all time-spec cases in various places that only handled UTC or LocalTime, or at least note that they don't where that's not practical. Also tidy up header ordering and ensure QDateTime's header is included wherever it's used, while adding the include for QTimeZone where needed. Task-number: QTBUG-108199 Change-Id: Ic1a5cdf0aaf737bf1396aa8ac58ce2004cef7e19 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Try fixing auto-tests that need resolving openssl symbolsTimur Pocheptsov2022-12-024-5/+16
| | | | | | | | | | | | | For the case of static builds. Also, remove somewhat funny comment from the shared tlshelpers.h file. Fixes: QTBUG-105046 Pick-to: 6.4 6.2 Change-Id: I2fd677a11b64df89c0ad0237e1014f5e80144c24 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-032-139/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-113-5/+5
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* CMake: Only build ssl tests if the feature was enabledAlexandru Croitor2022-10-111-3/+3
| | | | | | | Pick-to: 6.4 Task-number: QTBUG-107538 Change-Id: If2d473fbf8240b356d226be7bc4058506149a0e6 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-044-34/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_qsslcertificate: remove ifery which breaks the testTimur Pocheptsov2022-09-301-6/+1
| | | | | | | | In the presence of QT_CONFIG(opensslv30). Fixes: QTBUG-107027 Change-Id: I481db3cdf3bbb1aa7127cc5498f0c0217df8c35b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSslSocket::serverCipherPreferencies - fix for OpenSSL v3Timur Pocheptsov2022-09-082-11/+33
| | | | | | | | | | | | | Test was not really good to start with - it was assuming the presence of particular ciphersuites. Furthermore, it was ignoring the fact that TLS 1.2 and TLS 1.3 set ciphersuites differently in OpenSSL. Pick-to: 6.4 6.3 6.2 5.15 Task-number: QTBUG-106018 Task-number: QTBUG-95123 Change-Id: I6c8ba20154cdeb9275878462ab945729d6c82ecc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSsSocket: fix verifyClientCertificate with OpenSSL 3Mårten Nordheim2022-09-051-1/+1
| | | | | | | | | | | | | OpenSSL 3 by default disables TLS < 1.2 in the conf files. We're not going to work against that, so we bump the version of TLS used. Keep the client-side TLS 1.0 Or Later just to keep testing that this part works. Task-number: QTBUG-95123 Task-number: QTBUG-106018 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Ia6cb10495875de232d69a886832ae74c5f5ac15f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_QSslSocket::oldErrorsOnSocketReuse - make it work with OpenSSL v3Timur Pocheptsov2022-09-031-2/+4
| | | | | | | | | | | | | | | | The initial problem was in server not starting encryption, because its certificate was rejected by OpenSSL (v3) saying 'weak md'. After the certificate was replaced, we got another problem - due to the fixed TLS v.1 protocol for both client and server - handshake is interrupted early with 'tls v1 alert' and error message saying about not found signature algorithms. Don't fix the protocol version, use proper QSsl::SecureProtocols (default). Pick-to: 6.4 6.3 6.2 5.15 Task-number: QTBUG-106018 Task-number: QTBUG-95123 Change-Id: I0f22f5304f4405933ad511195bc61c640518e7d8 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSslSocket: regenerate certificate used for setLocalCertificateChainMårten Nordheim2022-09-0211-93/+511
| | | | | | | | | | | | | | The certificate was using SHA-1 for signing its certificate, which is considered 'not good enough' by some TLS libraries. Regenerate it with SHA-512 and a larger RSA key. Also include the files needed to generate it. Pick-to: 6.4 6.3 6.2 5.15 Task-number: QTBUG-106018 Task-number: QTBUG-95123 Change-Id: I535e047d540e663c8cec334695196044173949fc Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_QSslSocket::protocolServerSide - make it work with OpenSSL v3Timur Pocheptsov2022-09-021-7/+0
| | | | | | | | | | | | | | OpenSSL v3 by default sets SECLEVEL = 2 unless overridden in conf files. SECLEVEL >= 1 means TLS <= 1.1 is disabled. Remove cases that were previously expected to work. Arguably, we should not test deprecated protocols at all, but the cases expecting a failure still work and logically correct. Task-number: QTBUG-95123 Task-number: QTBUG-106018 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Ifa59fa902b433338dbed7abf086cfdef9470384c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSslKey - make OpenSSL v3 detection fully runtimeTimur Pocheptsov2022-09-011-11/+14
| | | | | | | | | | Otherwise, checks are useles in non-developer build. Pick-to: 6.4 6.3 6.2 Fixes: QTBUG-106036 Change-Id: I41b6d8f250021ff9fa4981f9df9244c269ed2999 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSslCertificate::toText(): add a file to compare againstTimur Pocheptsov2022-08-315-150/+9
| | | | | | | | | | | | | With OpenSSL 3.0.5 we see X509_print giving us the text representation not matching any of previous ones - mostly a question of spaces and formatting. Let's add a proper version to compare against and remove useless 0.9.8, 1.0.0, 1.0.1, - we don't support them anymore and thus QSslCertificate::toText() will never give a match. Pick-to: 6.4 6.3 6.2 5.15 Task-number: QTBUG-106017 Change-Id: Ida11321c23e74c7313acc682237ab78408cf2803 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSslCertificate::pkcs12 - skip the test if OpenSSL version >= 3Timur Pocheptsov2022-08-311-0/+5
| | | | | | | | | | leaf.p12 is using RC2 for encryption and it's disabled by default in openssl v3. Pick-to: 6.4 6.3 6.2 5.15 Fixes: QTBUG-106017 Change-Id: I4edd0d29506d1e50b2b618b6a00cceeb4b156204 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QDtls::verifyClientCertficiate - update certs for OpenSSL v3Timur Pocheptsov2022-08-312-88/+84
| | | | | | | | | | Because this version does not seem to like MD5 which old cert was using. Fixes: QTBUG-106019 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Id354d1e32acb0528685b2788ee9c7326c43397bd Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>