Damir Jelić
8e53982bcd
Merge branch 'master' into crypto-improvements
2020-12-08 15:06:14 +01:00
Damir Jelić
b982d36303
crypto: Run the time sensitive tests only on linux.
2020-12-08 12:34:59 +01:00
Damir Jelić
35247fac2a
crypto: Fix a lint issue.
2020-12-08 10:50:58 +01:00
Damir Jelić
aa1a64628f
crypto: Remove a bunch of unneeded whitespace in a log line.
2020-12-05 14:59:40 +01:00
Damir Jelić
3f41e5071b
crypto: Preserve the relationship info while decrypting events.
2020-12-05 14:59:40 +01:00
Damir Jelić
9eb17e757c
matrix-sdk: Update ruma.
2020-12-05 14:59:40 +01:00
Damir Jelić
804bd221b2
crypto: Improve key imports.
...
This patch changes so key imports load all existing sessions at once
instead loading a single session for each session we are importing. It
removes the need to lock the session when we check the first known index
and exposes the total number of sessions the key export contained.
2020-12-02 11:12:46 +01:00
Damir Jelić
e20b1efae9
crypto: Store private identities and accounts with the Changes struct as well.
2020-12-01 17:14:32 +01:00
Damir Jelić
5d0ff961b2
crypto: Check the Olm message hash if we fail to decrypt an Olm message.
...
Wether by accident (the next_batch token doesn't get stored properly) or
by malicious intent (the server replays a message) an Olm encrypted to-device
message may appear multiple times.
This is usually fine since nothing bad happens, we don't decrypt the message
and the message gets thrown away.
Since the introduction of Olm session unwedging an undecryptable message
leads to the creation of a new fresh Olm session. To avoid this we
remember which Olm messages we already decrypted so they don't trigger
an unwedging dance.
2020-12-01 14:50:04 +01:00
Damir Jelić
270350cd34
crypto: Save the olm message hash.
2020-12-01 14:38:03 +01:00
Damir Jelić
24592adbba
crypto: Return a higher level struct when decrypting olm messages instead of tuples
2020-12-01 12:41:11 +01:00
Damir Jelić
efe659910f
crypto: Remove some stale TODOs.
2020-12-01 11:20:55 +01:00
Damir Jelić
7e9baf2707
crypto: Remove some dead code definitions.
2020-11-26 14:15:52 +01:00
Damir Jelić
3073883076
crypto: Fix a clippy warning.
2020-11-26 14:02:35 +01:00
Damir Jelić
7ec5a5ad1a
Merge branch 'master' into crypto-improvements
2020-11-26 13:24:57 +01:00
Jonas Platte
0422bae924
Fix clippy lint rc_buffer
2020-11-25 19:01:28 +01:00
Damir Jelić
c40edcf2fc
matrix-sdk: Try to lower our compile times, at least in the crypto part for now.
2020-11-20 20:35:48 +01:00
Damir Jelić
b67cd4ddd2
crypto: Create a trusted public cross signing identity when we create a private one.
2020-10-30 13:21:14 +01:00
Damir Jelić
cb95f576a5
crypto: Clear out the signatures when signing a device.
...
This avoids re-uploading all the existing signatures.
2020-10-29 15:37:29 +01:00
Damir Jelić
5c530cf9ee
crypto: Upload signatures after verification is done.
2020-10-27 16:39:23 +01:00
Damir Jelić
2077ea0ddf
crypto: Split out the device_key signing method.
2020-10-27 13:48:51 +01:00
Damir Jelić
e757d605f5
crypto: Allow users to be signed as well.
2020-10-27 13:29:19 +01:00
Damir Jelić
61a5293af5
cyrpto: Document the signing module.
2020-10-26 16:03:59 +01:00
Damir Jelić
6e83a4bbca
crypto: Split out the signing module into two files.
2020-10-26 16:03:59 +01:00
Damir Jelić
5c14910126
crypto: WIP cross signing bootstrap.
2020-10-26 16:03:59 +01:00
Damir Jelić
7de002b128
crypto: Fix some lint issues.
2020-10-22 16:40:05 +02:00
Damir Jelić
f60dc7ed78
crypto: Allow cross signing identities to be stored/restored.
2020-10-22 16:25:25 +02:00
Damir Jelić
c9db63509f
crypto: Add error handling to the signing module.
2020-10-21 16:24:10 +02:00
Damir Jelić
6a7da5a8b6
crypto: Correctly generate a random nonce for pickling of the signing objects.
2020-10-21 12:55:45 +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ć
728d80ed06
crypto: Connect the cross signing to the main state machine.
2020-10-19 16:03:01 +02:00
Damir Jelić
59a7199202
crypto: Initial test for the session manager.
2020-10-15 13:58:35 +02:00
Damir Jelić
d1313b8614
crypto: Fix another clippy warning.
2020-10-14 16:15:26 +02:00
Damir Jelić
4e8ce4cb5d
crypto: Fix clippy warnings and don't use the PickleMode for signing pickling.
2020-10-14 16:01:52 +02:00
Damir Jelić
c85fe6bc21
crypto: Initial support for private cross signing identities.
2020-10-14 15:35:06 +02:00
Damir Jelić
bd0ac703a0
crypto: Initial logic for session unwedging.
2020-10-09 15:39:35 +02:00
Damir Jelić
23ac00c8ec
crypto: Initial support for group session invalidation.
2020-10-08 11:16:02 +02:00
Damir Jelić
e3d24f5c31
crypto: Fix some clippy warnings.
2020-10-01 16:45:13 +02:00
Damir Jelić
02c765f903
crypto: Don't mark outbound group sessions automatically as shared.
2020-10-01 16:31:24 +02:00
Damir Jelić
8fe1eda169
crypto: Test the full key share flow.
2020-09-29 14:18:03 +02:00
Damir Jelić
84066d4a76
crypto: Split out the Account into a read only portion and one with effects.
2020-09-29 12:03:41 +02:00
Damir Jelić
e1c220e2f7
crypto: Test a key share cycle.
2020-09-29 10:24:54 +02:00
Damir Jelić
23173c4a1e
crypto: Test our key sharing decision logic.
2020-09-28 14:51:57 +02:00
Damir Jelić
e29508938b
crypto: More work on the incoming key request handling.
2020-09-28 13:32:30 +02:00
Damir Jelić
c5bece2d58
crypto: Zeroize and remove the session key copies for forwarded room keys.
2020-09-24 11:18:01 +02:00
Damir Jelić
5b0457dad0
crypto: Remember the users that received the outbound group session.
2020-09-18 18:55:17 +02:00
Damir Jelić
692f9baa0e
crypto: Add logic to handle outgoing key requests.
2020-09-17 16:09:08 +02:00
Damir Jelić
ffd2843b0a
matrix-sdk: Expose the import/export keys methods.
2020-09-11 16:34:39 +02:00
Damir Jelić
8af18a4df7
crypto: Test the EncryptionSettings conversion.
2020-09-10 16:21:23 +02:00
Damir Jelić
848156213b
crypto: Add a PartialEq derive for the exported key struct.
2020-09-10 15:51:39 +02:00
Damir Jelić
23e953d9cf
crypto: Hide some methods that shouldn't be public.
2020-09-10 15:49:34 +02:00
Damir Jelić
9617d9aac9
crypto: Test the import/export of group sessions.
2020-09-09 16:10:16 +02:00
Damir Jelić
e828828ace
crypto: Document the exported key -> forwarded room key conversion methods.
2020-09-09 15:11:25 +02:00
Damir Jelić
3e9b0a8e7f
crypto: Correctly store the ed25519 key map for inbound group sessions.
2020-09-09 15:03:19 +02:00
Damir Jelić
aff1e1d0a8
crypto: Add key export methods for inbound group sessions.
2020-09-09 12:47:28 +02:00
Damir Jelić
98f69aed41
crypto: Remove some duplicated types after the group session split.
2020-09-09 11:52:10 +02:00
Damir Jelić
acfd0cdb07
crypto: Split out the group session module into multiple files.
2020-09-09 11:07:49 +02:00
Damir Jelić
89efcee337
crypto: Move the signature verification method under an Utility struct.
2020-09-04 13:18:31 +02:00
Damir Jelić
7b3dfe2f27
crypto: Move the device and user identities under one module.
2020-09-04 10:51:46 +02:00
Damir Jelić
d86c05efb3
crypto: Add a fixme to the sqlite store since it's not storing forwarding chains.
2020-09-02 15:08:24 +02:00
Damir Jelić
2195da1cd8
crypto: Fix some docs.
2020-09-02 12:28:18 +02:00
Damir Jelić
8c4acf54e0
crypto: Reorder the errors so unpickling now returns the timestamp error.
2020-09-02 12:11:06 +02:00
Damir Jelić
81b127b6e7
crypto: Modify all the pickling logic so we return serializeable structs.
2020-09-02 11:45:35 +02:00
Damir Jelić
269cfc3d34
crypto: Add a pickled account struct making account storing easier.
2020-09-02 09:37:10 +02:00
Damir Jelić
0de4a21320
crypto: Expose some missing structs that are needed to implement a cryptostore.
2020-09-01 17:39:51 +02:00
Damir Jelić
39628a308b
matrix-sdk: Allow any event content to be sent out with room_send().
2020-08-26 15:41:27 +02:00
Damir Jelić
6760f81498
matrix-sdk: Update Ruma.
2020-08-26 13:40:38 +02:00
Damir Jelić
de90da4adc
crypto: Make the verification machine compatible with how we queue up requests.
2020-08-21 16:26:34 +02:00
Damir Jelić
002531349e
crypto: Decluter the main doc page a bit.
2020-08-21 15:06:54 +02:00
Damir Jelić
aee40977a3
crypto: Clamp the rotation period ms so users can't wedge E2E.
...
Users may set a very small rotation period this might mean that a
session might expire by the time it's shared ending up in a loop where
we constantly need to share a group session yet never manage to send a
message.
2020-08-21 12:50:16 +02:00
Damir Jelić
ce93869915
crypto: Return an Option instead of an empty result for the key uploads.
2020-08-21 09:50:01 +02:00
Damir Jelić
43aea6e482
crypto: Rename Device to ReadOnlyDevice.
2020-08-17 16:17:28 +02:00
Jonas Platte
5040be042f
Update ruma
2020-08-15 15:17:27 +02:00
Damir Jelić
6ee8b07cfe
crypto: Test that session expiration works correctly.
2020-08-13 15:03:28 +02:00
Damir Jelić
344631b4ee
crypto: Respect the encryption settings of a room when creating sessions.
2020-08-13 14:41:59 +02:00
Damir Jelić
7637e79f2c
matrix-sdk: Fix the tarpaulin skip directives.
2020-08-11 15:49:04 +02:00
Jonas Platte
d83fc971ce
Update ruma
2020-08-10 13:58:39 +02:00
Jonas Platte
d016ce1848
Use identifier macros in tests
2020-08-06 13:03:32 +02:00
Damir Jelić
2bf8c99dfe
Merge branch 'master' into sas-verification
2020-08-04 11:23:24 +02:00
Devin Ragotzy
0ac2b84c02
Unify import style across workspace
2020-08-02 08:05:43 -04:00
Devin Ragotzy
ed1f12ce37
Run cargo fmt with merge-imports true
2020-08-02 07:46:02 -04:00
Damir Jelić
7128505768
Merge branch 'master' into sas-verification
2020-07-26 21:20:53 +02:00
Jonas Platte
6a96368048
Upgrade ruma
2020-07-26 16:58:27 +02:00
Damir Jelić
094b2f90d6
Merge branch 'master' into sas-verification
2020-07-25 10:31:20 +02:00
Jonas Platte
ca88539ec4
Upgrade ruma
2020-07-25 02:23:10 +02:00
Damir Jelić
4fa58bfaac
crypto: Add getters for the user and device id in the account.
2020-07-22 13:40:47 +02:00
Damir Jelić
24baf1fe0f
crypto: More doc fixes.
2020-07-21 13:04:51 +02:00
Damir Jelić
861c07d5ce
cyrpto: Fix the docs for the Session encrypt method.
2020-07-21 12:59:15 +02:00
Damir Jelić
451d902604
crypto: Allow that many arguments on the from_pickle session method.
2020-07-21 12:57:31 +02:00
Damir Jelić
c3f00c96f8
crypto: Don't require the account to be passed when encrypting.
2020-07-21 12:46:06 +02:00
Damir Jelić
e50cf39a17
crypto: Store a copy of the user_id/device_id and identity keys in sessions.
2020-07-21 12:40:23 +02:00
Damir Jelić
3f1439fe28
crypto: Move the olm encryption logic into the Session struct.
2020-07-21 12:03:05 +02:00
Damir Jelić
3d6872607e
crypto: Move the m.room_key content creation into the outbound group session.
2020-07-21 11:12:20 +02:00
Damir Jelić
b22324b305
crypto: Split out the olm module into separate files.
2020-07-21 10:38:14 +02:00