@@ -17,11 +17,11 @@ #include #import "TestsAppDelegate.h" -static OFString *module = @"scrypt"; +static OFString *const module = @"OFScrypt"; /* Test vectors form RFC 7914 */ static const unsigned char salsa20Input[64] = { 0x7E, 0x87, 0x9A, 0x21, 0x4F, 0x3E, 0xC9, 0x86, 0x7C, 0xA9, 0x40, 0xE6, 0x41, 0x71, 0x8F, 0x26, 0xBA, 0xEE, 0x55, 0x5B, 0x8C, 0x61, 0xC1, 0xB5, 0x0D, 0xF8, 0x46, 0x11, 0x6D, 0xCD, 0x3B, 0x1D, 0xEE, 0x24, 0xF3, 0x19, @@ -128,11 +128,11 @@ 0x37, 0x30, 0x40, 0x49, 0xE8, 0xA9, 0x52, 0xFB, 0xCB, 0xF4, 0x5C, 0x6F, 0xA7, 0x7A, 0x41, 0xA4 }; #endif -@implementation TestsAppDelegate (ScryptTests) +@implementation TestsAppDelegate (OFScryptTests) - (void)scryptTests { void *pool = objc_autoreleasePoolPush(); uint32_t salsa20Buffer[16]; uint32_t blockMixBuffer[32]; @@ -139,24 +139,24 @@ uint32_t ROMixBuffer[32], ROMixTmp[17 * 32]; unsigned char output[64]; TEST(@"Salsa20/8 Core", R(memcpy(salsa20Buffer, salsa20Input, 64)) && - R(of_salsa20_8_core(salsa20Buffer)) && + R(OFSalsa20_8Core(salsa20Buffer)) && memcmp(salsa20Buffer, salsa20Output, 64) == 0) TEST(@"Block mix", - R(of_scrypt_block_mix(blockMixBuffer, blockMixInput.u32, 1)) && + R(OFScryptBlockMix(blockMixBuffer, blockMixInput.u32, 1)) && memcmp(blockMixBuffer, blockMixOutput, 128) == 0) TEST(@"ROMix", R(memcpy(ROMixBuffer, ROMixInput, 128)) && - R(of_scrypt_romix(ROMixBuffer, 1, 16, ROMixTmp)) && + R(OFScryptROMix(ROMixBuffer, 1, 16, ROMixTmp)) && memcmp(ROMixBuffer, ROMixOutput, 128) == 0) TEST(@"scrypt test vector #1", - R(of_scrypt((of_scrypt_parameters_t){ + R(OFScrypt((OFScryptParameters){ .blockSize = 1, .costFactor = 16, .parallelization = 1, .salt = (unsigned char *)"", .saltLength = 0, @@ -166,11 +166,11 @@ .keyLength = 64, .allowsSwappableMemory = true })) && memcmp(output, testVector1, 64) == 0) TEST(@"scrypt test vector #2", - R(of_scrypt((of_scrypt_parameters_t){ + R(OFScrypt((OFScryptParameters){ .blockSize = 8, .costFactor = 1024, .parallelization = 16, .salt = (unsigned char *)"NaCl", .saltLength = 4, @@ -180,11 +180,11 @@ .keyLength = 64, .allowsSwappableMemory = true })) && memcmp(output, testVector2, 64) == 0) TEST(@"scrypt test vector #3", - R(of_scrypt((of_scrypt_parameters_t){ + R(OFScrypt((OFScryptParameters){ .blockSize = 8, .costFactor = 16384, .parallelization = 1, .salt = (unsigned char *)"SodiumChloride", .saltLength = 14, @@ -196,11 +196,11 @@ })) && memcmp(output, testVector3, 64) == 0) /* The forth test vector is too expensive to include it in the tests. */ #if 0 TEST(@"scrypt test vector #4", - R(of_scrypt((of_scrypt_parameters_t){ + R(OFScrypt((OFScryptParameters){ .blockSize = 8, .costFactor = 1048576, .parallelization = 1, .salt = (unsigned char *)"SodiumChloride", .saltLength = 14,