diff options
author | Richard van der Hoff <richard@matrix.org> | 2016-05-25 15:16:14 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2016-05-25 17:42:32 +0100 |
commit | 708fddd747789a101123b09b67c064b119db8873 (patch) | |
tree | 1410d780a7dfa417478f27952da8ef0e9ceffa5c /src/message.cpp | |
parent | ee8172d882e853e737ac7e8b00fb760f21e80bfe (diff) |
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.
Diffstat (limited to 'src/message.cpp')
-rw-r--r-- | src/message.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/message.cpp b/src/message.cpp index 2e841e5..ad26cb9 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -328,18 +328,15 @@ void olm::decode_one_time_key_message( -static const std::uint8_t GROUP_SESSION_ID_TAG = 012; -static const std::uint8_t GROUP_MESSAGE_INDEX_TAG = 020; -static const std::uint8_t GROUP_CIPHERTEXT_TAG = 032; +static const std::uint8_t GROUP_MESSAGE_INDEX_TAG = 010; +static const std::uint8_t GROUP_CIPHERTEXT_TAG = 022; size_t _olm_encode_group_message_length( - size_t group_session_id_length, uint32_t message_index, size_t ciphertext_length, size_t mac_length ) { size_t length = VERSION_LENGTH; - length += 1 + varstring_length(group_session_id_length); length += 1 + varint_length(message_index); length += 1 + varstring_length(ciphertext_length); length += mac_length; @@ -349,19 +346,14 @@ size_t _olm_encode_group_message_length( size_t _olm_encode_group_message( uint8_t version, - const uint8_t *session_id, - size_t session_id_length, uint32_t message_index, size_t ciphertext_length, uint8_t *output, uint8_t **ciphertext_ptr ) { std::uint8_t * pos = output; - std::uint8_t * session_id_pos; *(pos++) = version; - pos = encode(pos, GROUP_SESSION_ID_TAG, session_id_pos, session_id_length); - std::memcpy(session_id_pos, session_id, session_id_length); pos = encode(pos, GROUP_MESSAGE_INDEX_TAG, message_index); pos = encode(pos, GROUP_CIPHERTEXT_TAG, *ciphertext_ptr, ciphertext_length); return pos-output; @@ -376,8 +368,6 @@ void _olm_decode_group_message( std::uint8_t const * end = input + input_length - mac_length; std::uint8_t const * unknown = nullptr; - results->session_id = nullptr; - results->session_id_length = 0; bool has_message_index = false; results->message_index = 0; results->ciphertext = nullptr; @@ -389,10 +379,6 @@ void _olm_decode_group_message( while (pos != end) { pos = decode( - pos, end, GROUP_SESSION_ID_TAG, - results->session_id, results->session_id_length - ); - pos = decode( pos, end, GROUP_MESSAGE_INDEX_TAG, results->message_index, has_message_index ); |