Commit graph

38 commits

Author SHA1 Message Date
Damir Jelić
593b5e55cb crypto: Don't load the account every time we load sessions in the sled store
This removes a massive performance issue since getting sessions is part
of every message send cycle.

Namely every time we check that all our devices inside a certain room
have established 1 to 1 Olm sessions we load the account from the store.

This means we go through an account unpickling phase which contains AES
decryption every time we load sessions.

Cache instead the account info that we're going to attach to sessions
when we initially save or load the account.
2021-03-11 19:49:32 +01:00
Damir Jelić
aff5cddb68 crypto: Remove an unneeded import. 2021-03-10 09:58:30 +01:00
poljar
4a8c30527d
crypto: Fix a typo.
Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2021-03-10 09:54:33 +01:00
Damir Jelić
560aa5b0a9 crypto: Encrypt the share group session requests in parallel. 2021-03-09 15:09:59 +01:00
Damir Jelić
a8bc619dca crypto: Encrypt room keys for a room key share request in parallel 2021-03-09 14:30:28 +01:00
Damir Jelić
61167fab15 crypto: Make restored outbound sessions wait for requests if they have some 2021-03-05 17:12:32 +01:00
Damir Jelić
c5241af675 crypto: Expose the crypto store error pulicly 2021-03-04 17:46:18 +01:00
Damir Jelić
93e5c34670 crypto: Add a bit more info to the room key sharing logic logging 2021-03-02 17:15:10 +01:00
Damir Jelić
6597948564 crypto: Add a TODO item for m.room_key.withheld messages 2021-03-02 16:27:24 +01:00
Damir Jelić
693a0337a2 crypto: Don't log the devices that receive an outbound session twice 2021-03-02 16:26:58 +01:00
Damir Jelić
123772c524 crypto: More logs for the group session sharing logic 2021-03-02 14:54:56 +01:00
Damir Jelić
bb358909ef crypto: Fix a typo and improve some logs in the session sharing logic. 2021-03-02 12:54:22 +01:00
Denis Kasak
3f7eae8633 cargo fmt 2021-03-02 12:20:09 +01:00
Denis Kasak
2b5e1744ee More refactoring of the group session sharing code for clarity. 2021-03-02 12:20:09 +01:00
Denis Kasak
df8c489304 Fix typo: visiblity -> visibility 2021-03-02 12:20:09 +01:00
Denis Kasak
aa16a7e291 crypto: Refactor the group session rotation code some more for clarity. 2021-03-02 12:20:09 +01:00
Denis Kasak
70ecf269d0 Improve docstring of GroupSessionManager::collect_session_recipients. 2021-03-02 12:20:09 +01:00
Damir Jelić
2e659afd26 crypto: Make it clearer that the deleted flag can only be set to true 2021-03-01 20:34:29 +01:00
Damir Jelić
9e83eaf2f5 crypto: Store the history visiblity with the outbound session 2021-02-03 16:01:58 +01:00
Damir Jelić
10da61c567 crypto: Answer key reshare requests only at the originally shared message index 2021-01-28 14:07:51 +01:00
Damir Jelić
6cb2c8b468 crypto: Store and restore outbound group sessions 2021-01-25 17:14:13 +01:00
Damir Jelić
1483c22171 crypto: Don't send out empty to-device reuqests when sharing sessions
An empty to-device request can happen if we're trying to re-share a
session with devices that are we're missing an olm session with so don't
send them out.
2021-01-21 14:04:31 +01:00
Damir Jelić
ef2f20eb97 crypto: Rotate the megolm session if a device gets blacklisted 2021-01-21 12:19:02 +01:00
Damir Jelić
de4df4e50a base: Re-introduce a state store trait. 2021-01-21 12:08:16 +01:00
Damir Jelić
377b8ea75a crypto: Use consistent ordering for the group session sharing log line 2021-01-19 10:19:15 +01:00
Damir Jelić
e5ba0298d0 crypto: Refactor and document the share group session method a bit better 2021-01-18 15:21:54 +01:00
Damir Jelić
4eb504d000 crypto: Improve the log line when we share group sessions 2021-01-18 14:15:31 +01:00
Damir Jelić
436530e874 crypto: Fix a couple clippy warnings 2021-01-18 13:50:59 +01:00
Damir Jelić
43a74524c5 crypto: Add a pending requests method for the outbound group session 2021-01-18 12:44:19 +01:00
Damir Jelić
bab8fde0ac crypto: Change the way we share group sessions
This patch removes the need to ask if a group session needs to be shared
it also adapts the method so it re-shares sessions if new users or
devices join the group.
2021-01-15 18:04:45 +01:00
Damir Jelić
4ab6ae7f30 crypto: Fix an os_target definition. 2020-12-08 13:15:19 +01:00
Damir Jelić
c8dd6bfd26 crypto: Scope the imports for the unwedging test into the test. 2020-12-08 12:56:16 +01:00
Damir Jelić
b982d36303 crypto: Run the time sensitive tests only on linux. 2020-12-08 12:34:59 +01:00
Damir Jelić
7ec5a5ad1a Merge branch 'master' into crypto-improvements 2020-11-26 13:24:57 +01:00
Damir Jelić
34bec59389 crypto: Hold on to the private identity in the store. 2020-10-30 11:34:55 +01:00
Damir Jelić
5fd004bae5 crypto: Connect the private identity to the verification machine. 2020-10-23 11:17:13 +02:00
Damir Jelić
7cab7cadc9 crypto: Rework the cryptostore.
This modifies the cryptostore and storage logic in two ways:
    * The cryptostore trait has only one main save method.
    * The receive_sync method tries to save all the objects in one
    `save_changes()` call.

This means that all the changes a sync makes get commited to the store
in one transaction, leaving us in a consistent state.

This also means that we can pass the Changes struct the receive sync
method collects to our caller if the caller wishes to store the room
state and crypto state changes in a single transaction.
2020-10-20 17:19:37 +02:00
Damir Jelić
e7a24d5e68 crypto: Move the session managers under a common module. 2020-10-16 11:09:55 +02:00