summaryrefslogtreecommitdiffstats
path: root/src/plugins/tls/openssl/qssldiffiehellmanparameters_openssl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* CRA[plugins/tls]: Mark most of it criticalMårten Nordheim2025-07-281-0/+1
| | | | | | | | | | 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>
* 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>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* TLS plugin (OpenSSL): don't use the deprecated functionsTimur Pocheptsov2021-10-211-2/+16
| | | | | | | | | | | If we have OPENSSL_NO_DEPRECATED_3_0 defined. This includes RSA, DSA, EC and DH-related APIs. As of now, we only make sure the code still compiles. Pick-to: 6.2 5.15 Fixes: QTBUG-83733 Change-Id: Id455b851421ce0dcdfb0229fa515ba2b2ed690b1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Diffie-Hellman parameters: remove useless 'fix'Timur Pocheptsov2021-07-091-51/+0
| | | | | | | | | | | | | | The workaround I had implemented based on alpha version of OpenSSL v3 and what developers (OpenSSL) said about DH back then is not going to work in the end - they do remove all DH (struct and related functions) stuff if you set a proper OPENSSL_API_COMPAT level. A proper re-write is required to support OpenSSL v3, but then there is no reason to keep dead useless code. Pick-to: 6.2 Task-number: QTBUG-94596 Change-Id: Iae092dd08148521649a684879d30e190736e1abe Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Move plugin code from QtNetwork to qtbase/pluginsTimur Pocheptsov2021-04-221-0/+231
All TLS (and non-TLS) backends that QSsl classes rely on are now in plugins/tls (as openssl, securetransport, schannel and certonly plugins). For now, I have to disable some tests that were using OpenSSL calls - this to be refactored/re-thought. These include: qsslsocket auto-test (test-case where we work with private keys), qsslkey auto-test (similar to qsslsocket - test-case working with keys using OpenSSL calls). qasn1element moved to plugins too, so its auto-test have to be re-thought. Since now we can have more than one working TLS-backend on a given platform, the presence of OpenSSL also means I force this backend as active before running tests, to make sure features implemented only in OpenSSL-backend are tested. OCSP auto test is disabled for now, since it heavily relies on OpenSSL symbols (to be refactored). [ChangeLog][QtNetwork][QSslSocket] QSslSocket by default prefers 'openssl' backend if it is available. [ChangeLog][QtNetwork][QSslSocket] TLS-backends are not mutually exclusive anymore, depending on a platform, more than one TLS backend can be built. E.g., configuring Qt with -openssl does not prevent SecureTransport or Schannel plugin from being built. Fixes: QTBUG-91928 Change-Id: I4c05e32f10179066bee3a518bdfdd6c4b15320c3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>