@@ -117,10 +117,11 @@ state[7] += new[7]; } @implementation OFSHA224Or256Hash @synthesize calculated = _calculated; +@synthesize allowsSwappableMemory = _allowsSwappableMemory; + (size_t)digestSize { OF_UNRECOGNIZED_SELECTOR } @@ -128,23 +129,26 @@ + (size_t)blockSize { return BLOCK_SIZE; } -+ (instancetype)cryptoHash ++ (instancetype)cryptoHashWithAllowsSwappableMemory: (bool)allowsSwappableMemory { - return [[[self alloc] init] autorelease]; + return [[[self alloc] initWithAllowsSwappableMemory: + allowsSwappableMemory] autorelease]; } -- (instancetype)init +- (instancetype)initWithAllowsSwappableMemory: (bool)allowsSwappableMemory { self = [super init]; @try { _iVarsData = [[OFSecureData alloc] - initWithCount: sizeof(*_iVars)]; + initWithCount: sizeof(*_iVars) + allowsSwappableMemory: allowsSwappableMemory]; _iVars = _iVarsData.mutableItems; + _allowsSwappableMemory = allowsSwappableMemory; if (self.class == [OFSHA224Or256Hash class]) { [self doesNotRecognizeSelector: _cmd]; abort(); } @@ -155,10 +159,15 @@ @throw e; } return self; } + +- (instancetype)init +{ + OF_INVALID_INIT_METHOD +} - (instancetype)of_init { return [super init]; } @@ -184,10 +193,11 @@ { OFSHA224Or256Hash *copy = [[[self class] alloc] of_init]; copy->_iVarsData = [_iVarsData copy]; copy->_iVars = copy->_iVarsData.mutableItems; + copy->_allowsSwappableMemory = _allowsSwappableMemory; copy->_calculated = _calculated; return copy; }