aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-05-29Refresh and organise run-tests.sh/adjust-config.shAlexey Rusakov
run-tests.sh now uses the latest version of Synapse and has less repetitive code; adjust-config.sh moved to autotests/ (it had nothing specific to CI, after all), works with the newest Synapse (that has an additional enable_registration_without_verification safeguard) and no more depends on the config directory being called "data" but rather should be called from inside that directory (for the case when it is used separately from run-tests.sh and the config directory is not called "data").
2022-05-20Merge pull request #553 from TobiasFella/work/fixencryptionAlexey Rusakov
Truncate ciphertext buffer to actual size during file encryption
2022-05-20Apply suggestions from code reviewTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2022-05-20Merge pull request #552 from TobiasFella/work/encryptionsupportedAlexey Rusakov
Add function to check if e2ee is supported
2022-05-20Truncate ciphertext buffer to actual size during file encryptionTobias Fella
The ciphertext for AES CTR is exactly as large as the plaintext (not necessarily a multiple of the blocksize!). By truncating the ciphertext, we do not send bytes that will be decrypted to gibberish. As a side node, we probably do not need to initialize the ciphertext buffer larger than the plaintext size at all, but the OpenSSL docs are a bit vague about that.
2022-05-19Add function to check if e2ee is supportedTobias Fella
2022-05-19Fix cipher text buffer initializationTobias Fella
2022-05-19README: drop defunct Merge chance badgeAlexey Rusakov
2022-05-19Use Clang 12 for LGTM now that it runs on focalAlexey Rusakov
2022-05-19Fix FTBFS without E2EEAlexey Rusakov
2022-05-19Merge pull request #540 from TobiasFella/sendmessagesAlexey Rusakov
Implement sending encrypted messages
2022-05-19Document devices tupleTobias Fella
2022-05-19Apply suggestionsTobias Fella
2022-05-19Apply SuggestionsTobias Fella
2022-05-19Update lib/room.cppTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2022-05-19Use list of 3-tuple instead of mapTobias Fella
2022-05-18Make database independent of {Room, User, Connection}Tobias Fella
2022-05-18Update lib/events/encryptedevent.cppTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2022-05-18Apply suggestions from code reviewTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2022-05-16Fix build failuresTobias Fella
2022-05-16FixesTobias Fella
2022-05-16Add database migrationTobias Fella
2022-05-16Update lib/events/encryptedfile.hTobias Fella
2022-05-16More work; Update olm pickle & timestamps in database; Remove TODOsTobias Fella
2022-05-16Properly create encrypted editsTobias Fella
2022-05-16Implement sending encrypted filesTobias Fella
2022-05-16Keep log of where we send keys and send keys to new devices and usersTobias Fella
2022-05-16Save and load outgoing megolm sessionTobias Fella
2022-05-16Implement sending encrypted messagesTobias Fella
2022-05-16Add constructor for creating roomkeyeventsTobias Fella
2022-05-16Merge #550: Quotient::Expected and QOlmExpectedAlexey Rusakov
2022-05-16expected.h: add a copyright noticeAlexey Rusakov
[skip ci]
2022-05-16Update autotests/testolmutility.cppAlexey Rusakov
Co-authored-by: Tobias Fella <9750016+TobiasFella@users.noreply.github.com>
2022-05-16QOlmExpected and associated refactoringAlexey Rusakov
As mentioned in the commit introducing `Expected`, `QOlmExpected` is simply an alias for `Expected<T, QOlmError>`. This simplifies quite a few function signatures in `QOlm*` classes and collapses unwieldy `std::holds_alternative<>`/`std::get<>` constructs into a neat contextual bool cast and an invocation of `operator*` or `value()`/`error()` accessors that don't need to specify the type. While refactoring the code, I found a couple of cases of mismatching `uint32_t` and `qint32_t` in return values; a couple of cases where `decrypt()` returns `QString` which is in fact `QByteArray` (e.g., in `QOlmSession::decrypt()`); there's a repetitive algorithm in `Connection::Private::sessionDecryptPrekey()` and `sessionDecryptGeneral()`
2022-05-16Simplify QOlmSession::matchesInboundSession*()Alexey Rusakov
There's no particular use in letting `QOlmError` out, only to confirm that, well, `QOlmError` is just another form of no-match.
2022-05-16QOlmAccount::needsSave() shouldn't be constAlexey Rusakov
Making Qt signals const is an impossible commitment - once the signal is out, you can't control if any called slot will change the emitting class or not. The code compiles but const-ness is not preserved.
2022-05-16Expected<>Alexey Rusakov
This is a minimal implementation along the lines of `std::expected<>` introduced in C++23; once compilers catch up with C++23 support, it may become simply a typedef of std::expected. There are no tests as yet; but the following commits will introduce QOlmExpected that would replace the current `std::variant<T, QOlmError>` pattern used throughout `QOlm*` classes, automatically pulling Expected under the coverage of `QOlm*` unit tests.
2022-05-16Optimise #includes for QOlm* classesAlexey Rusakov
2022-05-16room.cpp: use return {} where appropriateAlexey Rusakov
2022-05-16Quotest: test checkResource()Alexey Rusakov
2022-05-14Merge pull request #549 from quotient-im/kitsune/various-fixesAlexey Rusakov
Various fixes and cleanup
2022-05-14Cleanup across the boardAlexey Rusakov
Mainly driven by clang-tidy and SonarCloud warnings (sadly, SonarCloud doesn't store historical reports so no link can be provided here).
2022-05-11CallAnswerEvent: drop lifetimeAlexey Rusakov
See https://github.com/matrix-org/matrix-spec/pull/1054. # Conflicts: # lib/events/callanswerevent.cpp # lib/events/callanswerevent.h
2022-05-11Fix race condition in consumeRoomData()Alexey Rusakov
QCoreApplication::processEvents() is well-known to be a _wrong_ solution to the unresponsive UI problem; despite that, connection.cpp has long had that call to let UI update itself while processing bulky room updates (mainly from the initial sync). This commit finally fixes this, after an (admittedly rare) race condition has been hit, as follows: 0. Pre-requisite: quotest runs all the tests and is about to leave the room; there's an ongoing sync request. 1. Quotest calls /leave 2. Sync returns, with the batch of _several_ rooms (that's important) 3. The above code handles the first room in the batch 4. processEvents() is called, just in time for the /leave response. 5. The /leave response handler in quotest ends up calling Connection::logout() (processEvents() still hasn't returned). 6. Connection::logout() calls abandon() on the ongoing SyncJob, pulling the rug from under onSyncSuccess()/consumeRoomData(). 7. processEvents() returns and the above code proceeds to the next room - only to find that the roomDataList (that is a ref to a structure owned by SyncJob), is now pointing to garbage. Morals of the story: 1. processEvents() effectively makes code multi-threaded: one flow is suspended and another one may run _on the same data_. After the first flow is resumed, it cannot make any assumptions regarding which data the second flow touched and/or changed. 2. The library had quite a few cases of using &&-refs, avoiding even move operations but also leaving ownership of the data with the original producer (SyncJob). If the lifetime of that producer ends too soon, those refs become dangling. The fix makes two important things, respectively: 2. Ownership of room data is now transfered to the processing side, the moment it is scheduled (see below), in the form of moving into a lambda capture. 1. Instead of processEvents(), processing of room data is scheduled via QMetaObject::invokeMethod(), uncoupling the moment when the data was received in SyncJob from the moment they are processed in Room::updateData() (and all the numerous signal-slots it calls). Also: Room::baseStateLoaded now causes Connection::loadedRoomState, not the other way round - this is more natural and doesn't need Connection to keep firstTimeRooms map around.
2022-05-08Merge #548: Streamline usage of event types, part 1Alexey Rusakov
2022-05-08QUO_CONTENT_GETTERAlexey Rusakov
To streamline adding of simple getters of content parts.
2022-05-08Use std::pair instead of QPairAlexey Rusakov
QPair is giving way to its STL counterpart, becoming its alias in Qt 6.
2022-05-08More cleanupAlexey Rusakov
2022-05-08Generalise DEFINE_SIMPLE_EVENTAlexey Rusakov
This macro was defined in accountdataevents.h but adding one more parameter (base class) makes it applicable to pretty much any event with the content that has one key-value pair (though state events already have a non-macro solution in the form of `StateEvent<EventContent::SingleKeyValue>`). Now CustomEvent definition in quotest.cpp can be replaced with a single line.
2022-05-08Pass matrixType(QString), not Event::Type, to basicJson()Alexey Rusakov
Not that it was very important, as the two are basically the same thing (and matrixTypeId() is about to be obsoleted); but formally basicJson() is supposed to get the former, not the latter.