mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Update Cocoapods.
This commit is contained in:
parent
9b94580dae
commit
b00858921d
2 changed files with 2 additions and 24 deletions
|
@ -2,15 +2,12 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <AxolotlKit/NSData+SPK.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSData (OWS)
|
||||
|
||||
/**
|
||||
* Compares data in constant time so as to help avoid potential timing attacks.
|
||||
*/
|
||||
- (BOOL)ows_constantTimeIsEqualToData:(NSData *)other;
|
||||
|
||||
- (NSData *)dataByAppendingData:(NSData *)data;
|
||||
|
||||
- (NSString *)hexadecimalString;
|
||||
|
|
|
@ -8,25 +8,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
@implementation NSData (OWS)
|
||||
|
||||
- (BOOL)ows_constantTimeIsEqualToData:(NSData *)other
|
||||
{
|
||||
volatile UInt8 isEqual = 0;
|
||||
|
||||
if (self.length != other.length) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
UInt8 *leftBytes = (UInt8 *)self.bytes;
|
||||
UInt8 *rightBytes = (UInt8 *)other.bytes;
|
||||
for (int i = 0; i < self.length; i++) {
|
||||
// rather than returning as soon as we find a discrepency, we compare the rest of
|
||||
// the byte stream to maintain a constant time comparison
|
||||
isEqual |= leftBytes[i] ^ rightBytes[i];
|
||||
}
|
||||
|
||||
return isEqual == 0;
|
||||
}
|
||||
|
||||
- (NSData *)dataByAppendingData:(NSData *)data
|
||||
{
|
||||
NSMutableData *result = [self mutableCopy];
|
||||
|
|
Loading…
Reference in a new issue