summaryrefslogtreecommitdiffstats
path: root/src/plugins/tls/openssl
Commit message (Collapse)AuthorAgeFilesLines
* Enable stricter build options for network pluginsMårten Nordheim2025-08-261-0/+2
| | | | | | | | | | | | A mix of QT_ENABLE_STRICT_MODE_UP_TO and QT_NO_CAST_FROM_ASCII Disabling implicit conversions from ASCII makes it easier to avoid unnecessary (unexpected) conversions. And disabling contextless connects helps avoid annoying lifetime issues. Change-Id: I4f695f2fe993e3e69fe49b0d7965a427150d69ae Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* OpenSSL: Fix another implicit char* to QString conversionMårten Nordheim2025-08-231-1/+1
| | | | | | | | | | | In Darwin specific code. Amends c70bb357cce860385ea8c61b337f24165fa04db6 Pick-to: 6.10 6.9 6.8 Change-Id: I2bf8471d7d9c191d407c9e2be9aec2ff35887756 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* OpenSSL: fix implicit char* to QString constructionMårten Nordheim2025-08-231-2/+2
| | | | | | | | | | | The plugin is not yet built with the constructor disabled, so it is an easy thing to miss. Amends 1493a6e8841dcfb8354f841585ac08ed35e9363b. Change-Id: I4ed5c9ed2282b96b04603a7a8ff07f5964ff5f2d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* openssl: ensure namespacingTim Blechmann2025-08-165-37/+27
| | | | | | | | | | | | Functions are declared as extern "C", which prevents them from being mangled. Since they are onyly passed as callacks to openssl, but we don't need to prevent mangling, we can remove the extern "C" statements from them Pick-to: 6.10 Task-number: QTBUG-138543 Change-Id: I0f4cca0cf799ebb6b2df980d2a607c6b336aa8c9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QSsl: Add support for the ML-DSA signature algorithmJan Grulich2025-08-156-17/+100
| | | | | | | | | | | | | | | | | | Introduce support for the post-quantum digital signature algorithm ML-DSA, which is selected by NIST for standardization as part of their post-quantum cryptography (PQC) project. It's designed to be secure against attacks from both classical and future quantum computers and is intended to replace traditional digital algorithms like RSA. The OpenSSL backend now handles the three security levels (ML-DSA-44, ML-DSA-65, and ML-DSA-87) when OpenSSL 3.5 or newer is used or when any provider (like oqsprovider) with ML-DSA support is configured. [ChangeLog][QtNetwork][QSsl] Added support for the ML-DSA signature algorithm. Change-Id: I96fa7e2c95d7c431229816aa9a9a14ebcf46ee40 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Update SSL trust store locations for modern Red HatNicolas Fella2025-07-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Red Hat family distros haven't used /usr/share/ssl since 2004: https://bugzilla.redhat.com/show_bug.cgi?id=143392 /etc/ssl/certs has never been a canonical location on Red Hat family distros, and as of https://fedoraproject.org/wiki/Changes/dropingOfCertPemFile is being removed. The same change also removes /etc/pki/tls/certs/ca-bundle.crt . This updates both magic lists with the modern canonical locations for Red Hat and derived distros. The tls-ca-bundle.pem bundle has been around in Fedora since around 2013: https://src.fedoraproject.org/rpms/ca-certificates/c/d538ada99cda951da7da3a72dc5eea06f02be212 The directory-hash dir has been around since around 2021: https://src.fedoraproject.org/rpms/ca-certificates/c/1c8b67fb5ab3954a308d019461bb30d50412087e Original patch from Adam Williamson <awilliam@redhat.com> Pick-to: 6.10 6.9 Change-Id: I6b6060f66ae1bfd4b50db6852ecc490bf54cbb58 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CRA[plugins/tls]: Mark the rest significantMårten Nordheim2025-07-2811-0/+11
| | | | | | | | | The rest was handled separately. Fixes: QTBUG-135730 Pick-to: 6.10 6.9 6.8 Change-Id: Id68d759dd622553bc8b599673940e719a8a750c4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CRA[plugins/tls]: Mark most of it criticalMårten Nordheim2025-07-288-0/+8
| | | | | | | | | | The files all deal with cryptography in one way or another, some more directly than others. Task-number: QTBUG-135730 Pick-to: 6.10 6.9 6.8 Change-Id: If4a7bba92de5f4577876623c403379008008643a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QSslCertificate: add fromFile() methodAhmad Samir2025-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | QSslCertificate::fromPath() does some extra work: - matching wildcard glob or regular expression patterns - checks if the string it's called on is a file or a dir That extra work isn't needed when you already have the path to a specific certificate file. E.g. qtlsbackend_openssl.cpp:systemCaCertificates() used to call fromPath() on *.pem/*.crt files that it got from iterating over system certifcates dirs. This also de-duplicates the code in fromPath(). [ChangeLog][QtNetwork][QSslCertificate] Added fromFile() method. Change-Id: I92ab358e4711866dd4510da42c47905c7dae58b1 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* qtlsbackend_openssl: optimize QDirListing usageAhmad Samir2025-05-141-3/+12
| | | | | | | | | | | Internally QDirListing uses the name filters to create QRegularExpression objects which are then used to do the matching. Here we are looking for files that have ".pem" or ".crt" extensions, so basic string matching should work the same and is inherently faster. Pick-to: 6.9 Change-Id: Ib19b1eb8717b21c3b96a52e7036665c40fb24caf Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* qtlsbackend_openssl: use QFile::decodeName()Ahmad Samir2025-05-141-2/+2
| | | | | | | | ... instead of reyling on the QByteArray to QString implicit conversion. Pick-to: 6.9 Change-Id: Ia9e8026f2962009d9deac044e42b18f6333cfec1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QCryptographicHash: remove QT_CRYPTOGRAPHICHASH_ONLY_SHA1Ahmad Samir2025-04-021-4/+0
| | | | | | | | | | | | It was added in 44cb71d6fdb0b7285d4ef74a1ef778323aa9e5ee to reduce the size of the bootstrap lib. Since commit c7f64d84fbd9b5b3cac41c1d81dc4d0479fc3fa1 removed QCryptographicHash from the bootstrap lib, the macro is now redundant (unless it's used by QtLite). Change-Id: I5459a52507bc9e0a7b982b4382211be9a23c4ad9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace a few toString() or fromUtf8() QString::arg() parametersMarc Mutz2024-12-031-8/+5
| | | | | | | | | | ...and fromUtf8() format strings. QString::arg() is now available on QUtf8StringView, too and can handle UTF-8 arguments directly. Change-Id: Ifa8b1ea0f41414d15a6919b1967e0a45e4d7929f Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* plugins/tls/openssl: use QBasicTimer instead of handling timer IDsAhmad Samir2024-09-012-10/+7
| | | | | Change-Id: I962924bf959bbe857de8da677c590870893850a3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTlsBackendOpenSSL: optimize QDirListing iterationAhmad Samir2024-07-251-1/+3
| | | | | | | | Looking for certificates, the name filters are {*.pem,*.crt}, so only list files and symlinks to files. Change-Id: Ic8cea09e4d8004c35a9ae60dbbee7b41362e2c94 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QssLSocket: use QDirListing instead of QDir::entryList()Ahmad Samir2024-07-251-2/+5
| | | | | | | This removes the overhead of constructing a QDir. Change-Id: I94fdfbe76880f8dfd7d0cd773bfd371331e586f6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Logging: use qCDebug/Warning/Info when for categorized loggingVolker Hilsheimer2024-07-162-2/+2
| | | | | | | | | | | | | When building qt with QT_NO_DEBUG/WARNING/INFO_OUTPUT set, then the qDebug/Warning/Info macros expand to `QMessageLogger::noDebug`. That helper is not defined to take a logging category or category function, so using `qDebug(lcX, ...)` breaks the build. The correct way to emit categorized logging is to use the qCDebug/Warning/Info macros. Task-number: QTBUG-125589 Pick-to: 6.8 6.7 6.5 Change-Id: I968b0e826871a09023c11fec9e51caa5a2c4dc0b Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
* Use non static data member initialization on errorcode in QSslContextMate Barany2024-07-041-1/+1
| | | | | | | | | | | | Address the "A constructor must initialize all data members of the class" warning. Found by an Axivion scan. Task-number: QTBUG-125026 Pick-to: 6.8 6.7 6.5 Change-Id: I46a7dd358d107670846fa35c0b02d2591258438d Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QDirListing: add flags to handle entries filteringAhmad Samir2024-06-271-5/+4
| | | | | | | | | | | | | | | | | | By extending IteratorFlag so that it replaces both QDir::Filter and QDirIterator::IteratorFlag enums, but with better defaults (based on how QDir/Iterator is used in 15-20 years worth of code in Qt and KDE). Make the QDirListing(QDir ~~) ctor private, also change it to use QDirIterator::IteratatorFlags; it will be used to port existing code. If QDir is ported to use QDirListing::IteratorFlags, instead of QDir::Filters, a public QDirListing(QDir) constructor can then be added. Pick-to: 6.8 Fixes: QTBUG-125504 Task-number: QTBUG-125859 Change-Id: Ide4ff8279f554029ac30d0579b0e8373ed4337f7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Disable copy and move operations in QSslContextMate Barany2024-06-271-0/+1
| | | | | | | | | | | | The class has a custom destructor, we should handle the other special member functions as well. Found by an Axivion scan. Pick-to: 6.8 6.5 Task-number: QTBUG-125026 Change-Id: I172aeb02d81a0f66ab724892d9f938a12f371ffa 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>
* 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>
* 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>
* 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>
* 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>
* Fix QNetworkAccessManager hang with low integrity level sandboxingJøger Hansegård2023-10-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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-171-1/+1
| | | | | | | 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>
* 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-071-0/+2
| | | | | | Change-Id: I7a64d636f5588bda3633cbb3fb6213232c7654a4 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* 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>
* 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>
* 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>
* 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>
* 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-116-7/+7
| | | | | | | | | | | | | | | | 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-046-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* TLS backend OpenSSL: Use function-static variable for symbol loadingIevgenii Meshcheriakov2022-09-021-343/+331
| | | | | | | | | | | | | Replace a combination of a mutex, atomic variable, and another 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. Task-number: QTBUG-103559 Change-Id: If9af8584e648ddb9ec518498ce035105e52413a2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* update function argument of SSL_CTX_set_optionsMichael Saxl2022-08-044-7/+12
| | | | | | | | | | | | openssl3 uses uint64_t for the options argument in SSL_CTX_set_options, older ones used long. sizeof(long) is not the same on any platform as sizeof(uint64_t) Fixes: QTBUG-105041 Change-Id: If148ffd883f50b58bc284c6f2609337d80fb5c58 Pick-to: 5.15 6.2 6.3 6.4 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>