aboutsummaryrefslogtreecommitdiff
path: root/python/olm/session.py
diff options
context:
space:
mode:
authorJ08nY <johny@neuromancer.sk>2017-04-02 00:35:55 +0200
committerRichard van der Hoff <richard@matrix.org>2017-04-04 10:45:11 +0100
commit001dc1edaa4c5306fbb7c625202788458dadeafa (patch)
treeef9201b107d717c34b19f3fb9d4dca56d0fa32fe /python/olm/session.py
parentbb05b5687f12782cc2e87ffdf2dc0dfe0f6dcfb6 (diff)
Python: Switch to a more general os.urandom for randomness source
Signed-off-by: Jan Jancar <johny@neuromancer.sk>
Diffstat (limited to 'python/olm/session.py')
-rw-r--r--python/olm/session.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/olm/session.py b/python/olm/session.py
index 19d43d3..ff733b3 100644
--- a/python/olm/session.py
+++ b/python/olm/session.py
@@ -1,3 +1,5 @@
+from os import urandom
+
from ._base import *
@@ -103,7 +105,7 @@ class Session(object):
def create_outbound(self, account, identity_key, one_time_key):
r_length = lib.olm_create_outbound_session_random_length(self.ptr)
- random = read_random(r_length)
+ random = urandom(r_length)
random_buffer = create_string_buffer(random)
identity_key_buffer = create_string_buffer(identity_key)
one_time_key_buffer = create_string_buffer(one_time_key)
@@ -157,7 +159,7 @@ class Session(object):
def encrypt(self, plaintext):
r_length = lib.olm_encrypt_random_length(self.ptr)
- random = read_random(r_length)
+ random = urandom(r_length)
random_buffer = create_string_buffer(random)
message_type = lib.olm_encrypt_message_type(self.ptr)