Commit Graph

27 Commits (5d1b66c350ac017613982f904b896750766654de)

Author SHA1 Message Date
Richard van der Hoff 1ff64391ed Fix a buffer bounds check when decoding group messages
Fixes a segfault when a group message had exactly the length of the mac +
signature.

Also tweak skipping of unknown tags to avoid an extra trip around the loop.
2016-10-19 15:03:40 +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 fc4756ddf1 Fix up some names, and protobuf tags
Make names (of session_key and message_index) more consistent.

Use our own protobuf tags rather than trying to piggyback on the one-to-one
structure.
2016-05-24 13:40:21 +01:00
Richard van der Hoff 39ad75314b Implement decrypting inbound group messages
Includes creation of inbound sessions, etc
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
Mark Haines b1c5732fc8 Fix bug in bounds check when parsing 2016-05-23 19:37:58 +01:00
Richard van der Hoff 3965320a9c Remove logging functionality
Concerns have been raised that including logging functionality makes it harder
to audit the implementation to ensure that no secret information is leaked. We
are therefore removing it from the master branch.
2016-05-16 11:13:54 +01:00
Richard van der Hoff b3db0e6ee1 translate logging.cpp to C 2016-05-16 11:05:57 +01:00
Richard van der Hoff 11dbf2aab3 Fix a bunch of compiler warnings, and turn on warnings. 2016-04-26 18:10:13 +01:00
Richard van der Hoff 9848f84452 Add some logging to help understand what's going on 2016-04-26 17:55:26 +01:00
Mark Haines 159faa1e2b Make the internal functions static, remove some unused internal functions 2015-08-18 17:09:55 +01:00
Mark Haines 158f7ee891 Fix crash where the message length was shorter than the length of the mac 2015-08-07 19:33:48 +01:00
Mark Haines a4b2927884 Initialise the length fields of the reader struct in decode_message, even if the message is invalid, fixes a crash where the message was too short 2015-08-07 18:58:42 +01:00
Mark Haines 76ecd85c2c Fix a crash when decoding messages that are too short 2015-08-07 18:25:21 +01:00
Mark Haines 5291ec78b5 Send the public part of the one time key rather than passing an identifier 2015-07-08 14:53:25 +01:00
Matthew Hodgson 09d4125ff1 Rename axolotlpp as olm to avoid confusion with Axolotl-the-spec and Axolotl-the-OWS-libraries at moxie's request 2015-06-27 01:15:23 +02:00
Mark Haines 8bf32c3248 Fix bug encoding integers larger than 128 2015-06-23 17:47:48 +01:00
Mark Haines 10e7e8123d Add missing include, fix bug in handling unknown message fields 2015-06-23 15:15:18 +01:00
Mark Haines 39a0873309 This field isn't being used anywhere so don't bother including it in the messages 2015-06-23 10:03:41 +01:00
Mark Haines 6ecea67718 Implement the session key exchange 2015-06-12 14:09:41 +01:00
Mark Haines e44c82a7b4 Add encoder and decoder for PreKey messages 2015-06-11 15:57:45 +01:00
Mark Haines 816435a860 Move AES specific details behind a cipher interface 2015-06-11 14:20:35 +01:00
Mark Haines d142eb64dd Copyright notices and a license 2015-02-26 16:56:25 +00:00
Mark Haines a4e5bf9772 Don't bother passing through the mac_length, the caller already knows it since they supplied it 2015-02-25 17:33:00 +00:00
Mark Haines ba446e7a12 Add a message encoder/decoder 2015-02-25 11:20:12 +00:00