aboutsummaryrefslogtreecommitdiff
path: root/xcode/OLMKit
diff options
context:
space:
mode:
authormanuroe <manu@matrix.org>2018-10-17 11:21:08 +0200
committermanuroe <manu@matrix.org>2018-10-17 11:25:20 +0200
commit90bbdec8ad85dc3cc272ee5c6caa3d901cccb14a (patch)
treeaae0158e5823cfd0f161004b55eea473a2a30fa3 /xcode/OLMKit
parent2ea2bc8ebcaf6ee0d89dca8bca423cf742b5acd4 (diff)
OLMKit: Zero only critical buffers out
Diffstat (limited to 'xcode/OLMKit')
-rw-r--r--xcode/OLMKit/OLMPkDecryption.m8
1 files changed, 4 insertions, 4 deletions
diff --git a/xcode/OLMKit/OLMPkDecryption.m b/xcode/OLMKit/OLMPkDecryption.m
index 38a86a2..75fe5f2 100644
--- a/xcode/OLMKit/OLMPkDecryption.m
+++ b/xcode/OLMKit/OLMPkDecryption.m
@@ -69,8 +69,6 @@
}
NSString *publicKey = [[NSString alloc] initWithData:publicKeyData encoding:NSUTF8StringEncoding];
- [publicKeyData resetBytesInRange:NSMakeRange(0, publicKeyData.length)];
-
return publicKey;
}
@@ -90,6 +88,7 @@
size_t result = olm_pk_key_from_private(session,
publicKeyData.mutableBytes, publicKeyData.length,
random.mutableBytes, randomLength);
+ [random resetBytesInRange:NSMakeRange(0, randomLength)];
if (result == olm_error()) {
const char *olm_error = olm_pk_decryption_last_error(session);
NSLog(@"[OLMPkDecryption] generateKey: olm_pk_key_from_private error: %s", olm_error);
@@ -107,8 +106,6 @@
}
NSString *publicKey = [[NSString alloc] initWithData:publicKeyData encoding:NSUTF8StringEncoding];
- [publicKeyData resetBytesInRange:NSMakeRange(0, publicKeyData.length)];
-
return publicKey;
}
@@ -218,6 +215,7 @@
key.bytes, key.length,
pickle.mutableBytes, pickle.length,
ephemeralBuffer.mutableBytes, ephemeralLength);
+ [pickle resetBytesInRange:NSMakeRange(0, pickle.length)];
if (result == olm_error()) {
const char *olm_error = olm_pk_decryption_last_error(session);
NSString *errorString = [NSString stringWithUTF8String:olm_error];
@@ -248,6 +246,8 @@
}
NSString *pickleString = [[NSString alloc] initWithData:pickled encoding:NSUTF8StringEncoding];
+ [pickled resetBytesInRange:NSMakeRange(0, pickled.length)];
+
return pickleString;
}