summaryrefslogtreecommitdiffstats
path: root/src/network/ssl
Commit message (Collapse)AuthorAgeFilesLines
* OpenSSL: handle SSL_shutdown's errors properlyTimur Pocheptsov2020-04-166-7/+36
| | | | | | | | | | | | | | Do not call SSL_shutdown on a session that is in handshake state (SSL_in_init(s) returns 1). Also, do not call SSL_shutdown if a session encountered a fatal error (SSL_ERROR_SYSCALL or SSL_ERROR_SSL was found before). If SSL_shutdown was unsuccessful (returned code != 1), we have to clear the error(s) it queued. Unfortunately, SSL_in_init was a macro in OpenSSL 1.0.x. We have to resolve SSL_state to implement SSL_in_init. Fixes: QTBUG-83450 Change-Id: I6326119f4e79605429263045ac20605c30dccca3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 8907635da59c2ae0e8db01f27b24a841b830e655)
* q_getTimeFromASN1: fix invalid accessTimur Pocheptsov2020-03-191-1/+17
| | | | | | | | | No sanitizer is needed, just looking at the code is enough. It was wrong. Change-Id: I9df417c137d6b3361c3161865e099a8be40860de Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix symbol resolving for OPENSSL_NO_NEXPROTONEGTimur Pocheptsov2020-02-051-4/+4
| | | | | | | | | | | | Our ALPN-related definitions were conditioned both on OPENSSL_NO_NEXTPROTONEG and OpenSSL version (since ALPN first was introduced in 1.0.2), but resolving was only under version check, not OPENSSL_NO_NEXTPROTONEG. This went unnoticed for many years, and was found only recently with OpenSSL built with no-nexprotoneg. Fixes: QTBUG-81762 Change-Id: I7afca0b2034a234a19b5bcdefd3ce26f4202cddb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix 'the the' typo in commentsLinus Jahn2020-02-021-1/+1
| | | | | Change-Id: I00fcb1c2374e7ca168b6240f9d41c0323fb0867c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Use prefixed ssl libs when "-openssl-linked" configure params is usedBogDan Vatra2020-01-071-3/+5
| | | | | | | | | | | | | | | | | | As long as we do a multi abi build in one go there is no easy way for us to know where the ssl libs are located for each ABI. The easiest way is to use libs prefixed with the ABI. For configure set we are using "_arm64-v8a" prefix as the configure script will always use arm64-v8a to run the tests. Don't show the OPENSSL_LIBS example as it won't work on Android. Here https://github.com/KDAB/android_openssl/commit/ebb0b68be4 you can find a script which builds these libs. Fixes: QTBUG-80862 Change-Id: I019c2a208ae48a7356b8f3933d0f4aad5ac156a3 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Doc: Fix qdoc compilation errors qtbaseNico Vertriest2019-12-121-1/+1
| | | | | | Task-number: QTBUG-79824 Change-Id: I6557de598de1931fc30556951d35783d02b83abe Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QSslSocket (OpenSSL) fix a resource leakTimur Pocheptsov2019-11-271-8/+4
| | | | | | | | | Introduced by fe6e54fb1f5cda652b9489f740763f8d735621dd. The probability -> 0, meaning malloc must fail to trigger it, but it is still a leak. We now use std::unique_ptr which improves the code in general a bit and fixes a leak. Change-Id: I6c0fa36953196d3235fb60354dc9ad2396d8dfcb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-11-061-1/+2
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/features/mac/default_post.prf src/corelib/tools/qsimd_p.h src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm util/qfloat16-tables/gen_qfloat16_tables.cpp Change-Id: If48fa8a3bc3c983706b609a6d3822cb67c1352a4
| * Schannel: no longer keep old ssl errors around when reusing socketMårten Nordheim2019-10-071-1/+2
| | | | | | | | | | | | | | | | And add a test for it so it can no longer happen in any current or future implementation. Change-Id: I3214aa90595e291b1e1c66befe185cfe1ea7bc6b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Make QSslError::SslError a Q_ENUMVolker Krause2019-10-181-0/+2
| | | | | | | | | | | | | | | | This avoids error prone manual mappings when having to persist such values, as eg. done in https://cgit.kde.org/kio.git/tree/src/kssld/kssld.cpp#n49. Change-Id: Ib279c116a10ce8edc0b686b8b80cbd848b4b410e Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-09-132-17/+10
|\| | | | | | | Change-Id: Idcf8fc1d79bcd84b494d7f43308e6fe82d60e1a4
| * Schannel: handle SEC_E_INCOMPLETE_DATA in acceptContextMårten Nordheim2019-09-101-1/+6
| | | | | | | | | | | | | | | | It's not a failure state, we just need more data. It is handled properly in other functions. Change-Id: I9450a78c71a3f4fe9506a7a79de6efa2db08697c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * Schannel: unbreak renegotiation (and likely gracious shutdown)Mårten Nordheim2019-09-092-16/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason it wasn't working before was a couple of things: 1. Due to an extra 'else' it would not process the SEC_I_RENEGOTIATE or SEC_I_CONTEXT_EXPIRED branch. 2. The peerCertVerified boolean was not only wrong, but also broke renegotiation even if the 'else' wasn't there. My previous attempt to fix it ended up being a noop, so: Reverts e21fa577dde32849fdaa744f30ad3b23d63b7214 Change-Id: Ifbad55d4bb066b7566bb88cead48e329cbd574f9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Fix qdoc warningsFriedemann Kleint2019-09-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | src/corelib/global/qnamespace.qdoc:3279: (qdoc) warning: Can't link to 'QGuiApplication::setHighDdpiScaleFactorRoundingPolicy()' src/corelib/time/qislamiccivilcalendar.cpp:49: (qdoc) warning: Can't link to 'QJijriCalendar' src/network/ssl/qsslsocket.cpp:1510: (qdoc) warning: Can't link to 'QSslConfiguration::defaultCaCertificates()' src/network/access/qhttp2configuration.cpp:49: (qdoc) warning: '\brief' statement does not end with a full stop. src/gui/text/qtextformat.cpp:532: (qdoc) warning: Undocumented enum item 'TableBorderCollapse' in QTextFormat::Property src/gui/text/qtextdocument.cpp:2066: (qdoc) warning: Undocumented enum item 'UnknownResource' in QTextDocument::ResourceType src/gui/kernel/qguiapplication.cpp:3500: (qdoc) warning: Undocumented parameter 'policy' in QGuiApplication::setHighDpiScaleFactorRoundingPolicy() Change-Id: I3573ef98cf9b58d16525c356270fe009fdffcf45 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into 5.14Friedemann Kleint2019-09-091-0/+12
|\| | | | | | | | | | | | | Conflicts: tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp Change-Id: Idd3ca5cb9a2b95a4c3513b2a4c8966e6f56193f1
| * Schannel: retain extra data after renegotiation is requestedMårten Nordheim2019-09-051-0/+12
| | | | | | | | | | | | | | | | | | I realized this is a potential scenario where we will have leftover data, but it wasn't covered. Change-Id: Ibaf1015bf2aee120e4a4d98888925b88ecb6ddfd Reviewed-by: Jesus Fernandez <jsfdez@gmail.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Remove QOperatingSystemVersion::WindowsVistaSona Kurazyan2019-09-051-3/+2
| | | | | | | | | | | | | | | | | | | | | | The minimum supported version is Windows 7. Remove QOperatingSystemVersion::WindowsVista added by b0cd007335853f283c47ffb0f5611d14e6dbe84b and replace with "true" wherever it was used. Change-Id: I08c0208467b655a921b6773f77d8bc099be69031 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-09-043-22/+37
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/codecs/qicucodec.cpp src/dbus/qdbusserver.cpp src/gui/painting/qbezier.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp src/plugins/printsupport/cups/qppdprintdevice.cpp Change-Id: I2703128bb64baf5580fbc2c2061b55b0f0611d2a
| * Merge remote-tracking branch 'qt/5.12' into 5.13Paul Olav Tvete2019-08-202-20/+31
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/configure.json src/gui/util/qtexturefilereader.cpp src/gui/util/util.pri tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp Change-Id: I2bc4f84705b66099e97330cda68e0b816aceb9cc
| | * SSL: ALPN: Don't include empty, too long or truncated namesMårten Nordheim2019-08-162-20/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As is said in RFC7301 in section 3.1 [1]: Protocols are named by IANA-registered, opaque, non-empty byte strings [...]. Empty strings MUST NOT be included and byte strings MUST NOT be truncated. [1]: https://tools.ietf.org/html/rfc7301#section-3.1 Change-Id: I2c41fa99984a53cc58803e5a264d06edac964cc6 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * | Schannel: ALPN: Don't include empty, too long or truncated namesMårten Nordheim2019-08-161-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As is said in RFC7301 in section 3.1 [1]: Protocols are named by IANA-registered, opaque, non-empty byte strings [...]. Empty strings MUST NOT be included and byte strings MUST NOT be truncated. [1]: https://tools.ietf.org/html/rfc7301#section-3.1 Change-Id: I38168ac570a433807e16121d5dec46d4ac73c4bf Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Fix some qdoc warnings in 5.14Friedemann Kleint2019-09-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark QCalendarBackend as internal since it is in a private header and fix some issues in the QCalendar related classes. src/corelib/time/qcalendar.cpp:201: (qdoc) warning: clang found diagnostics parsing \fn int QCalendarBackend::daysInMonth(int month, int year) const error: incomplete type 'QCalendarBackend' named in nested name specifier (repeats) src/corelib/time/qdatetime.cpp:1426: (qdoc) warning: Unknown command '\override' (repeats) src/corelib/time/qcalendar.cpp:642: (qdoc) warning: Undocumented enum item 'Last' in QCalendar::System src/corelib/time/qcalendar.cpp:642: (qdoc) warning: Undocumented enum item 'User' in QCalendar::System src/corelib/time/qcalendar.cpp:744: (qdoc) warning: Undocumented parameter 'year' in QCalendar::isLeapYear() src/corelib/time/qcalendar.cpp:923: (qdoc) warning: Can't link to 'dateTimeString()' (repeats) src/corelib/time/qcalendar.cpp:893: (qdoc) warning: No such parameter 'year' in QCalendar::partsFromDate() src/corelib/time/qcalendar.cpp:893: (qdoc) warning: No such parameter 'month' in QCalendar::partsFromDate() src/corelib/time/qcalendar.cpp:893: (qdoc) warning: No such parameter 'day' in QCalendar::partsFromDate() src/corelib/time/qdatetime.cpp:1425: (qdoc) warning: Undocumented parameter 'nmonths' in QDate::addMonths() src/corelib/time/qdatetime.cpp:1467: (qdoc) warning: Undocumented parameter 'nyears' in QDate::addYears() src/corelib/statemachine/qstatemachine.cpp:2522: (qdoc) warning: Undocumented enum item 'StateMachineChildModeSetToParallelError' in QStateMachine::Error src/corelib/kernel/qtimer.cpp:602: (qdoc) warning: Undocumented parameter 'connectionType' in QTimer::callOnTimeout() src/corelib/time/qcalendar.cpp:159: (qdoc) warning: Undocumented parameter 'name' in QCalendarBackend::QCalendarBackend() src/corelib/time/qcalendar.cpp:159: (qdoc) warning: Undocumented parameter 'id' in QCalendarBackend::QCalendarBackend() src/corelib/time/qcalendar.cpp:529: (qdoc) warning: Can't link to 'registerCalendar()' src/corelib/time/qcalendar.cpp:529: (qdoc) warning: Can't link to 'fromName()' src/corelib/time/qcalendar.cpp:178: (qdoc) warning: Can't link to 'QCalendar::fromEnum()' src/corelib/time/qcalendar.cpp:405: (qdoc) warning: Undocumented parameter 'jd' in QCalendarBackend::dayOfWeek() src/corelib/time/qcalendar.cpp:405: (qdoc) warning: Can't link to 'weekDayName()' src/corelib/time/qcalendar.cpp:405: (qdoc) warning: Can't link to 'standaloneWeekDayName()' src/corelib/time/qcalendar.cpp:268: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:268: (qdoc) warning: Can't link to 'isLeapYear()' src/corelib/time/qcalendar.cpp:295: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:313: (qdoc) warning: Can't link to 'isLuniSolar()' src/corelib/time/qcalendar.cpp:313: (qdoc) warning: Can't link to 'isSolar()' src/corelib/time/qcalendar.cpp:313: (qdoc) warning: Can't link to 'isLunar()' src/corelib/time/qcalendar.cpp:340: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:357: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:544: (qdoc) warning: Can't link to 'fromName()' Change-Id: Ia2fabefb917f8e4cfa361044d9b754717276f4aa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-07-301-0/+17
|\| | | | | | | | | | | | | | | | | | | | Conflicts: qmake/generators/win32/mingw_make.cpp Change-Id: I2f790bc8572bd22fea01edf7ca74595b29f063eb
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-291-0/+17
| |\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qresource.cpp Change-Id: I54917f72444a621bd08aeaa15f5d17415993144d
| | * Android: Fix SSL 1.1 support on API-21BogDan Vatra2019-07-261-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | OpenSSL 1.1.x libs must be suffixed otherwise it will use the system ones which on API-21 are OpenSSL 1.0 not 1.1 Fixes: QTBUG-76884 Change-Id: I7d4052be68cf7dc65f74a48da8e1e37182056a5e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | QtNetwork: ssl: port from QMutex::Recursive to QRecursiveMutexMarc Mutz2019-07-183-3/+3
| | | | | | | | | | | | | | | Change-Id: I78913fee6720f6ad9b196824b35de189567340be Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | qsslsocket_openssl_symbols.cpp: replace manual memory management with ↵Marc Mutz2019-07-101-51/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::unique_ptr Also fix the name mismatch between the Windows- and non-Windows versions of loadOpenSsl(), which, presumably, were caused by having two different return values, something easily fixed by defining a small struct instead of using a QPair. Some #ifdef'ery saved, and a lot of brittle deletes on early returns. Change-Id: I77440de2f6fa51759510506ff4ef51917eb5b3ea Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | Inline QMutexPool into its only remaining userMarc Mutz2019-07-081-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also reduce the pool size from 131 to 17, and use QBasicMutex instead of recursive ones. Change-Id: I3bf0374cce5ff2c07427070aba6128a22c9b70e4 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | qsslsocket_openssl_symbols.cpp: replace mutex pool use with QBasicMutexMarc Mutz2019-07-081-14/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The use of QMutexPool caused an #ifdef, because, lacking an object, some OpenSSL function pointer was used as the address required as input for the mutex pool. Sadly, the names of the functions differ between OpenSSL versions, thus the need for an #ifdef. By simply using a QBasicMutex (defined at namespace scope to evade https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79561), the #ifdef can go away. Another level of #ifdefs goes away because, even for non-QT_CONFIG(thread) builds, Q*Mutex etc are defined, just as no-ops. So we can freely use them without QT_CONFIG(thread) guard, unlike QMutexPool. Finally, optimize for the (common?) case of already-loaded libraries by making symbolsResolved an atomic variable, and checking that before taking the mutex (double-checked locking, done right). For reasons of said GCC bug, again, the QBasicAtomic is defined at namespace scope. And then move the other boolean there for symmetry. Change-Id: Ic5f44871fb200e5368b9af327e4d1e852fbc586c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | Fix build without features.libraryTasuku Suzuki2019-07-061-1/+0
| | | | | | | | | | | | | | | Change-Id: I3ce4a8e4c6488737115f2f16bfd8f0e1fc5fc4fa Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | Remove usages of QSysInfo's deprecated APIsSona Kurazyan2019-07-052-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Replaced QOperatingSystemVersion::WindowsVersion, QSysInfo::windowsVersion(), QSysInfo::macVersion(), QSysInfo::MacintoshVersion with QOperatingSystemVersion::current(). - Added QOperatingSystemVersion::WindowsVista for convenience, as it is used in lots of places. Change-Id: If9c4ac496005b2e70b5c70be160747afa74b98c1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-07-011-1/+0
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/ssl/qsslsocket_openssl.cpp src/platformsupport/vkconvenience/qvkconvenience.cpp Change-Id: I97ce6ed185f7fdad8102cc58d3cfec0119fd7bb4
| * | qsslsocket_openssl.cpp - restructure the codeTimur Pocheptsov2019-06-281-6/+4
| | | | | | | | | | | | | | | | | | | | | not to resolve merge conflicts on every 5.13->dev merge. Change-Id: Id41a7efff52148fe46bedcde828646694fd1764d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | Mark qHash(QOcspResponse) as noexceptMarc Mutz2019-06-292-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Because it is. Change-Id: I8d5204c30884b2c8656615a7d82428c539672d28 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-06-271-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/network/ssl/qsslsocket_openssl.cpp Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io> Change-Id: Ibb57a0548b4977797b400637487a56245ac1c024
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-06-255-54/+70
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qstorageinfo_unix.cpp src/network/ssl/qsslsocket_openssl.cpp Change-Id: Ibc9ce799bef62d60d616beaa9fbde8ebeadfbc20
| * | checkOcspResponse - remove unneeded lockingTimur Pocheptsov2019-06-171-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and also plain wrong comments: since we don't set verification callback on a store - we don't have to lock (our q_X509Callback never gets called). This change should simplify the merge with change I have in 5.12 (where I completely got rid of locking). Since I don't care about exact errors found (relying on the fact it's the same chain of certs we check in SSL_connect/SSL_accept), for now we don't try to extract them from OCSP_basic_verify. In fufure, if these chains are different, we can create a temporary store (see how it's done in 'verify', for example) and set a VF callback on this store. Change-Id: I4a36e19836d19c2ea95c869dcfe85f49fe723ff0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * | Merge remote-tracking branch 'origin/5.13.0' into 5.13Liang Qi2019-06-173-0/+64
| |\ \ | | | | | | | | | | | | Change-Id: I39248f6c561c6274ab5ead64238dd2f80e167eee
| | * | QSslSocket: add and set the TLSv1.3-specific PSK callbackMårten Nordheim2019-06-133-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If this callback is not set then OpenSSL will call the callback used for <= TLS 1.2 unconditionally when connecting. If using PSK it will call it again later once the preshared key is needed. We don't currently handle the TLSv1.3 PSK, but we definitely should. But for now we can work around it - when psk_use_session_callback is called we simply change the PSK callback to a dummy function whose only purpose is to restore the old callback. This is mostly done to keep behavior the same as it is now for users (and to keep our tests running). Later we can add a new signal and handle this new feature properly. Reviewed-by: Simo Fält <simo.falt@qt.io> (cherry picked from commit d8efc8d718e3b3a0464f321e740541f5b221a5d6) Task-number: QTBUG-67463 Change-Id: I4aca4ae73ec4be7c4f82a85e8864de103f35a834 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-06-255-73/+139
|\ \ \ \ | | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/gui/painting/qdrawhelper.cpp src/gui/text/qdistancefield.cpp src/gui/text/qdistancefield_p.h src/network/ssl/qsslsocket_openssl.cpp src/plugins/platforms/android/qandroidinputcontext.cpp src/widgets/styles/qstylesheetstyle.cpp Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io> Change-Id: Ia7daad21f077ea889898f17734ec46303e71fe6b
| * | | TLS socket: make verification callback lock-free (OpenSSL)Timur Pocheptsov2019-06-175-51/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When our QSslSocketBackendPrivate (OpenSSL backend) was developed, the ancient versions of OpenSSL did not have an API needed to pass an application-specific data into verification callback. Thus the developers resorted to the use of global variables (a list with errors) and locks. Some of our auto-tests use QNAM and in-process server. Whenever the client (essentially qhttpthreadeddelegate) and the server live in different threads, any use of 'https' is dead-lock prone, which recent events demonstrated and which were previously observed but not understood properly (rare occasions, not always easy to reproduce). Now we fix this for good by removing locking. There are two places (in 5.12) where these locks are needed: 1. Before calling SSL_connect/SSL_accept (handshake) - here we reuse the same trick we do in PSK callback ('SSL' has an external data set, and it's 'this', meaning an object of type QSslSocketBackendPrivate). 2. The static member function 'verify', here we do not have 'SSL', but we have our temporary 'X509_STORE', to which we can directly attach an external data - a pointer to a vector to collect verification errors. Note, this change assumes that OpenSSL Qt is build/linked against is at least of version 1.0.1 - we set external data on SSL unconditionally (no version checks). Fixes: QTBUG-76157 Change-Id: I05c98e77dfd5fb0c2c260fb6c463732facf53ffc Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
| * | | QSslSocket: add and set the TLSv1.3-specific PSK callbackv5.12.4Mårten Nordheim2019-06-123-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If this callback is not set then OpenSSL will call the callback used for <= TLS 1.2 unconditionally when connecting. If using PSK it will call it again later once the preshared key is needed. We don't currently handle the TLSv1.3 PSK, but we definitely should. But for now we can work around it - when psk_use_session_callback is called we simply change the PSK callback to a dummy function whose only purpose is to restore the old callback. This is mostly done to keep behavior the same as it is now for users (and to keep our tests running). Later we can add a new signal and handle this new feature properly. Task-number: QTBUG-67463 Change-Id: I4aca4ae73ec4be7c4f82a85e8864de103f35a834 Reviewed-by: Simo Fält <simo.falt@qt.io>
* | | | Port from QAtomic::load() to loadRelaxed()Giuseppe D'Angelo2019-06-204-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | | Use QtPrivate::QHashCombine in qHash(QSslError)Marc Mutz2019-05-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's the same operations as boost::hash_combine, but without explicit magic numbers. Change-Id: Id65b6f6b7be3070e4ec349ed0cc062af473a95b3 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | | | QSslSocket: do not bypass the base class' overridesGiuseppe D'Angelo2019-05-141-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Ifd0842c70af764827a7e815efbc96da6cad99672 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | | Fix qdoc warnings for Qt 5.14Friedemann Kleint2019-05-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/corelib/tools/qstring.cpp:9505:clang found diagnostics parsing \fn int QLatin1String::indexOf(QLatin1String l1, int from Qt::CaseSensitivity cs) const error: expected ')' error: out-of-line definition of 'indexOf' does not match any declaration in 'QLatin1String' src/corelib/tools/qstringview.cpp:723:clang found diagnostics parsing \fn qsizetype QStringView::indexOf(QLatin1String l1, qsizetype from Qt::CaseSensitivity cs) const error: expected ')' error: out-of-line definition of 'indexOf' does not match any declaration in 'QStringView' src/corelib/tools/qstringview.cpp:822:Unknown command '\t' src/corelib/tools/qstringview.cpp:825:Unknown command '\t' src/corelib/tools/qstringview.cpp:826:Unknown command '\t' src/corelib/tools/qstringview.cpp:831:Unknown command '\t' src/corelib/global/qnamespace.qdoc:2448:Undocumented enum item 'MarkdownText' in Qt::TextFormat src/corelib/tools/qstringmatcher.cpp:183:No such parameter 'pattern' in QStringMatcher::QStringMatcher() src/network/ssl/qsslerror.cpp:58:Undocumented enum item 'CertificateStatusUnknown' in QSslError::SslError src/gui/kernel/qevent.cpp:5321:Undocumented parameter 'screenOrientation' in QScreenOrientationChangeEvent::QScreenOrientationChangeEvent() src/gui/kernel/qevent.cpp:5321:Undocumented parameter 'screen' in QScreenOrientationChangeEvent::QScreenOrientationChangeEvent() src/gui/kernel/qevent.cpp:5321:No such parameter 'orientation' in QScreenOrientationChangeEvent::QScreenOrientationChangeEvent() src/gui/text/qtextformat.cpp:532:Undocumented enum item 'BlockCodeLanguage' in QTextFormat::Property src/gui/text/qtextformat.cpp:532:Undocumented enum item 'BlockQuoteLevel' in QTextFormat::Property src/gui/text/qtextformat.cpp:532:Undocumented enum item 'BlockMarker' in QTextFormat::Property src/gui/text/qtextdocument.cpp:3294:Undocumented parameter 'features' in QTextDocument::toMarkdown() src/gui/painting/qcolorspace.cpp:659:Undocumented parameter 'colorSpace1' in QColorSpace::operator!=() src/gui/painting/qcolorspace.cpp:659:Undocumented parameter 'colorSpace2' in QColorSpace::operator!=() src/gui/painting/qcolorspace.cpp:659:No such parameter 'colorspace1' in QColorSpace::operator!=() src/gui/painting/qcolorspace.cpp:659:No such parameter 'colorspace2' in QColorSpace::operator!=() examples/widgets/doc/src/icons.qdoc:269:Command '\snippet (//! [43])' failed at end of file 'widgets/icons/iconpreviewarea.cpp' src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogRetryButton' in QStyle::StandardPixmap src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogYesToAllButton' in QStyle::StandardPixmap src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogIgnoreButton' in QStyle::StandardPixmap src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogNoToAllButton' in QStyle::StandardPixmap src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogAbortButton' in QStyle::StandardPixmap src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_RestoreDefaultsButton' in QStyle::StandardPixmap src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogSaveAllButton' in QStyle::StandardPixmap src/testlib/qtestcase.qdoc:439:Undocumented parameter 'TestClass' in QTest::QTEST_HIGHDPI_SCALING_MAIN src/testlib/qtestcase.qdoc:452:Undocumented parameter 'TestClass' in QTest::QTEST_NO_HIGHDPI_SCALING_MAIN Change-Id: Ib0e9bf81c5caaa6b1fc644ac92085af47c600e0e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-05-132-3/+3
|\ \ \ \ | | |/ / | |/| | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qstring.cpp Change-Id: I81dbf90fc936c9bf08197baefa071117bddb1c63
| * | | Doc: replace even more null/0/nullptr with \nullptr macroChristian Ehrlicher2019-05-082-3/+3
| | |/ | |/| | | | | | | | | | | | | | | | | | | Try to replace all wordings like '.. to 0' with '.. to \nullptr'. Also checked for 'null pointer' and similar. Change-Id: I73341f59ba51e0798e816a8b1a532c7c7374b74a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Deprecate conversion functions between QList and QSetLars Knoll2019-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users should use range constructors instead to do the conversion. Keep conversion methods between QList and QVector as these will turn into a no-op in Qt 6, whereas forcing people to use range constructors would lead to deep copies of the data. Change-Id: Id9fc9e4d007044e019826da523e8418857c91283 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Remove handling of missing Q_COMPILER_RVALUE_REFSAllan Sandfeld Jensen2019-05-016-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | Remove remaining handling of missing support for rvalue refs. Change-Id: I78bab8bccfeeb9c76f464f345874364a37e4840a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>