aboutsummaryrefslogtreecommitdiffstats
path: root/matrix-e2e.c
Commit message (Collapse)AuthorAgeFilesLines
* fix some memory leaks (#135)iv4nhoe2023-02-071-0/+1
|
* e2e: Utility to decrypt media dataDr. David Alan Gilbert2018-02-251-0/+58
| | | | | | | Pass the received image data through gcrypt to do the decryption using the previously received keys. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Parse media decryption infoDr. David Alan Gilbert2018-02-251-0/+97
| | | | | | | | For encrypted images the decrypted message contains key information to decrypt the actual media once received. Add a structure and a parser to extract the information from the JSON. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Add device info actionDr. David Alan Gilbert2018-02-251-0/+31
| | | | | | | Add a purple action (i.e. thing on the accounts->matrix-> menu) to display the device ID and public key. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Cleanup inbound megolm sessions in memoryDr. David Alan Gilbert2018-02-251-3/+42
| | | | | | Cleanup on closing the plugin or leaving a conversation. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Update sessionsDr. David Alan Gilbert2018-02-251-3/+68
| | | | | | Update sessions stored in the db after starting sessions. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Store olm sessions in our dbDr. David Alan Gilbert2018-02-251-5/+102
| | | | Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Look for olm sessions in our dbDr. David Alan Gilbert2018-02-251-21/+265
| | | | | | | Keep a hash/list of olm sessions in memory and load them from the db if we find we haven't got one. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Route decrypted messages back upDr. David Alan Gilbert2018-02-251-9/+26
| | | | | | Parse the decrypted JSON and route it back up to the room code. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Decrypt m.room.encryptedDr. David Alan Gilbert2018-02-251-0/+113
| | | | | | | Decrypt m.room.encrypted messages sent to a room; these come out with normal events. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: handle m.room_keyDr. David Alan Gilbert2018-02-251-2/+77
| | | | | | | Decrypted olm messages of type m.room_key create inbound megolm sessions. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Provide storage for inbound megolm sessionsDr. David Alan Gilbert2018-02-251-0/+100
| | | | | | | | Attach to the room storage for inbound megolm sessions. TODO: Store to db TODO: Clean up this list in matrix_room_create_conversation Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Handle the decrypted olm messagesDr. David Alan Gilbert2018-02-251-0/+86
| | | | | | | Check the decrypted messages have matching keys/devices etc before parsing them any further. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: decrypt olm encrypted messageDr. David Alan Gilbert2018-02-251-1/+121
| | | | | | | Create an olm inbound session and use it to decrypt the message. Later patches will handle storing/retrieving the OLM sessions. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Parse received d2d m.room.encrypted messagesDr. David Alan Gilbert2018-02-251-0/+52
| | | | | | Parse the top level of m.room.encrypted messages. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Wire in sqlite3 to hold e2e databasesDr. David Alan Gilbert2018-02-251-0/+89
| | | | | | | | | We're going to need a: database of olm sessions a device trust database a database of megaolm sessions Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Parse key upload returnDr. David Alan Gilbert2018-02-251-1/+20
| | | | | | | Parse the key upload return to see if we need to send any one time keys. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Create and send one time keysDr. David Alan Gilbert2018-02-251-1/+119
| | | | Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: parse sync_key_counts to decide on key sendingDr David Alan Gilbert2018-02-251-0/+43
| | | | | | | | | | | | | | The server returns the count of one-time-keys that it has, we parse that and detect if we need to send more. It's a little tricky in that a server that doesn't have any keys will send an empty response, so force sending in that case. If we get to the point of multiple types of keys this will need reworking to make sure we only send the key types needed. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Retrieve or create Olm account state, send keysDr. David Alan Gilbert2018-02-251-0/+159
| | | | | | | | If we've got a previously stored olm account state then use it, else create us a new one. Either way, upload the device keys to the server. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: get_id_keysDr. David Alan Gilbert2018-02-251-0/+58
| | | | | | | | | | | | Parse the output of olm_account_identity_keys to get a list of algorithms and the keys for them. There really should be a better way; the algorithm names in here match what we need in the keys section, but we have to append the device id later, so it's a pain that it returns (undocumented) JSON. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: get_randomDr. David Alan Gilbert2018-02-251-0/+20
| | | | | | | Allocate a blob of memory and fill it with random data. (There must be some existing portable function for this?!) Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Restore OLM account state from Purple account dataDr. David Alan Gilbert2018-02-251-0/+77
| | | | Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Store OLM account state to the Purple Account dataDr. David Alan Gilbert2018-02-251-0/+51
| | | | | | | | | | | The OLM account state can be 'pickled'; we store this in Purple's account data store as a JSON string. Note; OLM lets us encrypt the pickle, but we've got no key to encrypt it with; I don't think Purple has anything for wiring into the system key store. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Add clear_memDr. David Alan Gilbert2018-02-251-0/+15
| | | | | | | We can't rely on having memset_s, so add our own equivalent that declares itself volatile. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Add matrix_sign_jsonDr. David Alan Gilbert2018-02-251-0/+46
| | | | | | | Given a JsonObject, produce a canonical json blob, sign it and add the signature back into the JsonObject. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Create MatrixE2EData type and matrix-e2e.[ch] filesDr. David Alan Gilbert2018-02-251-0/+34
Somewhere for the e2e magic to happen. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>