aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rwxr-xr-xpython/olm/__main__.py2
-rw-r--r--python/olm/_base.py2
-rw-r--r--python/olm/account.py1
-rw-r--r--python/olm/inbound_group_session.py8
-rw-r--r--python/olm/session.py1
5 files changed, 10 insertions, 4 deletions
diff --git a/python/olm/__main__.py b/python/olm/__main__.py
index cf9158d..eb76301 100755
--- a/python/olm/__main__.py
+++ b/python/olm/__main__.py
@@ -328,7 +328,7 @@ def do_group_decrypt(args):
session = InboundGroupSession()
session.unpickle(args.key, read_base64_file(args.session_file))
message = args.message_file.read()
- plaintext = session.decrypt(message)
+ plaintext, message_index = session.decrypt(message)
with open(args.session_file, "wb") as f:
f.write(session.pickle(args.key))
args.plaintext_file.write(plaintext)
diff --git a/python/olm/_base.py b/python/olm/_base.py
index bc5c206..80720d9 100644
--- a/python/olm/_base.py
+++ b/python/olm/_base.py
@@ -7,7 +7,7 @@ def read_random(n):
return f.read(n)
lib = cdll.LoadLibrary(os.path.join(
- os.path.dirname(__file__), "..", "..", "build", "libolm.so.1")
+ os.path.dirname(__file__), "..", "..", "build", "libolm.so.2")
)
lib.olm_error.argtypes = []
diff --git a/python/olm/account.py b/python/olm/account.py
index 7673329..3fa1049 100644
--- a/python/olm/account.py
+++ b/python/olm/account.py
@@ -41,6 +41,7 @@ account_function(lib.olm_account_one_time_keys_length)
account_function(lib.olm_account_one_time_keys, c_void_p, c_size_t)
account_function(lib.olm_account_mark_keys_as_published)
account_function(lib.olm_account_max_number_of_one_time_keys)
+account_function(lib.olm_pickle_account_length)
account_function(
lib.olm_account_generate_one_time_keys_random_length,
c_size_t
diff --git a/python/olm/inbound_group_session.py b/python/olm/inbound_group_session.py
index d5547fd..27a569c 100644
--- a/python/olm/inbound_group_session.py
+++ b/python/olm/inbound_group_session.py
@@ -43,6 +43,7 @@ inbound_group_session_function(
lib.olm_group_decrypt,
c_void_p, c_size_t, # message
c_void_p, c_size_t, # plaintext
+ POINTER(c_uint32), # message_index
)
inbound_group_session_function(lib.olm_inbound_group_session_id_length)
@@ -82,11 +83,14 @@ class InboundGroupSession(object):
)
plaintext_buffer = create_string_buffer(max_plaintext_length)
message_buffer = create_string_buffer(message)
+
+ message_index = c_uint32()
plaintext_length = lib.olm_group_decrypt(
self.ptr, message_buffer, len(message),
- plaintext_buffer, max_plaintext_length
+ plaintext_buffer, max_plaintext_length,
+ byref(message_index)
)
- return plaintext_buffer.raw[:plaintext_length]
+ return plaintext_buffer.raw[:plaintext_length], message_index
def session_id(self):
id_length = lib.olm_inbound_group_session_id_length(self.ptr)
diff --git a/python/olm/session.py b/python/olm/session.py
index 308f220..19d43d3 100644
--- a/python/olm/session.py
+++ b/python/olm/session.py
@@ -58,6 +58,7 @@ session_function(
c_void_p, c_size_t, # Identity Key
c_void_p, c_size_t, # Pre Key Message
)
+session_function(lib.olm_pickle_session_length)
session_function(lib.olm_encrypt_message_type)
session_function(lib.olm_encrypt_random_length)
session_function(lib.olm_encrypt_message_length, c_size_t)