diff --git a/xcode/OLMKit/OLMAccount.m b/xcode/OLMKit/OLMAccount.m
index 2f30fb673ea5c0498c3eee599a4ff7a4c7a01a9c..af1e30849d0ac2328a4ba1c3ec06dd8c7cf55233 100644
--- a/xcode/OLMKit/OLMAccount.m
+++ b/xcode/OLMKit/OLMAccount.m
@@ -66,6 +66,7 @@
     size_t randomLength = olm_create_account_random_length(_account);
     NSMutableData *random = [OLMUtility randomBytesOfLength:randomLength];
     size_t accountResult = olm_create_account(_account, random.mutableBytes, random.length);
+    [random resetBytesInRange:NSMakeRange(0, random.length)];
     if (accountResult == olm_error()) {
         const char *error = olm_account_last_error(_account);
         NSLog(@"error creating account: %s", error);
@@ -147,6 +148,7 @@
     size_t randomLength = olm_account_generate_one_time_keys_random_length(_account, numberOfKeys);
     NSMutableData *random = [OLMUtility randomBytesOfLength:randomLength];
     size_t result = olm_account_generate_one_time_keys(_account, numberOfKeys, random.mutableBytes, random.length);
+    [random resetBytesInRange:NSMakeRange(0, random.length)];
     if (result == olm_error()) {
         const char *error = olm_account_last_error(_account);
         NSLog(@"error generating keys: %s", error);
diff --git a/xcode/OLMKit/OLMOutboundGroupSession.m b/xcode/OLMKit/OLMOutboundGroupSession.m
index d838ebcb6eec0caf502b0825e87a3ee6a4caf9d3..a3421fd73bf8d3586e0ebd93e2eae371679d4036 100644
--- a/xcode/OLMKit/OLMOutboundGroupSession.m
+++ b/xcode/OLMKit/OLMOutboundGroupSession.m
@@ -55,6 +55,7 @@
         NSMutableData *random = [OLMUtility randomBytesOfLength:olm_init_outbound_group_session_random_length(session)];
 
         size_t result = olm_init_outbound_group_session(session, random.mutableBytes, random.length);
+        [random resetBytesInRange:NSMakeRange(0, random.length)];
         if (result == olm_error())   {
             const char *error = olm_outbound_group_session_last_error(session);
             NSLog(@"olm_init_outbound_group_session error: %s", error);
@@ -97,6 +98,7 @@
         return nil;
     }
     NSString *sessionKey = [[NSString alloc] initWithData:sessionKeyData encoding:NSUTF8StringEncoding];
+    [sessionKeyData resetBytesInRange:NSMakeRange(0, sessionKeyData.length)];
     return sessionKey;
 }
 
diff --git a/xcode/OLMKit/OLMSession.m b/xcode/OLMKit/OLMSession.m
index 7cbd358060924d5c4eefa86ac88329c2ecf3ac69..2111c1c443f9f3de5e3210ea518077e5a2e495dc 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);