@@ -29,16 +29,20 @@ #import "pbkdf2.h" void of_pbkdf2(OFHMAC *HMAC, size_t iterations, const unsigned char *salt, size_t saltLength, const char *password, size_t passwordLength, - unsigned char *key, size_t keyLength) + unsigned char *key, size_t keyLength, bool allowsSwappableMemory) { void *pool = objc_autoreleasePoolPush(); size_t blocks, digestSize = HMAC.digestSize; - OFSecureData *buffer = [OFSecureData dataWithCount: digestSize]; - OFSecureData *digest = [OFSecureData dataWithCount: digestSize]; + OFSecureData *buffer = [OFSecureData + dataWithCount: digestSize + allowsSwappableMemory: allowsSwappableMemory]; + OFSecureData *digest = [OFSecureData + dataWithCount: digestSize + allowsSwappableMemory: allowsSwappableMemory]; unsigned char *bufferItems = buffer.mutableItems; unsigned char *digestItems = digest.mutableItems; OFSecureData *extendedSalt; unsigned char *extendedSaltItems; @@ -51,11 +55,12 @@ blocks++; if (saltLength > SIZE_MAX - 4 || blocks > UINT32_MAX) @throw [OFOutOfRangeException exception]; - extendedSalt = [OFSecureData dataWithCount: saltLength + 4]; + extendedSalt = [OFSecureData dataWithCount: saltLength + 4 + allowsSwappableMemory: allowsSwappableMemory]; extendedSaltItems = extendedSalt.mutableItems; @try { uint32_t i = OF_BSWAP32_IF_LE(1);