aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-10-06Merge #575: Properly export KeyVerificationKeyEventAlexey Rusakov
2022-10-06Properly export KeyVerificationKeyEventTobias Fella
2022-10-03Regenerate API files from spec v1.4Alexey Rusakov
2022-10-02Relax Omittable::operator->/operator*Alexey Rusakov
The imposed limitations made mutation of Omittables pretty much impossible outside of rvalues. Honestly, it was pretty much the original intention - and it doesn't look right, in retrospect. (cherry picked from commit 7f886b34936f324662eb17afbb214d4800dcea03)
2022-09-26Merge #571: Unify reporting and handling of Olm errorsAlexey Rusakov
2022-09-26Merge branch 'dev' into kitsune/unify-olm-errorsAlexey Rusakov
2022-09-26QOlmUtility::ed25519Verify: just return boolAlexey Rusakov
It's too easy to incorrectly test the previous return type. (cherry picked from commit 5904a61c59f0eef00aef07ef998658fd791ff139)
2022-09-26Remove no-op codeAlexey Rusakov
2022-09-26Trample Sonar warningsAlexey Rusakov
2022-09-26Wrap error reporting into facility macrosAlexey Rusakov
Facility macros to report Olm errors: QOLM_INTERNAL_ERROR[_X], QOLM_FAIL_OR_LOG[_X]
2022-09-26RandomBufferAlexey Rusakov
A convenient abstraction swallowing all the type casts and, more importantly, cleanup on destruction (previous code only cleaned up the buffer upon a successful call to Olm API but not upon an error).
2022-09-26Cleanup across E2EE codeAlexey Rusakov
Notably: - simplified unnecessarily verbose constructs; - formally aligned (no re-numeration was necessary) QOlmMessage::Type with corresponding OLM_ constants; - dropped QOlmSession::encryptMessageType() because it's very sensitive to the order of calling with QOlmSession::encrypt() (and encrypt() itself already calls it and returns the message type); - simplify the return type of pickle() calls that can only fail due to an internal error; - replace const QString& with QStringView or const QByteArray& where appropriate; - use '\0' where it was meant to be instead of '0'.
2022-09-26Replace QOlmError with OlmErrorCodeAlexey Rusakov
QOlmError represents a subset of OlmErrorCode, and the associated fromString() function uses undocumented strings produced inside Olm; meanwhile OlmErrorCode is documented in its own header file. Each QOlm* class now has lastErrorCode() next to lastError() (that, from now, returns a textual representation straight from Olm, not QOlmError enum). Also: including olm/error.h in e2ee/e2ee.h required some rearrangement of the code to make sure non-E2EE configuration still builds.
2022-09-25QOlmUtility::ed25519Verify: just return boolAlexey Rusakov
It's too easy to incorrectly test the previous return type.
2022-09-24Merge #573: Fix verificationAlexey Rusakov
2022-09-24Update lib/connection.cppTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2022-09-24Merge #572: Fix construction of EncryptedEventsAlexey Rusakov
2022-09-24Use basicJson()Tobias Fella
2022-09-24Fix verificationTobias Fella
Contains two fixes: - When receiving the mac, we can also be in WAITINGFORVERIFICATION state - Ignore all KeyVerificationDone events; we don't do anything with them anyway and sometimes receive them after the session is destructed
2022-09-24Fix construction of EncryptedEventsTobias Fella
The parent constructor requires full json instead of content json now
2022-09-23Merge pull request #570 from quotient-im/tobias/mxcreply_no_roommessageeventAlexey Rusakov
Don't crash in MxcReply if the event is not a RoomMessageEvent
2022-09-23Don't crash in MxcReply if the event is not a RoomMessageEventTobias Fella
2022-09-21CI: only use Valgrind with GCCAlexey Rusakov
As of the current GHA jammy image, Valgrind cannot cope with some of Clang 14 output: https://bugs.kde.org/show_bug.cgi?id=452758 This is most likely a band-aid, before the work on switching from Valgrind to ASan.
2022-09-21Bump required Olm version to 3.2.5Alexey Rusakov
This is the earliest version shipping olm/error.h. Conversely, stock libolm that comes with Ubuntu 20.04 (version 3.1.3) is no more enough so CI completely switches to jammy now.
2022-09-21.clang-tidy: drop readability-qualified-autoAlexey Rusakov
Too many suggestions to add, e.g., * in places where it may eventually be a smart pointer. [skip ci]
2022-09-18Cleanup NAM more carefullyAlexey Rusakov
This tries to fix getting stuck at exit since NAM has been switched from QThreadStorage to thread_local
2022-09-18Update README on E2EEAlexey Rusakov
[skip ci]
2022-09-17Fix building with GCCAlexey Rusakov
2022-09-17room.*: fix doc-comments, use [[deprecated]]Alexey Rusakov
Previously moc choked on [[attributes]]; deprecated signals, slots etc. were documented as \deprecated instead. By Qt 5.15, that was fixed.
2022-09-14Fix a CMake-breaking typo in the just commited codeAlexey Rusakov
2022-09-14CMakeLists: add flags more carefully for non-WindowsAlexey Rusakov
Previous logic wasn't quite accurate with detection of existing flags in CMAKE_CXX_FLAGS - the new code doesn't add a flag if the negating flag is already there. This required separate treatment of positive and negative (-Wno-*) flags.
2022-09-12Merge #568: Add autotest for key verification and fix several edge-casesAlexey Rusakov
2022-09-12NetworkAccessManager: QThreadStorage -> thread_localAlexey Rusakov
It's more straightforward in usage and less prone to leaks (QThreadStorage doesn't delete objects when on non-main thread).
2022-09-12Only trust verification keys if the user verified the SASAlexey Rusakov
2022-09-12Merge #569: Fix a leak in Connection::saveAccessTokenToKeychain()Alexey Rusakov
2022-09-12Fix a leak in Connection::saveAccessTokenToKeychain()Alexey Rusakov
2022-09-11TestKeyVerification: Add a missing allowed stateAlexey Rusakov
2022-09-11KeyVerificationEvent; KeyVerificationSession::handleEvent()Alexey Rusakov
Key verification events gain their own base type and KeyVerificationSession gets a single point of entry for all kinds of incoming events. This allows to drop a pile of `incoming*` signals in Connection and a stack of options inside switchOnType in processIfVerification(). KVS::handleEvent() also makes (some) allowed state transitions a bit clearer.
2022-09-10Adjust converters.h logic to support Qt 6.4Alexey Rusakov
There's a bit convoluted stack of calls involved here, worth laying out. C++ containers are loaded from JSON containers by calling fromJson<> on each element of the JSON container, specialised by the element type of the C++ container. If that element type is not itself an object (e.g., QString), the respective specialisation of fromJson<> is supposed to kick-in and override the default template that delegates the conversion to JsonConverter (which in turn falls back to JsonObjectConverter unless specialised for that type). Because template functions cannot be partially specialised, that specialised overload for, say, QString, is not complete: it accepts QJsonValue but anything except QJsonValue will hit the generic overload instead. That makes the whole fromJson<> machinery quite sensitive to the exact JSON type passed to it; but as of Qt 5, the types actually presented to fromJson() were limited to QJsonValue and QJsonDocument (okay, QJsonObject and QJsonArray could also be there but the QJsonObject case is trivial for JsonConverter and containers loaded from QJsonArray are all caught with JsonArrayConverter). Qt 6 started returning (const) QJsonValueRef from `QJson*::const_iterator::operator*()` - meaning that whenever a simple type (like, again, QString) is loaded within the bigger container, the "wrong" fromJson() gets called. To fix this, JsonObjectUnpacker gained a dedicated function to unpack QJsonValueRef. QJsonValueRef is an old name existing since Qt 5.15 - no big pain. However, in Qt 6.4 QJsonValueConstRef is getting introduced for the same purpose. It's possible to wrap the *Ref overloads in some #if/#else brackets but at that point it becomes easier to just produce QJsonValue from whatever QJson* iterators dereference to.
2022-09-10Remove header for keyverificationtestTobias Fella
2022-09-10Update lib/keyverificationsession.hTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2022-09-10CMakeLists, MSVC: require new preprocessor in publicAlexey Rusakov
The new MSVC preprocessor is needed to correctly deal with variadic macros defined in .h files, so the respective compiler switch has to be added when building depending projects too.
2022-09-10CMakeLists: adjust .cmake files install path on WindowsAlexey Rusakov
With CMAKE_INSTALL_LIBDIR set to ".", the place .cmake files land in was not discoverable by find_package(), assuming a conventional CMAKE_PREFIX_PATH.
2022-09-09makeImpl: add support for aggregate initialisationAlexey Rusakov
Since C++17, parentheses only work when a constructor is there, while braces allow both calling a constructor and aggregate initialisation.
2022-09-09README: add a troubleshooting case with mixed Qt 5/6Alexey Rusakov
2022-09-06Add autotest for key verification and fix several edge-casesTobias Fella
2022-09-05CleanupAlexey Rusakov
2022-09-05sendToDevice: fix unintended slicingAlexey Rusakov
Ironically, this slicing would not break anything as all the necessary data are saved in the Event parent class; but the code is very fragile and scary.
2022-09-05Merge pull request #565 from quotient-im/kitsune/streamline-event-types-2Alexey Rusakov
Streamline event types, part 2
2022-09-04SingleKeyValue: use reference for template parameterAlexey Rusakov
I guess it was simply overlooked originally; in any case, currently used compilers deal with the reference just as fine as with the pointer.