aboutsummaryrefslogtreecommitdiff
path: root/xcode/OLMKit/OLMSession.m
diff options
context:
space:
mode:
authormanuroe <manu@matrix.org>2016-12-19 18:10:37 +0100
committermanuroe <manu@matrix.org>2016-12-19 18:10:37 +0100
commit3540926b98813e5e5daed709f820f06f6f9ac2ae (patch)
treeebdbbee5946d166159c12546bea3f233233c2412 /xcode/OLMKit/OLMSession.m
parentaa12cbcac2d9f380847644febdf1f13f102cebb1 (diff)
OLMKit: Reset intermediate buffers to zeroes
Diffstat (limited to 'xcode/OLMKit/OLMSession.m')
-rw-r--r--xcode/OLMKit/OLMSession.m2
1 files changed, 2 insertions, 0 deletions
diff --git a/xcode/OLMKit/OLMSession.m b/xcode/OLMKit/OLMSession.m
index 7cbd358..2111c1c 100644
--- a/xcode/OLMKit/OLMSession.m
+++ b/xcode/OLMKit/OLMSession.m
@@ -78,6 +78,7 @@
NSData *idKey = [theirIdentityKey dataUsingEncoding:NSUTF8StringEncoding];
NSData *otKey = [theirOneTimeKey dataUsingEncoding:NSUTF8StringEncoding];
size_t result = olm_create_outbound_session(_session, account.account, idKey.bytes, idKey.length, otKey.bytes, otKey.length, random.mutableBytes, random.length);
+ [random resetBytesInRange:NSMakeRange(0, random.length)];
if (result == olm_error()) {
const char *olm_error = olm_session_last_error(_session);
@@ -215,6 +216,7 @@
return nil;
}
size_t result = olm_encrypt(_session, plaintextData.bytes, plaintextData.length, random.mutableBytes, random.length, ciphertext.mutableBytes, ciphertext.length);
+ [random resetBytesInRange:NSMakeRange(0, random.length)];
if (result == olm_error()) {
const char *olm_error = olm_session_last_error(_session);