From 36aeb1617161f47c2c5b3cee98a5b5e20b1a1ffe Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Thu, 16 Jun 2016 01:15:07 -0400 Subject: [PATCH] =?UTF-8?q?Cleared=20"warning:=20unused=20variable=20?= =?UTF-8?q?=E2=80=98hasPadlockRNG=E2=80=99".=20Whitespace=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- validat1.cpp | 69 ++++++++++++++++++++++++++-------------------------- validat2.cpp | 40 +++++++++++++++--------------- validat3.cpp | 34 +++++++++++++------------- 3 files changed, 71 insertions(+), 72 deletions(-) diff --git a/validat1.cpp b/validat1.cpp index 9e9c2195..a6115e5e 100644 --- a/validat1.cpp +++ b/validat1.cpp @@ -76,7 +76,7 @@ bool ValidateAll(bool thorough) pass=TestOS_RNG() && pass; pass=TestAutoSeeded() && pass; pass=TestAutoSeededX917() && pass; - + #if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64) pass=TestRDRAND() && pass; pass=TestRDSEED() && pass; @@ -299,7 +299,6 @@ bool TestSettings() bool hasSSSE3 = HasSSSE3(); bool hasSSE4 = HasSSE4(); bool isP4 = IsP4(); - bool hasPadlockRNG = HasPadlockRNG(); int cacheLineSize = GetCacheLineSize(); if ((isP4 && (!hasMMX || !hasSSE2)) || (hasSSE2 && !hasMMX) || (cacheLineSize < 16 || cacheLineSize > 256 || !IsPowerOf2(cacheLineSize))) @@ -339,9 +338,9 @@ bool TestSecBlock() cout << "\nTesting SecBlock...\n\n"; bool result = true, temp = true; - + //********** Zeroized block **********// - + // NULL ptr with a size means to create a new SecBloc with all elements zero'd SecByteBlock z1(NULL, 256); temp = true; @@ -902,7 +901,7 @@ bool TestOS_RNG() MeterFilter meter(new Redirector(TheBitBucket())); RandomNumberSource test(*rng, 100000, true, new Deflator(new Redirector(meter))); - + if (meter.GetTotalBytes() < 100000) { cout << "FAILED:"; @@ -929,7 +928,7 @@ bool TestAutoSeededX917() } #else bool TestAutoSeeded() -{ +{ // This tests Auto-Seeding and GenerateIntoBufferedTransformation. cout << "\nTesting AutoSeeded generator...\n\n"; @@ -939,7 +938,7 @@ bool TestAutoSeeded() MeterFilter meter(new Redirector(TheBitBucket())); RandomNumberSource test(prng, 100000, true, new Deflator(new Redirector(meter))); - + if (meter.GetTotalBytes() < 100000) { cout << "FAILED:"; @@ -948,7 +947,7 @@ bool TestAutoSeeded() else cout << "passed:"; cout << " 100000 generated bytes compressed to " << meter.GetTotalBytes() << " bytes by DEFLATE" << endl; - + try { prng.DiscardBytes(100000); @@ -957,7 +956,7 @@ bool TestAutoSeeded() { discard = false; } - + if (!discard) cout << "FAILED:"; else @@ -989,7 +988,7 @@ bool TestAutoSeeded() cout << "passed:"; cout << " IncorporateEntropy with " << 4*ENTROPY_SIZE << " bytes" << endl; - return generate && discard && incorporate; + return generate && discard && incorporate; } bool TestAutoSeededX917() @@ -1053,7 +1052,7 @@ bool TestAutoSeededX917() cout << "passed:"; cout << " IncorporateEntropy with " << 4*ENTROPY_SIZE << " bytes" << endl; - return generate && discard && incorporate; + return generate && discard && incorporate; } #endif // NO_OS_DEPENDENCE @@ -1370,7 +1369,7 @@ bool TestModeIV(SymmetricCipher &e, SymmetricCipher &d) { SecByteBlock lastIV, iv(e.IVSize()); StreamTransformationFilter filter(e, new StreamTransformationFilter(d)); - + // vector_ptr due to Enterprise Analysis finding on the stack based array. vector_ptr plaintext(20480); @@ -1420,7 +1419,7 @@ bool ValidateCipherModes() plain, sizeof(plain), encrypted, sizeof(encrypted)); pass = pass && !fail; cout << (fail ? "FAILED " : "passed ") << "ECB encryption" << endl; - + ECB_Mode_ExternalCipher::Decryption modeD(desD); fail = !TestFilter(StreamTransformationFilter(modeD, NULL, StreamTransformationFilter::NO_PADDING).Ref(), encrypted, sizeof(encrypted), plain, sizeof(plain)); @@ -1430,8 +1429,8 @@ bool ValidateCipherModes() { // from FIPS 81 const byte encrypted[] = { - 0xE5, 0xC7, 0xCD, 0xDE, 0x87, 0x2B, 0xF2, 0x7C, - 0x43, 0xE9, 0x34, 0x00, 0x8C, 0x38, 0x9C, 0x0F, + 0xE5, 0xC7, 0xCD, 0xDE, 0x87, 0x2B, 0xF2, 0x7C, + 0x43, 0xE9, 0x34, 0x00, 0x8C, 0x38, 0x9C, 0x0F, 0x68, 0x37, 0x88, 0x49, 0x9A, 0x7C, 0x05, 0xF6}; CBC_Mode_ExternalCipher::Encryption modeE(desE, iv); @@ -1439,7 +1438,7 @@ bool ValidateCipherModes() plain, sizeof(plain), encrypted, sizeof(encrypted)); pass = pass && !fail; cout << (fail ? "FAILED " : "passed ") << "CBC encryption with no padding" << endl; - + CBC_Mode_ExternalCipher::Decryption modeD(desD, iv); fail = !TestFilter(StreamTransformationFilter(modeD, NULL, StreamTransformationFilter::NO_PADDING).Ref(), encrypted, sizeof(encrypted), plain, sizeof(plain)); @@ -1454,9 +1453,9 @@ bool ValidateCipherModes() // generated with Crypto++, matches FIPS 81 // but has extra 8 bytes as result of padding const byte encrypted[] = { - 0xE5, 0xC7, 0xCD, 0xDE, 0x87, 0x2B, 0xF2, 0x7C, - 0x43, 0xE9, 0x34, 0x00, 0x8C, 0x38, 0x9C, 0x0F, - 0x68, 0x37, 0x88, 0x49, 0x9A, 0x7C, 0x05, 0xF6, + 0xE5, 0xC7, 0xCD, 0xDE, 0x87, 0x2B, 0xF2, 0x7C, + 0x43, 0xE9, 0x34, 0x00, 0x8C, 0x38, 0x9C, 0x0F, + 0x68, 0x37, 0x88, 0x49, 0x9A, 0x7C, 0x05, 0xF6, 0x62, 0xC1, 0x6A, 0x27, 0xE4, 0xFC, 0xF2, 0x77}; CBC_Mode_ExternalCipher::Encryption modeE(desE, iv); @@ -1464,7 +1463,7 @@ bool ValidateCipherModes() plain, sizeof(plain), encrypted, sizeof(encrypted)); pass = pass && !fail; cout << (fail ? "FAILED " : "passed ") << "CBC encryption with PKCS #7 padding" << endl; - + CBC_Mode_ExternalCipher::Decryption modeD(desD, iv); fail = !TestFilter(StreamTransformationFilter(modeD).Ref(), encrypted, sizeof(encrypted), plain, sizeof(plain)); @@ -1475,9 +1474,9 @@ bool ValidateCipherModes() // generated with Crypto++ 5.2, matches FIPS 81 // but has extra 8 bytes as result of padding const byte encrypted[] = { - 0xE5, 0xC7, 0xCD, 0xDE, 0x87, 0x2B, 0xF2, 0x7C, - 0x43, 0xE9, 0x34, 0x00, 0x8C, 0x38, 0x9C, 0x0F, - 0x68, 0x37, 0x88, 0x49, 0x9A, 0x7C, 0x05, 0xF6, + 0xE5, 0xC7, 0xCD, 0xDE, 0x87, 0x2B, 0xF2, 0x7C, + 0x43, 0xE9, 0x34, 0x00, 0x8C, 0x38, 0x9C, 0x0F, + 0x68, 0x37, 0x88, 0x49, 0x9A, 0x7C, 0x05, 0xF6, 0xcf, 0xb7, 0xc7, 0x64, 0x0e, 0x7c, 0xd9, 0xa7}; CBC_Mode_ExternalCipher::Encryption modeE(desE, iv); @@ -1514,8 +1513,8 @@ bool ValidateCipherModes() // generated with Crypto++, matches FIPS 81 // but with last two blocks swapped as result of CTS const byte encrypted[] = { - 0xE5, 0xC7, 0xCD, 0xDE, 0x87, 0x2B, 0xF2, 0x7C, - 0x68, 0x37, 0x88, 0x49, 0x9A, 0x7C, 0x05, 0xF6, + 0xE5, 0xC7, 0xCD, 0xDE, 0x87, 0x2B, 0xF2, 0x7C, + 0x68, 0x37, 0x88, 0x49, 0x9A, 0x7C, 0x05, 0xF6, 0x43, 0xE9, 0x34, 0x00, 0x8C, 0x38, 0x9C, 0x0F}; CBC_CTS_Mode_ExternalCipher::Encryption modeE(desE, iv); @@ -1523,7 +1522,7 @@ bool ValidateCipherModes() plain, sizeof(plain), encrypted, sizeof(encrypted)); pass = pass && !fail; cout << (fail ? "FAILED " : "passed ") << "CBC encryption with ciphertext stealing (CTS)" << endl; - + CBC_CTS_Mode_ExternalCipher::Decryption modeD(desD, iv); fail = !TestFilter(StreamTransformationFilter(modeD).Ref(), encrypted, sizeof(encrypted), plain, sizeof(plain)); @@ -1548,7 +1547,7 @@ bool ValidateCipherModes() fail = memcmp(stolenIV, decryptionIV, 8) != 0 || fail; pass = pass && !fail; cout << (fail ? "FAILED " : "passed ") << "CBC encryption with ciphertext and IV stealing" << endl; - + CBC_CTS_Mode_ExternalCipher::Decryption modeD(desD, stolenIV); fail = !TestFilter(StreamTransformationFilter(modeD).Ref(), encrypted, sizeof(encrypted), plain, 3); @@ -1623,8 +1622,8 @@ bool ValidateCipherModes() } { const byte encrypted[] = { // generated with Crypto++ - 0xF3, 0x09, 0x62, 0x49, 0xC7, 0xF4, 0x6E, 0x51, - 0x16, 0x3A, 0x8C, 0xA0, 0xFF, 0xC9, 0x4C, 0x27, + 0xF3, 0x09, 0x62, 0x49, 0xC7, 0xF4, 0x6E, 0x51, + 0x16, 0x3A, 0x8C, 0xA0, 0xFF, 0xC9, 0x4C, 0x27, 0xFA, 0x2F, 0x80, 0xF4, 0x80, 0xB8, 0x6F, 0x75}; CTR_Mode_ExternalCipher::Encryption modeE(desE, iv); @@ -1645,9 +1644,9 @@ bool ValidateCipherModes() } { const byte plain_3[] = { // "7654321 Now is the time for " - 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, - 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, + 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, + 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20}; const byte mac1[] = { // from FIPS 113 0xf1, 0xd3, 0x0f, 0x68, 0x49, 0x31, 0x2c, 0xa4}; @@ -2127,7 +2126,7 @@ bool ValidateBaseCode() byte data[255]; for (unsigned int i=0; i<255; i++) data[i] = byte(i); - static const char hexEncoded[] = + static const char hexEncoded[] = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324252627" "28292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F" "505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F7071727374757677" @@ -2135,14 +2134,14 @@ bool ValidateBaseCode() "A0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7" "C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF" "F0F1F2F3F4F5F6F7F8F9FAFBFCFDFE"; - static const char base32Encoded[] = + static const char base32Encoded[] = "AAASEA2EAWDAQCAJBIFS2DIQB6IBCESVCSKTNF22DEPBYHA7D2RUAIJCENUCKJTHFAWUWK3NFWZC8NBT" "GI3VIPJYG66DUQT5HS8V6R4AIFBEGTCFI3DWSUKKJPGE4VURKBIXEW4WKXMFQYC3MJPX2ZK8M7SGC2VD" "NTUYN35IPFXGY5DPP3ZZA6MUQP4HK7VZRB6ZW856RX9H9AEBSKB2JBNGS8EIVCWMTUG27D6SUGJJHFEX" "U4M3TGN4VQQJ5HW9WCS4FI7EWYVKRKFJXKX43MPQX82MDNXVYU45PP72ZG7MZRF7Z496BSQC2RCNMTYH" "3DE6XU8N3ZHN9WGT4MJ7JXQY49NPVYY55VQ77Z9A6HTQH3HF65V8T4RK7RYQ55ZR8D29F69W8Z5RR8H3" "9M7939R8"; - const char *base64AndHexEncoded = + const char *base64AndHexEncoded = "41414543417751464267634943516F4C4441304F4478415245684D554652595847426B6147787764" "486838674953496A4A43556D4A7967704B6973734C5334764D4445794D7A51310A4E6A63344F546F" "375044302B50304242516B4E4552555A4853456C4B5330784E546B395155564A5456465657563168" diff --git a/validat2.cpp b/validat2.cpp index cb885640..32885985 100644 --- a/validat2.cpp +++ b/validat2.cpp @@ -89,7 +89,7 @@ bool ValidateBBS() static const byte output2[] = { 0x74,0x45,0x48,0xAE,0xAC,0xB7,0x0E,0xDF,0xAF,0xD7, 0xD5,0x0E,0x8E,0x29,0x83,0x75,0x6B,0x27,0x46,0xA1}; - + // Coverity finding, also see http://stackoverflow.com/a/34509163/608639. StreamState ss(cout); byte buf[20]; @@ -570,7 +570,7 @@ bool TestPolynomialMod2() bool pass1 = true, pass2 = true, pass3 = true; cout << "\nTesting PolynomialMod2 bit operations...\n\n"; - + static const unsigned int start = 0; static const unsigned int stop = 4 * WORD_BITS + 1; @@ -578,28 +578,28 @@ bool TestPolynomialMod2() { PolynomialMod2 p(1); p <<= i; - + Integer n(Integer::One()); n <<= i; - + std::ostringstream oss1; oss1 << p; - + std::string str1, str2; - + // str1 needs the commas removed used for grouping str1 = oss1.str(); str1.erase(std::remove(str1.begin(), str1.end(), ','), str1.end()); - + // str1 needs the trailing 'b' removed str1.erase(str1.end() - 1); // str2 is fine as-is str2 = IntToString(n, 2); - + pass1 &= (str1 == str2); } - + for (unsigned int i=start; i < stop; i++) { const word w((word)SIZE_MAX); @@ -609,25 +609,25 @@ bool TestPolynomialMod2() Integer n(Integer::POSITIVE, static_cast(w)); n <<= i; - + std::ostringstream oss1; oss1 << p; - + std::string str1, str2; - + // str1 needs the commas removed used for grouping str1 = oss1.str(); str1.erase(std::remove(str1.begin(), str1.end(), ','), str1.end()); - + // str1 needs the trailing 'b' removed str1.erase(str1.end() - 1); // str2 is fine as-is str2 = IntToString(n, 2); - + pass2 &= (str1 == str2); } - + RandomNumberGenerator& prng = GlobalRNG(); for (unsigned int i=start; i < stop; i++) { @@ -639,16 +639,16 @@ bool TestPolynomialMod2() Integer n(Integer::POSITIVE, static_cast(w)); n <<= i; - + std::ostringstream oss1; oss1 << p; - + std::string str1, str2; - + // str1 needs the commas removed used for grouping str1 = oss1.str(); str1.erase(std::remove(str1.begin(), str1.end(), ','), str1.end()); - + // str1 needs the trailing 'b' removed str1.erase(str1.end() - 1); @@ -662,7 +662,7 @@ bool TestPolynomialMod2() cout << " str1: " << str1 << "\n"; cout << " str2: " << str2 << "\n"; } - + pass3 &= (str1 == str2); } diff --git a/validat3.cpp b/validat3.cpp index 335fabc6..0bb256bd 100644 --- a/validat3.cpp +++ b/validat3.cpp @@ -57,7 +57,7 @@ struct HashTestTuple { HashTestTuple(const char *input, const char *output, unsigned int repeatTimes=1) : input((byte *)input), output((byte *)output), inputLen(strlen(input)), repeatTimes(repeatTimes) {} - + HashTestTuple(const char *input, unsigned int inputLen, const char *output, unsigned int repeatTimes) : input((byte *)input), output((byte *)output), inputLen(inputLen), repeatTimes(repeatTimes) {} @@ -97,7 +97,7 @@ bool HashModuleTest(HashTransformation &md, const HashTestTuple *testSet, unsign bool ValidateCRC32() { - HashTestTuple testSet[] = + HashTestTuple testSet[] = { HashTestTuple("", "\x00\x00\x00\x00"), HashTestTuple("a", "\x43\xbe\xb7\xe8"), @@ -117,7 +117,7 @@ bool ValidateCRC32() bool ValidateCRC32C() { - HashTestTuple testSet[] = + HashTestTuple testSet[] = { HashTestTuple("", "\x00\x00\x00\x00"), HashTestTuple("a", "\x30\x43\xd0\xc1"), @@ -137,7 +137,7 @@ bool ValidateCRC32C() bool ValidateAdler32() { - HashTestTuple testSet[] = + HashTestTuple testSet[] = { HashTestTuple("", "\x00\x00\x00\x01"), HashTestTuple("a", "\x00\x62\x00\x62"), @@ -156,7 +156,7 @@ bool ValidateAdler32() bool ValidateMD2() { - HashTestTuple testSet[] = + HashTestTuple testSet[] = { HashTestTuple("", "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69\x27\x73"), HashTestTuple("a", "\x32\xec\x01\xec\x4a\x6d\xac\x72\xc0\xab\x96\xfb\x34\xc0\xb5\xd1"), @@ -175,7 +175,7 @@ bool ValidateMD2() bool ValidateMD4() { - HashTestTuple testSet[] = + HashTestTuple testSet[] = { HashTestTuple("", "\x31\xd6\xcf\xe0\xd1\x6a\xe9\x31\xb7\x3c\x59\xd7\xe0\xc0\x89\xc0"), HashTestTuple("a", "\xbd\xe5\x2c\xb3\x1d\xe3\x3e\x46\x24\x5e\x05\xfb\xdb\xd6\xfb\x24"), @@ -194,7 +194,7 @@ bool ValidateMD4() bool ValidateMD5() { - HashTestTuple testSet[] = + HashTestTuple testSet[] = { HashTestTuple("", "\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04\xe9\x80\x09\x98\xec\xf8\x42\x7e"), HashTestTuple("a", "\x0c\xc1\x75\xb9\xc0\xf1\xb6\xa8\x31\xc3\x99\xe2\x69\x77\x26\x61"), @@ -247,7 +247,7 @@ bool ValidateTiger() bool ValidateRIPEMD() { - HashTestTuple testSet128[] = + HashTestTuple testSet128[] = { HashTestTuple("", "\xcd\xf2\x62\x13\xa1\x50\xdc\x3e\xcb\x61\x0f\x18\xf6\xb3\x8b\x46"), HashTestTuple("a", "\x86\xbe\x7a\xfa\x33\x9d\x0f\xc7\xcf\xc7\x85\xe7\x2f\x57\x8d\x33"), @@ -260,7 +260,7 @@ bool ValidateRIPEMD() HashTestTuple("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "\x4a\x7f\x57\x23\xf9\x54\xeb\xa1\x21\x6c\x9d\x8f\x63\x20\x43\x1f", 15625) }; - HashTestTuple testSet160[] = + HashTestTuple testSet160[] = { HashTestTuple("", "\x9c\x11\x85\xa5\xc5\xe9\xfc\x54\x61\x28\x08\x97\x7e\xe8\xf5\x48\xb2\x25\x8d\x31"), HashTestTuple("a", "\x0b\xdc\x9d\x2d\x25\x6b\x3e\xe9\xda\xae\x34\x7b\xe6\xf4\xdc\x83\x5a\x46\x7f\xfe"), @@ -273,7 +273,7 @@ bool ValidateRIPEMD() HashTestTuple("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "\x52\x78\x32\x43\xc1\x69\x7b\xdb\xe1\x6d\x37\xf9\x7f\x68\xf0\x83\x25\xdc\x15\x28", 15625) }; - HashTestTuple testSet256[] = + HashTestTuple testSet256[] = { HashTestTuple("", "\x02\xba\x4c\x4e\x5f\x8e\xcd\x18\x77\xfc\x52\xd6\x4d\x30\xe3\x7a\x2d\x97\x74\xfb\x1e\x5d\x02\x63\x80\xae\x01\x68\xe3\xc5\x52\x2d"), HashTestTuple("a", "\xf9\x33\x3e\x45\xd8\x57\xf5\xd9\x0a\x91\xba\xb7\x0a\x1e\xba\x0c\xfb\x1b\xe4\xb0\x78\x3c\x9a\xcf\xcd\x88\x3a\x91\x34\x69\x29\x25"), @@ -286,7 +286,7 @@ bool ValidateRIPEMD() HashTestTuple("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "\xac\x95\x37\x44\xe1\x0e\x31\x51\x4c\x15\x0d\x4d\x8d\x7b\x67\x73\x42\xe3\x33\x99\x78\x82\x96\xe4\x3a\xe4\x85\x0c\xe4\xf9\x79\x78", 15625) }; - HashTestTuple testSet320[] = + HashTestTuple testSet320[] = { HashTestTuple("", "\x22\xd6\x5d\x56\x61\x53\x6c\xdc\x75\xc1\xfd\xf5\xc6\xde\x7b\x41\xb9\xf2\x73\x25\xeb\xc6\x1e\x85\x57\x17\x7d\x70\x5a\x0e\xc8\x80\x15\x1c\x3a\x32\xa0\x08\x99\xb8"), HashTestTuple("a", "\xce\x78\x85\x06\x38\xf9\x26\x58\xa5\xa5\x85\x09\x75\x79\x92\x6d\xda\x66\x7a\x57\x16\x56\x2c\xfc\xf6\xfb\xe7\x7f\x63\x54\x2f\x99\xb0\x47\x05\xd6\x97\x0d\xff\x5d"), @@ -323,7 +323,7 @@ bool ValidateRIPEMD() #ifdef CRYPTOPP_REMOVED bool ValidateHAVAL() { - HashTestTuple testSet[] = + HashTestTuple testSet[] = { HashTestTuple("", "\xC6\x8F\x39\x91\x3F\x90\x1F\x3D\xDF\x44\xC7\x07\x35\x7A\x7D\x70"), HashTestTuple("a", "\x4D\xA0\x8F\x51\x4A\x72\x75\xDB\xC4\xCE\xCE\x4A\x34\x73\x85\x98\x39\x83\xA8\x30"), @@ -608,7 +608,7 @@ bool ValidatePBKDF() { // from OpenSSL PKCS#12 Program FAQ v1.77, at http://www.drh-consultancy.demon.co.uk/test.txt - PBKDF_TestTuple testSet[] = + PBKDF_TestTuple testSet[] = { {1, 1, "0073006D006500670000", "0A58CF64530D823F", "8AAAE6297B6CB04642AB5B077851284EB7128F1A2A7FBCA3"}, {2, 1, "0073006D006500670000", "0A58CF64530D823F", "79993DFE048D3B76"}, @@ -630,7 +630,7 @@ bool ValidatePBKDF() { // from draft-ietf-smime-password-03.txt, at http://www.imc.org/draft-ietf-smime-password - PBKDF_TestTuple testSet[] = + PBKDF_TestTuple testSet[] = { {0, 5, "70617373776f7264", "1234567878563412", "D1DAA78615F287E6"}, {0, 500, "416C6C206E2D656E746974696573206D75737420636F6D6D756E69636174652077697468206F74686572206E2d656E74697469657320766961206E2D3120656E746974656568656568656573", "1234567878563412","6A8970BF68C92CAEA84A8DF28510858607126380CC47AB2D"} @@ -702,7 +702,7 @@ bool ValidateHKDF() {"000102030405060708090a0b0c0d0e0f 101112131415161718191a1b1c1d1e1f 202122232425262728292a2b2c2d2e2f 303132333435363738393a3b3c3d3e3f 404142434445464748494a4b4c4d4e4f", "606162636465666768696a6b6c6d6e6f 707172737475767778797a7b7c7d7e7f 808182838485868788898a8b8c8d8e8f 909192939495969798999a9b9c9d9e9f a0a1a2a3a4a5a6a7a8a9aaabacadaeaf", "b0b1b2b3b4b5b6b7b8b9babbbcbdbebf c0c1c2c3c4c5c6c7c8c9cacbcccdcecf d0d1d2d3d4d5d6d7d8d9dadbdcdddedf e0e1e2e3e4e5e6e7e8e9eaebecedeeef f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff", "0bd770a74d1160f7c9f12cd5912a06eb ff6adcae899d92191fe4305673ba2ffe 8fa3f1a4e5ad79f3f334b3b202b2173c 486ea37ce3d397ed034c7f9dfeb15c5e 927336d0441f4c4300e2cff0d0900b52 d3b4", 82}, // Test Case #6 {"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b", "", "", "0ac1af7002b3d761d1e55298da9d0506 b9ae52057220a306e07b6b87e8df21d0 ea00033de03984d34918", 42}, - // Test Case #7 + // Test Case #7 {"0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c", NULL, "", "2c91117204d745f3500d636a62f64f0 ab3bae548aa53d423b0d1f27ebba6f5e5 673a081d70cce7acfc48", 42} }; @@ -771,8 +771,8 @@ bool ValidateHKDF() std::cout << "\nRFC 5869 HKDF(Whirlpool) validation suite running...\n\n"; pass = TestHKDF(hkdf, testSet, COUNTOF(testSet)) && pass; } - - + + return pass; }