From a628ef41bd5b860b89a3e2e29df56a461e85fa00 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 13 Sep 2016 17:41:55 +0100 Subject: [PATCH] Remove the messsage index from olm_init_inbound_group_session since it is read from the session_key --- include/olm/inbound_group_session.h | 2 -- javascript/olm_inbound_group_session.js | 4 ++-- python/olm/inbound_group_session.py | 6 +++--- src/inbound_group_session.c | 1 - tests/test_group_session.cpp | 4 ++-- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/olm/inbound_group_session.h b/include/olm/inbound_group_session.h index 49992b2..4798f27 100644 --- a/include/olm/inbound_group_session.h +++ b/include/olm/inbound_group_session.h @@ -95,8 +95,6 @@ size_t olm_unpickle_inbound_group_session( */ size_t olm_init_inbound_group_session( OlmInboundGroupSession *session, - uint32_t message_index, - /* base64-encoded keys */ uint8_t const * session_key, size_t session_key_length ); diff --git a/javascript/olm_inbound_group_session.js b/javascript/olm_inbound_group_session.js index 9722c31..7e07b01 100644 --- a/javascript/olm_inbound_group_session.js +++ b/javascript/olm_inbound_group_session.js @@ -52,12 +52,12 @@ InboundGroupSession.prototype['unpickle'] = restore_stack(function(key, pickle) ); }); -InboundGroupSession.prototype['create'] = restore_stack(function(message_index, session_key) { +InboundGroupSession.prototype['create'] = restore_stack(function(session_key) { var key_array = array_from_string(session_key); var key_buffer = stack(key_array); inbound_group_session_method(Module['_olm_init_inbound_group_session'])( - this.ptr, message_index, key_buffer, key_array.length + this.ptr, key_buffer, key_array.length ); }); diff --git a/python/olm/inbound_group_session.py b/python/olm/inbound_group_session.py index 6c01095..eb0422f 100644 --- a/python/olm/inbound_group_session.py +++ b/python/olm/inbound_group_session.py @@ -33,7 +33,7 @@ inbound_group_session_function( ) inbound_group_session_function( - lib.olm_init_inbound_group_session, c_uint32, c_void_p, c_size_t + lib.olm_init_inbound_group_session, c_void_p, c_size_t ) inbound_group_session_function( @@ -66,10 +66,10 @@ class InboundGroupSession(object): self.ptr, key_buffer, len(key), pickle_buffer, len(pickle) ) - def init(self, message_index, session_key): + def init(self, session_key): key_buffer = create_string_buffer(session_key) lib.olm_init_inbound_group_session( - self.ptr, message_index, key_buffer, len(session_key) + self.ptr, key_buffer, len(session_key) ) def decrypt(self, message): diff --git a/src/inbound_group_session.c b/src/inbound_group_session.c index 82ff66f..b42ca86 100644 --- a/src/inbound_group_session.c +++ b/src/inbound_group_session.c @@ -113,7 +113,6 @@ static size_t _init_group_session_keys( size_t olm_init_inbound_group_session( OlmInboundGroupSession *session, - uint32_t message_index, const uint8_t * session_key, size_t session_key_length ) { uint8_t key_buf[SESSION_KEY_RAW_LENGTH]; diff --git a/tests/test_group_session.cpp b/tests/test_group_session.cpp index ce889ad..3e11169 100644 --- a/tests/test_group_session.cpp +++ b/tests/test_group_session.cpp @@ -130,7 +130,7 @@ int main() { olm_inbound_group_session(inbound_session_memory); res = olm_init_inbound_group_session( - inbound_session, 0U, session_key, session_key_len); + inbound_session, session_key, session_key_len); assert_equals((size_t)0, res); /* decode the message */ @@ -172,7 +172,7 @@ int main() { olm_inbound_group_session(inbound_session_memory); size_t res = olm_init_inbound_group_session( - inbound_session, 0U, session_key, sizeof(session_key)-1 + inbound_session, session_key, sizeof(session_key)-1 ); assert_equals((size_t)0, res);