Commit Graph

12 Commits (5d1b66c350ac017613982f904b896750766654de)

Author SHA1 Message Date
Richard van der Hoff 21ce3491dd Clear random buf in olm_init_outbound_group_session
All the other methods clear their random inputs. This one needs to do the same,
to reduce the risk of the randomness being used elsewhere and leaking key info.
2016-10-21 17:19:59 +01:00
Mark Haines a89a169c89 ``if`` is not the same as ``for`` 2016-09-13 17:00:54 +01:00
Mark Haines 5926a8fd29 Comment on the encoding of the message counter. 2016-09-13 16:45:54 +01:00
Mark Haines d62e344db7 Use the ed22519 public key as the group session id.
Some clients expect the session id to be globally unique,
so allowing the end devices to pick the session id will cause
problems.

Include the current ratchet index with the initial keys, this decreases
the risk that the client will supply the wrong index causing problems.

Sign the initial keys with the ratchet ed25519 key, this reduces the
risk of a client claiming a session that they didn't create.
2016-09-13 15:42:47 +01:00
Richard van der Hoff 2fc83aa9ac Sign megolm messages
Add ed25519 keys to the inbound and outbound sessions, and use them to sign and
verify megolm messages.

We just stuff the ed25519 public key in alongside the megolm session key (and
add a version byte), to save adding more boilerplate to the JS/python/etc
layers.
2016-09-06 15:26:26 +01:00
Richard van der Hoff 708fddd747 Remove session_id from group messages
Putting the session_id inside the packed message body makes it hard to extract
so that we can decide which session to use. We don't think there is any
advantage to having thes sesion_id protected by the HMACs, so we're going to
move it to the JSON framing.
2016-05-25 17:42:32 +01:00
Richard van der Hoff 1b15465c42 Separate base64ing from the rest of msg encoding
Factor the actual message encoding/decoding and encrypting/decrypting out to
separate functions from the top-level functions which do the base64-wrangling.

This is particularly helpful in the 'outbound' code-path where the offsets
required to allow room to base64-encode make the flow hard to see when it's all inline.
2016-05-24 16:23:19 +01:00
Richard van der Hoff a919a149fb Update megolm_cipher as a global struct
Initialise megolm_cipher via the preprocessor macro, instead of with a
function.
2016-05-24 14:54:01 +01:00
Richard van der Hoff fa1e9446ac Use _olm_unset instead of memset
memset is at risk of being optimised away, so use _olm_unset instead.
2016-05-24 13:40:21 +01:00
Richard van der Hoff 8b1514c0a6 Implement functions to get the state of outbound session
We need to be able to inspect an outbound session so that we can tell our peer
how to set up an inbound session.
2016-05-24 13:39:34 +01:00
Richard van der Hoff c058554132 Implement pickling/unpickling for outbound group sessions 2016-05-24 13:39:34 +01:00
Richard van der Hoff caaed796ad Implementation of an outbound group session 2016-05-24 13:39:34 +01:00