Remove unneeded Debug tests

These tests are effectively performed in MDC, SEAL and OldRandomPool
This commit is contained in:
Jeffrey Walton 2017-09-01 02:37:41 -04:00
parent b47de6150f
commit 14a5221d82
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
4 changed files with 0 additions and 169 deletions

View File

@ -959,8 +959,6 @@ bool Validate(int alg, bool thorough, const char *seedInput)
case 9995: result = TestHuffmanCodes(); break;
// http://github.com/weidai11/cryptopp/issues/346
case 9994: result = TestASN1Parse(); break;
// TODO: bug report it
case 9993: result = TestSHAStaticTransform(); break;
#endif
default: return false;

View File

@ -119,9 +119,6 @@ bool ValidateAll(bool thorough)
pass=ValidateMD4() && pass;
#endif
pass=ValidateMD5() && pass;
#if defined(CRYPTOPP_EXTENDED_VALIDATION)
pass=TestSHAStaticTransform() && pass;
#endif
pass=ValidateSHA() && pass;
pass=RunTestDataFile(CRYPTOPP_DATA_DIR "TestVectors/keccak.txt") && pass;

View File

@ -209,168 +209,6 @@ bool ValidateMD5()
return HashModuleTest(md5, testSet, COUNTOF(testSet));
}
#if defined(CRYPTOPP_EXTENDED_VALIDATION)
struct StaticTransformTestTuple32
{
void (*pfn32)(word32*, const word32*);
const char* name;
const size_t size;
const byte *data;
const byte *digest;
};
struct StaticTransformTestTuple64
{
void (*pfn64)(word64*, const word64*);
const char* name;
const size_t size;
const byte *data;
const byte *digest;
};
bool TestSHAStaticTransform()
{
std::cout << "\nSHA static transform suite running...\n\n";
static const size_t MAX_PARAM = SHA512::BLOCKSIZE;
bool pass=true, fail;
CRYPTOPP_ALIGN_DATA(16)
const byte SM1[MAX_PARAM] = {0};
CRYPTOPP_ALIGN_DATA(16)
const byte SM2[MAX_PARAM] = {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
};
CRYPTOPP_ALIGN_DATA(16)
byte SM3[MAX_PARAM] = {
0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E,
0x20,0x22,0x24,0x26,0x28,0x2A,0x2C,0x2E,0x30,0x32,0x34,0x36,0x38,0x3A,0x3C,0x3E,
0x40,0x42,0x44,0x46,0x48,0x4A,0x4C,0x4E,0x50,0x52,0x54,0x56,0x58,0x5A,0x5C,0x5E,
0x60,0x62,0x64,0x66,0x68,0x6A,0x6C,0x6E,0x70,0x72,0x74,0x76,0x78,0x7A,0x7C,0x7E,
0x80,0x82,0x84,0x86,0x88,0x8A,0x8C,0x8E,0x90,0x92,0x94,0x96,0x98,0x9A,0x9C,0x9E,
0xA0,0xA2,0xA4,0xA6,0xA8,0xAA,0xAC,0xAE,0xB0,0xB2,0xB4,0xB6,0xB8,0xBA,0xBC,0xBE,
0xC0,0xC2,0xC4,0xC6,0xC8,0xCA,0xCC,0xCE,0xD0,0xD2,0xD4,0xD6,0xD8,0xDA,0xDC,0xDE,
0xE0,0xE2,0xE4,0xE6,0xE8,0xEA,0xEC,0xEE,0xF0,0xF2,0xF4,0xF6,0xF8,0xFA,0xFC,0xFE
};
CRYPTOPP_ALIGN_DATA(16)
byte result[MAX_PARAM];
const byte SHA1M1[] = {
0xED,0x47,0x15,0x9E,0xC2,0x91,0xEC,0x57, 0xC8,0x8B,0xFA,0x30,0x54,0x5A,0x78,0xC7,
0xE3,0xA5,0xEF,0xA7
};
const byte SHA1M2[SHA1::DIGESTSIZE] = {
0x9B,0x15,0x48,0x3F,0xFA,0x51,0xCE,0x2D, 0x0A,0x93,0x1E,0x8A,0x68,0x3B,0x08,0x02,
0xE8,0xD6,0x70,0xEF
};
const byte SHA1M3[SHA1::DIGESTSIZE] = {
0x6D,0x65,0x87,0x41,0xB5,0x50,0x66,0x24, 0xAB,0x9B,0x08,0xD2,0xED,0x6E,0x32,0xAC,
0xDC,0xC5,0x17,0x67
};
const byte SHA256M1[SHA256::DIGESTSIZE] = {
0x14,0x16,0xA5,0x7C,0xA8,0x3B,0x5C,0x42, 0x2F,0xDD,0x54,0xCE,0xE7,0x0A,0x02,0xC2,
0xD1,0x74,0xE5,0xB6,0x0F,0x6D,0x13,0x98, 0xCC,0x26,0x7E,0xAE,0xA6,0xE7,0x0B,0xBF
};
const byte SHA256M2[SHA256::DIGESTSIZE] = {
0x7A,0x12,0x98,0x05,0x6E,0x70,0x11,0xAF, 0xFF,0x1F,0x40,0x77,0x49,0xC5,0x30,0xD7,
0x67,0xC8,0x84,0x0B,0xA3,0x6C,0x8C,0xA9, 0xF9,0xC0,0xF3,0xD7,0x79,0x8B,0xA7,0x06
};
const byte SHA256M3[SHA256::DIGESTSIZE] = {
0xCB,0x8E,0x2A,0xD0,0x39,0x89,0x15,0xE9, 0xFF,0x65,0xDA,0xA6,0x84,0x23,0x96,0xB9,
0xCD,0xB5,0x51,0xC1,0x1D,0x21,0xF1,0x9E, 0x67,0x8A,0xB0,0xD8,0x34,0x1D,0x06,0x11
};
const byte SHA512M1[SHA512::DIGESTSIZE] = {
0x30,0xF8,0xEB,0x38,0xA8,0x5D,0x3A,0xAD, 0xDB,0xBE,0xFC,0x85,0xFF,0x42,0x71,0x5D,
0x99,0xCA,0xF7,0xD6,0x86,0xBF,0xA8,0x7F, 0xBF,0x0B,0xD7,0x39,0xB0,0x15,0x6B,0x1C,
0x18,0x35,0x92,0x89,0x52,0x51,0xF6,0x29, 0x3A,0x8F,0x2E,0x5F,0x1D,0x10,0xD7,0x6F,
0x50,0x14,0x53,0x76,0x24,0x8D,0x35,0x1C, 0x3C,0xDC,0x56,0xD7,0x99,0x0D,0x8C,0x56
};
const byte SHA512M2[SHA512::DIGESTSIZE] = {
0xEE,0x51,0xE9,0x96,0x16,0x12,0x0F,0x9B, 0x68,0xE7,0x41,0xB7,0x67,0xB4,0xD0,0x41,
0x84,0x28,0xB7,0xB3,0xEB,0x41,0x4F,0x56, 0xC1,0x5B,0xCB,0xCA,0x0F,0xB4,0x05,0xF8,
0x00,0xA9,0x02,0xCF,0xFF,0x9C,0x37,0x3C, 0x54,0xC5,0x9A,0x80,0x7F,0xA3,0x17,0x9B,
0xAB,0xB6,0x83,0x1C,0x2E,0xFD,0xC9,0x79, 0x7A,0x2C,0xC0,0x52,0xE2,0xD9,0x48,0xE9
};
const byte SHA512M3[SHA512::DIGESTSIZE] = {
0x2F,0xA6,0xE7,0x5B,0xB4,0x3D,0xC5,0x22, 0x7B,0x29,0x3B,0xBC,0xDB,0xBC,0x00,0xD3,
0x4F,0x28,0xF9,0x33,0xB4,0xA8,0x8D,0x3B, 0x96,0xF0,0x91,0xC6,0xE6,0x75,0xD0,0x22,
0x8D,0x3F,0x26,0x85,0xCF,0x4E,0xC8,0x36, 0xE2,0xF4,0xC0,0xEF,0xD9,0x83,0x8D,0x10,
0x73,0x60,0x49,0x40,0xDB,0xA2,0x20,0x1F, 0x88,0x4A,0xE8,0xBB,0x85,0x92,0xF7,0xD5
};
StaticTransformTestTuple32 tuples32[] = {
{SHA1::Transform, "SHA1::Transform", SHA1::DIGESTSIZE, SM1, SHA1M1},
{SHA1::Transform, "SHA1::Transform", SHA1::DIGESTSIZE, SM2, SHA1M2},
{SHA1::Transform, "SHA1::Transform", SHA1::DIGESTSIZE, SM3, SHA1M3},
{SHA256::Transform, "SHA256::Transform", SHA256::DIGESTSIZE, SM1, SHA256M1},
{SHA256::Transform, "SHA256::Transform", SHA256::DIGESTSIZE, SM2, SHA256M2},
{SHA256::Transform, "SHA256::Transform", SHA256::DIGESTSIZE, SM3, SHA256M3},
};
StaticTransformTestTuple64 tuples64[] = {
{SHA512::Transform, "SHA512::Transform", SHA512::DIGESTSIZE, SM1, SHA512M1},
{SHA512::Transform, "SHA512::Transform", SHA512::DIGESTSIZE, SM2, SHA512M2},
{SHA512::Transform, "SHA512::Transform", SHA512::DIGESTSIZE, SM3, SHA512M3},
};
for (unsigned int i=0; i<COUNTOF(tuples32); ++i)
{
std::memcpy(result, tuples32[i].data, tuples32[i].size);
tuples32[i].pfn32(reinterpret_cast<word32*>(result), reinterpret_cast<const word32*>(tuples32[i].data));
fail = !!std::memcmp(result, tuples32[i].digest, tuples32[i].size);
pass = !fail && pass;
if (!fail)
std::cout << "passed: ";
else
std::cout << "FAILED: ";
std::cout << tuples32[i].name << ", message "<< (i%3)+1 << "\n";
if (fail)
{
std::cout << "Calculated: ";
HexEncoder encoder(new FileSink(std::cout));
encoder.Put(result, tuples32[i].size);
std::cout << "\n";
}
}
for (unsigned int i=0; i<COUNTOF(tuples64); ++i)
{
std::memcpy(result, tuples64[i].data, tuples64[i].size);
tuples64[i].pfn64(reinterpret_cast<word64*>(result), reinterpret_cast<const word64*>(tuples64[i].data));
fail = !!std::memcmp(result, tuples64[i].digest, tuples64[i].size);
pass = !fail && pass;
if (!fail)
std::cout << "passed: ";
else
std::cout << "FAILED: ";
std::cout << tuples64[i].name << ", message "<< (i%3)+1 << "\n";
if (fail)
{
std::cout << "Calculated: ";
HexEncoder encoder(new FileSink(std::cout));
encoder.Put(result, tuples64[i].size);
std::cout << "\n";
}
}
return pass;
}
#endif
bool ValidateSHA()
{
std::cout << "\nSHA validation suite running...\n";

View File

@ -129,8 +129,6 @@ bool TestRounding();
bool TestHuffmanCodes();
// http://github.com/weidai11/cryptopp/issues/346
bool TestASN1Parse();
// TODO: bug report it
bool TestSHAStaticTransform();
// Additional tests due to no coverage
bool TestCompressors();
bool TestEncryptors();