We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 02560f8 commit 4857480Copy full SHA for 4857480
Signal/src/crypto/CryptoTools.m
@@ -6,13 +6,17 @@
6
#import "Conversions.h"
7
#import "EvpMessageDigest.h"
8
#import "EvpSymetricUtil.h"
9
+#import "SecurityFailure.h"
10
#import "Util.h"
11
12
@implementation CryptoTools
13
14
+(NSData*)generateSecureRandomData:(NSUInteger)length {
15
NSMutableData* d = [NSMutableData dataWithLength:length];
- SecRandomCopyBytes(kSecRandomDefault, length, [d mutableBytes]);
16
+ int err = SecRandomCopyBytes(kSecRandomDefault, length, [d mutableBytes]);
17
+ if (err != 0) {
18
+ [SecurityFailure raise:@"SecRandomCopyBytes failed"];
19
+ }
20
return d;
21
}
22
0 commit comments