summaryrefslogtreecommitdiffstats
path: root/src/plugins/tls
Commit message (Collapse)AuthorAgeFilesLines
* Schannel: fix handling of empty ciphers listMårten Nordheim2024-03-121-2/+4
| | | | | | | | | | | | | Contrary to OpenSSL the new ciphers support in Schannel would disallow all ciphers when the list was empty. The pre-existing behavior was to use the default list. Amends f7792d2b6d3d1e5dd47a8f6429b817b793bcfb9b Pick-to: 6.7 Change-Id: I0e79013ac86261c4afa4affb28cb1838177c12de Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Port to QDirListingAhmad Samir2024-03-031-8/+7
| | | | | | | | | | | Use QDirListing in the Bootstrap build instead of QDirIterator. Drive-by changes: - more const variables - use emplace_back() instead of append() where appropriate Change-Id: Ie1f0d03856e557c4bfabfff38a87edc7da86d091 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Schannel: check that plainsocket is open before useMårten Nordheim2024-02-271-3/+8
| | | | | | | | | | | | | | | | | In reality I think it should be covered elsewhere, before reaching the TLS code. But this is a simple fix to avoid an unnecessary warning. This is actually quite similar to the resolution in ef4ba0285f9c5dd5ee2dca1e0cefee45eba3477c. Technically checking isWritable would be more correct, but Qt is usually the one to open the socket, and we open for both read and write anyway. Fixes: QTBUG-116550 Pick-to: 6.7 6.6 6.5 Change-Id: I4996b18b5b65c434d91543451186f335e201604f Reviewed-by: Mate Barany <mate.barany@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove extra semi-colonsTasuku Suzuki2024-02-061-1/+1
| | | | | Change-Id: I92fddb36cd136fd1bd627955f15d0559b9942d7e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Adapt ASN.1 datetime parsing to use the new century controlEdward Welbourne2023-12-081-12/+9
| | | | | | | | | | | | 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>
* Revert "OpenSSL: remove support for 1.1"Marianne Yrjänä2023-12-084-1/+52
| | | | | | | | | | This reverts commit d201c0a2184881a226bce76528047707e9062856. Reason for revert: QNX have support only for OpenSSL1.1. QNX will start supporting OpenSSL3 with upcoming QNX8.0 but as long as we want to support QNX7.1 (and even QNX7.0) removing OpenSSL1.1 support from Qt is not an option. Change-Id: Ia2083eda318779968eb6ee84fff2f56ebe3dadf7 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* ASN1: speed up parsing of certificate timestampsMårten Nordheim2023-11-271-11/+12
| | | | | | | | | | | | | | | | | | | | | 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>
* OpenSSL: remove support for 1.1Giuseppe D'Angelo2023-11-244-52/+1
| | | | | | | | | | | | | | | | | | | | OpenSSL 1.1 reached EOL last September [1]. We will only support OpenSSL 3. Cherry-picking aggressively, as there's no purpose at keeping maintained Qt versions work with an unmaintained library given the security implications. [1] https://www.openssl.org/blog/blog/2023/09/11/eol-111/ [ChangeLog][QtNetwork][SSL] Support for OpenSSL 1.1 has been dropped. Qt now only supports OpenSSL 3. Change-Id: I51a231a9ca17804739acbd2f22c478d2a8ff9b3b Fixes: QTBUG-119330 Pick-to: 6.6 6.5 6.2 5.15 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* qopenssl: fix accidental pessimizationMårten Nordheim2023-11-151-1/+1
| | | | | | | | | | | | The toLatin1 wasn't necessary, the argument should be QString. The plugin isn't currently built with the ASCII ctors disabled, so it passed through CI unnoticed. Amends 3159b337f01767412f51c649d30a72ac8417989b Pick-to: 6.6 6.5 Change-Id: Ib63ccaffacc46e5a313551f1e7c0e02ae09b1a01 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Schannel: change UNREACHABLE into error-handlingMårten Nordheim2023-11-151-2/+6
| | | | | | | | | | | | | Because it happens in some (unknown precondition) cases. While it would be nice to know what the client is doing to trigger this, it's not worth crashing over in the meantime. Fixes: QTBUG-118458 Pick-to: 6.6 6.5 6.2 Change-Id: I261a17578e7cd3a95e591a3228b33561000fd336 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Openssl V3: try to work around the lack of SHLIB_VERSION_NUMBERTimur Pocheptsov2023-11-081-2/+14
| | | | | | | | | | It's no more defined in opensslv.h, try to use OPENSSL_SHLIB_VERSION instead. Pick-to: 6.6 6.5 Fixes: QTBUG-116295 Change-Id: Ie465f4147e0ec95897bd8d35f71241884bf64b4e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Schannel: Return if socket is invalidMårten Nordheim2023-11-061-2/+4
| | | | | | | | | | | | | | | | | In a couple places we already check if the socket is connected, however we can be connected _and_ have the socket be closed. The logic behind that I don't really understand, but there are similar checks for validity in the OpenSSL backend. This happens when calling close() on a still-connecting socket. The QIODevice is marked as closed, but the connection cannot yet be aborted. And when it finishes connecting we handle the signal, start encryption, and then disconnect. Pick-to: 6.6 6.5 Fixes: QTBUG-116550 Change-Id: I06c0a2db32bea0b573a99a971b8fb0b66a7a73d5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Schannel: Avoid crashing for unparsed certificateTim Jenssen2023-11-032-4/+14
| | | | | | | | | | | | | | | | | | Crash reports imply the `certBackend` we extract in QSslCertificate_from_CERT_CONTEXT is null, which means that something went wrong when parsing the certificate data we get from the certificate chain. We assume the rest is okay since it must be inside the bounds of the length of the chain. It's not clear why the certificate would be invalid, but it's better to avoid the crash for now. Pick-to: 6.5 6.6 Task-number: QTBUG-118569 Change-Id: I76ce07fc38bf82ef5c93097d839724ddee1edeef Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use SSL_CTX_set_dh_auto if DHparam is emptyAndré Klitzing2023-10-252-1/+4
| | | | | | | | | | [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>
* Schannel: Enable ALPN for some mingw configurationsMårten Nordheim2023-10-201-1/+1
| | | | | | | | | | ... by checking if SECBUFFER_APPLICATION_PROTOCOLS is defined. In this case, we assume that the current environment supports ALPN. Then we no longer do a blanket block for all mingw configurations. Pick-to: 6.6 Change-Id: I2eedb813a5bdc3b1a5097053b04aa45d25d175aa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix QNetworkAccessManager hang with low integrity level sandboxingJøger Hansegård2023-10-182-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | QNetworkAccessManager may fail to finish with Windows apps that are running with low integrity level sandboxing. The root cause is that such applications are not allowed to open ROOT system certificate store with write privileges. This causes the CertOpenSystemStore helper function to fail, because it attempts to open certificate stores with the option of adding or deleting certificates. We only use the CertOpenSystemStore with the intent of fetching certificates from the certificate store, so we do not need write access. The fix for this issue is threfor to open the system certificate store as read-only by using the lower-level CertOpenStore function. The CERT_SYSTEM_STORE_CURRENT_USER flag is provided to CertOpenStore to keep the documented behavior of CertOpenSystemStore, which states "Only current user certificates are accessible using this method, not the local machine store." Fixes: QTBUG-118192 Pick-to: 6.5 6.6 Change-Id: I529b760398f84137a0e95c8088a71b293d302b54 Reviewed-by: Fredrik Orderud <forderud@gmail.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* qtls_schannel: avoid implicit detachAnton Kudryavtsev2023-09-081-1/+1
| | | | | | | by const method usage Change-Id: I27863d691c228275fc795dfcfbcbcd11e438abc9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* OpenSSL: move DH calls under OPENSSL_NO_DEPRECATED_3_0 guardTimur Pocheptsov2023-08-312-14/+27
| | | | | | | | | | | | Initially, DH functions were deprecated, but when OpenSSL v3 was released, they changed their mind (now they changed it again). OpenSSL must be configured with 'no-deprecated'. Pick-to: 6.6 6.5 6.2 Fixes: QTBUG-83733 Change-Id: I69f14929e91f5fc147f9297f6fff20674e81b6f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tls: use string view types moreAnton Kudryavtsev2023-08-173-5/+4
| | | | | | | Prefer QStringView overloads Change-Id: Icc928a91056d661f9e7f187f42592f05ad081a84 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Return generic key from TlsKeyOpenSSL::handleTimur Pocheptsov2023-08-171-1/+1
| | | | | | | | We already return RSA/DSA/DH/EC, so we can also return generic. Fixes: QTBUG-115718 Change-Id: I2064c2bbce2df73985609d27a94857a0ee2e6b42 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove explicit use of QT_USE_QSTRINGBUILDERAlexey Edelev2023-08-081-1/+0
| | | | | | | | Since we enabled QT_USE_QSTRINGBUILDER by default for all plugins it doesn't make sense to add this definition explicitly. Change-Id: I22ad0b1fb567e12a842df4299231a5697ab9216d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use new QByteArray::assign() in QTlsBackendOpenSSL::dhParametersFromPem()Marc Mutz2023-07-181-1/+1
| | | | | | | | | | | QBA::assign() re-uses existing unshared capacity(), if any, and is therefore potentially more efficient than = QByteArray(.,.) (and never slower). Pick-to: 6.6 Task-number: QTBUG-106201 Change-Id: I2c45aa268c4c06396e9d7e0490666a13d8cfd532 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSslDiffieHellmanParameters: fix mem-leakMarc Mutz2023-07-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Says ASAN: Direct leak of 524 byte(s) in 1 object(s) allocated from: #0 0x7f708f0a67cf in __interceptor_malloc ../../../../gcc/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x7f707d94bf9e in CRYPTO_malloc crypto/mem.c:196 #2 0x7f707d7bd248 in asn1_item_flags_i2d crypto/asn1/tasn_enc.c:65 #3 0x7f707d7bd1b7 in ASN1_item_i2d crypto/asn1/tasn_enc.c:45 #4 0x7f707d85b7be in i2d_DHparams crypto/dh/dh_asn1.c:54 #5 0x7f7075a82223 in q_i2d_DHparams(dh_st*, unsigned char**) qsslsocket_openssl_symbols.cpp:435 #6 0x7f7075a82223 in QTlsBackendOpenSSL::dhParametersFromPem(QByteArray const&, QByteArray*) const qssldiffiehellmanparameters_openssl.cpp:139 #7 0x7f708ca9b588 in QSslDiffieHellmanParametersPrivate::initFromPem(QByteArray const&) qssldiffiehellmanparameters.cpp:285 #8 0x7f708ca9b588 in QSslDiffieHellmanParameters::fromEncoded(QByteArray const&, QSsl::EncodingFormat) qssldiffiehellmanparameters.cpp:94 #9 0x55fd8a545ebe in tst_QSslDiffieHellmanParameters::constructionPEM() tst_qssldiffiehellmanparameters.cpp:98 [...] The pointer returned in the out-parameter of a i2d_DHparams() call is supposed to be OPENSSL_free()ed by the user (this is not at all obvious from the docs¹, but an SO answer² indicates that's how it should be (as well as asan stopping from complaining with this patch applied)). ¹ https://www.openssl.org/docs/man3.1/man3/i2d_DHparams.html ² https://stackoverflow.com/a/53563669. Amends 2cf63c71ebe139890526057dcc51b24ea6df6c30. [ChangeLog][QtNetwork][SSL] Fixed a memory leak in parsing of PEM-encoded Diffie-Hellman parameters. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I9ed4a26c4676db1c0d54a1945a4fb5014ce568cd Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Network plugins: include mocsMårten Nordheim2023-07-072-0/+4
| | | | | | Change-Id: I7a64d636f5588bda3633cbb3fb6213232c7654a4 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Schannel: Add support for proper listing of ciphersTobias Koenig2023-06-162-29/+355
| | | | | | | | | | | | | | Reworked the code to list supported ciphers for Schannel backend to provide the proper cipher names and cipher properties. Note: restricting the used ciphers for a TLS connection is only supported for TLS 1.2 yet! [ChangeLog][QtNetwork][QSslConfiguration] Add support for listing supported ciphers with Schannel backend. Change-Id: Idfc17335ec489315387a3e84b7a76a263be22378 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Schannel: enable QStringBuilderMårten Nordheim2023-06-141-0/+1
| | | | | | | | Apparently it is not enabled since the TLS backends became plugins, which is unfortunate I wrote code in here that assumed it was. Change-Id: I765435ce7d2c6fafa452d0453c705c27ff477be6 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Schannel: define QT_NO_CAST_FROM_ASCIIMårten Nordheim2023-06-141-0/+2
| | | | | | | To avoid implicit, unintended, creation of QString Change-Id: I50e1f83e8f6f13f38746ac03b65161cee96306cb Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Remove the manual undef of the min/max macros, or def NOMINMAXAmir Masoud Abdol2023-06-081-4/+0
| | | | | | | | | | We now add NOMINMAX to PlatformCommonInternal target which will be linked to everything else, so min/max will not be defined upon the inclusion of `windows.h`, or other headers. Pick-to: 6.5 6.6 Change-Id: I10016720dac7ce015e929885b7368ee86d8b6918 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Schannel: Reject certificate not signed by a configured CA certificateMårten Nordheim2023-05-231-0/+21
| | | | | | | | | | | | | | | | Not entirely clear why, but when building the certificate chain for a peer the system certificate store is searched for root certificates. General expectation is that after calling `sslConfiguration.setCaCertificates()` the system certificates will not be taken into consideration. To work around this behavior, we do a manual check that the root of the chain is part of the configured CA certificates. Pick-to: 6.5 6.2 5.15 Change-Id: I03666a4d9b0eac39ae97e150b4743120611a11b3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Schannel: Add support for import of PKCS12/PFX filesTobias Koenig2023-05-055-0/+181
| | | | | | | | | | | | Add the missing functionality to the Schannel backend to make QSslCertificate::importPkcs12() work on Windows. [ChangeLog][QtNetwork][QSslCertificate] Add support for PKCS12 import with Schannel backend. Change-Id: Ibb501724d0dc78b0507ac8becf4776fbba0a0623 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Schannel: Remove deprecated SCHANNEL_CRED based code pathTobias Koenig2023-05-031-64/+17
| | | | | | | | | | Since the required minimum version of Qt is Windows 10 (1809), the deprecated SCHANNEL_CRED code path to initialize TLS connections can be removed and the SCH_CREDENTIALS based path is used for all connections. Change-Id: I2aef919a45373e55ae96405b7c6f2264378f4464 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Long live QMessageAuthenticationCode::resultView()!Marc Mutz2023-03-011-1/+1
| | | | | | | | | | | Use it in a few places. [ChangeLog][QtCore][QMessageAuthenticationCode] Added QCryptographicHash-style resultView(). Change-Id: I745d71f86f9c19c9a9aabb2021c6617775dab1cf Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* TLS[openssl]: Use optional<> for CA cert we are fetchingMårten Nordheim2023-02-172-4/+4
| | | | | | | | | | | | | The QSslCertificate ctor is somewhat expensive, especially when we are shutting down. By using optional<> we simply reset() it and no longer need to create a new, valid, certificate. Pick-to: 6.5 6.4 6.2 Task-number: QTBUG-102474 Change-Id: I514433b0d380dd3ceabbed3a6164f7e3efc490c7 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* Add some exclusions for CMake Unity (Jumbo) buildsFriedemann Kleint2023-02-161-0/+4
| | | | | | | | | | | | | Add exclusions for issues that are likely not fixable (3rd party code, X11 define clashes, etc) in 3rd party, tools and plugins. Pick-to: 6.5 Task-number: QTBUG-109394 Done-with: Amir Masoud Abdol <amir.abdol@qt.io> Change-Id: I698c004201a76a48389271c130e44fba20f5adf7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Schannel: Enable users to let schannel pick a certificateMårten Nordheim2023-02-151-4/+6
| | | | | | | | | | | | | | Schannel is by default able to pick out and transmit a certificate it can find in the user's certificate store. The reason why we disabled it by default is because some applications create and store certificates in the store that is searched, so it may grab unexpected certificates. However, in some environments this is not an issue, so let these users re-enable this feature. Fixes: QTBUG-89556 Change-Id: Iffa8550ee64c70bb0955041072ed5a49f600f6a1 Reviewed-by: Joni Poikelin <joni.poikelin@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QtMiscUtils: add some more character helpersAhmad Samir2023-02-071-5/+3
| | | | | | | | | | | | | isHexDigit, isOctalDigit, isAsciiDigit, isAsciiLower, isAsciiUpper, isAsciiLetterOrNumber. This de-duplicates some code through out. Rename two local lambdas that were called "isAsciiLetterOrNumber" to not conflict with the method in QtMiscUtils. Change-Id: I5b631f95b9f109136d19515f7e20b8e2fbca3d43 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtNetwork: Split out QNativeSocketEnginePrivateFriedemann Kleint2023-02-021-1/+1
| | | | | | | | | | | The aim is to have fewer files including <windows.h>. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Id9cc08f54b5daf6d7e317fad27036dc2efaacbb8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* DTLS cookie: use CRYPTO_memcmp instead of std::memcmpTimur Pocheptsov2023-02-013-2/+5
| | | | | | | | | memcmp and openssl callbacks are somewhat of a red flag, so use CRYPTO_memcmp for the sake of looks. Done-with: Maximilian Blochberger Change-Id: I38d038ed96830cfd54c6f5cd684f80bee8d42899 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* TLS backend SecureTransport: properly clear SSLContextRefTimur Pocheptsov2023-01-051-0/+1
| | | | | | | | | | Simply calling SSLClose on context is not enough. Properly clear the context by calling 'reset' member-function. Pick-to: 6.5 6.4 6.2 5.15 Change-Id: Ic6a32f6e4193bb19809d1cce184651b78d6273a7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Schannel: Don't emit error when peer performs graceful disconnectionMårten Nordheim2022-12-151-2/+0
| | | | | | Pick-to: 6.5 6.4 Change-Id: Ie19a31fc61223d954badc704324adf4f5f7d361e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Adapt to QTimeZone replacing Qt::TimeSpec usageEdward Welbourne2022-12-101-5/+6
| | | | | | | | | | | | 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>
* TLS[openssl]: Bump minimum warning level to Critical on Win/macOSMårten Nordheim2022-12-091-1/+7
| | | | | | | | | | | | | | On these platforms there is a platform-native plugin that can be used instead. If, as has happened, a developer uses the OpenSSL backend without OpenSSL being available they may be confused by the output of OpenSSL without it being of any concern. Leave the warning level low on other platforms since they have nothing to fall back to. Pick-to: 6.4.2 6.4 6.2 Change-Id: Ic36a0429a9e8eed728aa59ec9e028626d6579de1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* qsslsocket_shared_mac: add more logging into certificate parsingTimur Pocheptsov2022-12-042-4/+62
| | | | | | | | | | | | On macOS we observe strange CA certificates that are coming from Security framework and which it cannot later parse from the DER format we feed it in. Add some more debugging in order to understand, which certificate gives such result. Pick-to: 6.4 6.2 Task-number: QTBUG-109135 Change-Id: I75cf4591e33c85db6fe80d37d84ede1456c56231 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QSsl[OpenSSL/Android]: Fix hardcoded 1_1 suffixMårten Nordheim2022-11-021-8/+8
| | | | | | | | | | | Since we support 3 as well now we should not always use 1_1. The suffix will change depending on which OpenSSL version was used when Qt was built. This only affects Android. Pick-to: 6.4 6.2 5.15 Change-Id: I2e443b12daa5e79190f1b3367e21ba0fa6a1dcd4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-117-8/+8
| | | | | | | | | | | | | | | | 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>
* Port from container.count()/length() to size()Marc Mutz2022-10-047-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Squash deprecation warnings about SecureTransport being deprecatedTor Arne Vestbø2022-09-131-0/+5
| | | | | | | | One or two of them is enough. Task-number: QTBUG-85231 Change-Id: I8da2cd0b222eacd534255b6b5548fef9aad408d6 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QTlsBackendOpenSSL: Early return from ensureCiphersAndCertsLoaded()Ievgenii Meshcheriakov2022-09-072-7/+16
| | | | | | | | | | | | Add an atomic state variable to perform early return without taking a recursive lock after ensureCiphersAndCertsLoaded() is complete. Make related mutex and state variable function-local static because they are not used anywhere else. Taks-number: QTBUG-103559 Change-Id: I1e4c9c4f73204885bce82ba7f2b5e64548c3aac3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QTlsBackendOpenSSL: Make ensureLibraryLoaded() privateIevgenii Meshcheriakov2022-09-051-2/+1
| | | | | | | | | | | This method is not used outside of the class right now. This is also an initialization method that may not be called recursively. Making it private hopefully makes it harder to make this mistake in the future. Task-number: QTBUG-103559 Change-Id: I8e1113e442e815320108b79bbd7b41bd28a66840 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QTlsBackendOpenSSL: Use a function-static variable in ensureLibraryLoaded()Ievgenii Meshcheriakov2022-09-022-10/+6
| | | | | | | | | | | | | | | | | Replace a combination of a mutex and a state variable by a function-local variable initialized by lambda. C++17 standard guarantees that the lambda is called only once and that any other callers will waiting for initialization to complete. The mutex that was replaced is also used in ensureCiphersAndCertsLoaded() but that seems to be a false sharing. Task-number: QTBUG-103559 Change-Id: Idb269a24b53cf3812ca9630ab4fc87f99ab16d55 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>