summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoloader <noloader@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2015-07-05 23:16:55 +0000
committernoloader <noloader@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2015-07-05 23:16:55 +0000
commit5fae159248b8053f57f9900ac83772b974a71001 (patch)
treec738747b52acd403743844f96c55c1be20405cbc
parentfc564ea5f964d6fc0bc13a0ca83451cf4ac57b75 (diff)
downloadcryptopp-5fae159248b8053f57f9900ac83772b974a71001.tar.gz
Static and constness to arrays
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@572 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r--validat1.cpp48
-rw-r--r--validat2.cpp19
-rw-r--r--validat3.cpp46
3 files changed, 57 insertions, 56 deletions
diff --git a/validat1.cpp b/validat1.cpp
index 7c4ca2f..ee5a18b 100644
--- a/validat1.cpp
+++ b/validat1.cpp
@@ -557,9 +557,9 @@ bool TestModeIV(SymmetricCipher &e, SymmetricCipher &d)
bool ValidateCipherModes()
{
cout << "\nTesting DES modes...\n\n";
- const byte key[] = {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef};
- const byte iv[] = {0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef};
- const byte plain[] = { // "Now is the time for all " without tailing 0
+ static const byte key[] = {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef};
+ static const byte iv[] = {0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef};
+ static const byte plain[] = { // "Now is the time for all " without tailing 0
0x4e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20};
@@ -569,7 +569,7 @@ bool ValidateCipherModes()
{
// from FIPS 81
- const byte encrypted[] = {
+ static const byte encrypted[] = {
0x3f, 0xa4, 0x0e, 0x8a, 0x98, 0x4d, 0x48, 0x15,
0x6a, 0x27, 0x17, 0x87, 0xab, 0x88, 0x83, 0xf9,
0x89, 0x3d, 0x51, 0xec, 0x4b, 0x56, 0x3b, 0x53};
@@ -588,7 +588,7 @@ bool ValidateCipherModes()
}
{
// from FIPS 81
- const byte encrypted[] = {
+ static 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};
@@ -612,7 +612,7 @@ bool ValidateCipherModes()
{
// generated with Crypto++, matches FIPS 81
// but has extra 8 bytes as result of padding
- const byte encrypted[] = {
+ static 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,
@@ -633,7 +633,7 @@ bool ValidateCipherModes()
{
// generated with Crypto++ 5.2, matches FIPS 81
// but has extra 8 bytes as result of padding
- const byte encrypted[] = {
+ static 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,
@@ -652,9 +652,9 @@ bool ValidateCipherModes()
cout << (fail ? "FAILED " : "passed ") << "CBC decryption with one-and-zeros padding" << endl;
}
{
- const byte plain[] = {'a', 0, 0, 0, 0, 0, 0, 0};
+ static const byte plain[] = {'a', 0, 0, 0, 0, 0, 0, 0};
// generated with Crypto++
- const byte encrypted[] = {
+ static const byte encrypted[] = {
0x9B, 0x47, 0x57, 0x59, 0xD6, 0x9C, 0xF6, 0xD0};
CBC_Mode_ExternalCipher::Encryption modeE(desE, iv);
@@ -672,7 +672,7 @@ bool ValidateCipherModes()
{
// generated with Crypto++, matches FIPS 81
// but with last two blocks swapped as result of CTS
- const byte encrypted[] = {
+ static const byte encrypted[] = {
0xE5, 0xC7, 0xCD, 0xDE, 0x87, 0x2B, 0xF2, 0x7C,
0x68, 0x37, 0x88, 0x49, 0x9A, 0x7C, 0x05, 0xF6,
0x43, 0xE9, 0x34, 0x00, 0x8C, 0x38, 0x9C, 0x0F};
@@ -695,8 +695,8 @@ bool ValidateCipherModes()
}
{
// generated with Crypto++
- const byte decryptionIV[] = {0x4D, 0xD0, 0xAC, 0x8F, 0x47, 0xCF, 0x79, 0xCE};
- const byte encrypted[] = {0x12, 0x34, 0x56};
+ static const byte decryptionIV[] = {0x4D, 0xD0, 0xAC, 0x8F, 0x47, 0xCF, 0x79, 0xCE};
+ static const byte encrypted[] = {0x12, 0x34, 0x56};
byte stolenIV[8];
@@ -715,7 +715,7 @@ bool ValidateCipherModes()
cout << (fail ? "FAILED " : "passed ") << "CBC decryption with ciphertext and IV stealing" << endl;
}
{
- const byte encrypted[] = { // from FIPS 81
+ static const byte encrypted[] = { // from FIPS 81
0xF3,0x09,0x62,0x49,0xC7,0xF4,0x6E,0x51,
0xA6,0x9E,0x83,0x9B,0x1A,0x92,0xF7,0x84,
0x03,0x46,0x71,0x33,0x89,0x8E,0xA6,0x22};
@@ -737,9 +737,9 @@ bool ValidateCipherModes()
cout << (fail ? "FAILED " : "passed ") << "CFB mode IV generation" << endl;
}
{
- const byte plain[] = { // "Now is the." without tailing 0
+ static const byte plain[] = { // "Now is the." without tailing 0
0x4e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,0x68,0x65};
- const byte encrypted[] = { // from FIPS 81
+ static const byte encrypted[] = { // from FIPS 81
0xf3,0x1f,0xda,0x07,0x01,0x14,0x62,0xee,0x18,0x7f};
CFB_Mode_ExternalCipher::Encryption modeE(desE, iv, 1);
@@ -759,7 +759,7 @@ bool ValidateCipherModes()
cout << (fail ? "FAILED " : "passed ") << "CFB (8-bit feedback) IV generation" << endl;
}
{
- const byte encrypted[] = { // from Eric Young's libdes
+ static const byte encrypted[] = { // from Eric Young's libdes
0xf3,0x09,0x62,0x49,0xc7,0xf4,0x6e,0x51,
0x35,0xf2,0x4a,0x24,0x2e,0xeb,0x3d,0x3f,
0x3d,0x6d,0x5b,0xe3,0x25,0x5a,0xf8,0xc3};
@@ -781,7 +781,7 @@ bool ValidateCipherModes()
cout << (fail ? "FAILED " : "passed ") << "OFB IV generation" << endl;
}
{
- const byte encrypted[] = { // generated with Crypto++
+ static const byte encrypted[] = { // generated with Crypto++
0xF3, 0x09, 0x62, 0x49, 0xC7, 0xF4, 0x6E, 0x51,
0x16, 0x3A, 0x8C, 0xA0, 0xFF, 0xC9, 0x4C, 0x27,
0xFA, 0x2F, 0x80, 0xF4, 0x80, 0xB8, 0x6F, 0x75};
@@ -803,14 +803,14 @@ bool ValidateCipherModes()
cout << (fail ? "FAILED " : "passed ") << "Counter Mode IV generation" << endl;
}
{
- const byte plain[] = { // "7654321 Now is the time for "
+ static const byte plain[] = { // "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,
0x66, 0x6f, 0x72, 0x20};
- const byte mac1[] = { // from FIPS 113
+ static const byte mac1[] = { // from FIPS 113
0xf1, 0xd3, 0x0f, 0x68, 0x49, 0x31, 0x2c, 0xa4};
- const byte mac2[] = { // generated with Crypto++
+ static const byte mac2[] = { // generated with Crypto++
0x35, 0x80, 0xC5, 0xC4, 0x6B, 0x81, 0x24, 0xE2};
CBC_MAC<DES> cbcmac(key);
@@ -1162,7 +1162,7 @@ bool ValidateBlowfish()
cout << "\nBlowfish validation suite running...\n\n";
HexEncoder output(new FileSink(cout));
- const char *key[]={"abcdefghijklmnopqrstuvwxyz", "Who is John Galt?"};
+ static const char *key[]={"abcdefghijklmnopqrstuvwxyz", "Who is John Galt?"};
byte *plain[]={(byte *)"BLOWFISH", (byte *)"\xfe\xdc\xba\x98\x76\x54\x32\x10"};
byte *cipher[]={(byte *)"\x32\x4e\xd0\xfe\xf4\x13\xa2\x03", (byte *)"\xcc\x91\x73\x2b\x80\x22\xf6\x84"};
byte out[8], outplain[8];
@@ -1286,7 +1286,7 @@ bool ValidateBaseCode()
byte data[255];
for (unsigned int i=0; i<255; i++)
data[i] = i;
- const char *hexEncoded =
+ static const char *hexEncoded =
"000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324252627"
"28292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F"
"505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F7071727374757677"
@@ -1294,14 +1294,14 @@ bool ValidateBaseCode()
"A0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7"
"C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF"
"F0F1F2F3F4F5F6F7F8F9FAFBFCFDFE";
- const char *base32Encoded =
+ static const char *base32Encoded =
"AAASEA2EAWDAQCAJBIFS2DIQB6IBCESVCSKTNF22DEPBYHA7D2RUAIJCENUCKJTHFAWUWK3NFWZC8NBT"
"GI3VIPJYG66DUQT5HS8V6R4AIFBEGTCFI3DWSUKKJPGE4VURKBIXEW4WKXMFQYC3MJPX2ZK8M7SGC2VD"
"NTUYN35IPFXGY5DPP3ZZA6MUQP4HK7VZRB6ZW856RX9H9AEBSKB2JBNGS8EIVCWMTUG27D6SUGJJHFEX"
"U4M3TGN4VQQJ5HW9WCS4FI7EWYVKRKFJXKX43MPQX82MDNXVYU45PP72ZG7MZRF7Z496BSQC2RCNMTYH"
"3DE6XU8N3ZHN9WGT4MJ7JXQY49NPVYY55VQ77Z9A6HTQH3HF65V8T4RK7RYQ55ZR8D29F69W8Z5RR8H3"
"9M7939R8";
- const char *base64AndHexEncoded =
+ static const char *base64AndHexEncoded =
"41414543417751464267634943516F4C4441304F4478415245684D554652595847426B6147787764"
"486838674953496A4A43556D4A7967704B6973734C5334764D4445794D7A51310A4E6A63344F546F"
"375044302B50304242516B4E4552555A4853456C4B5330784E546B395155564A5456465657563168"
diff --git a/validat2.cpp b/validat2.cpp
index f6421c3..26b2c5b 100644
--- a/validat2.cpp
+++ b/validat2.cpp
@@ -60,10 +60,10 @@ bool ValidateBBS()
bool pass = true, fail;
int j;
- const byte output1[] = {
+ static const byte output1[] = {
0x49,0xEA,0x2C,0xFD,0xB0,0x10,0x64,0xA0,0xBB,0xB9,
0x2A,0xF1,0x01,0xDA,0xC1,0x8A,0x94,0xF7,0xB7,0xCE};
- const byte output2[] = {
+ static const byte output2[] = {
0x74,0x45,0x48,0xAE,0xAC,0xB7,0x0E,0xDF,0xAF,0xD7,
0xD5,0x0E,0x8E,0x29,0x83,0x75,0x6B,0x27,0x46,0xA1};
@@ -111,8 +111,8 @@ bool SignatureValidate(PK_Signer &priv, PK_Verifier &pub, bool thorough = false)
cout << (fail ? "FAILED " : "passed ");
cout << "signature key validation\n";
- const byte *message = (byte *)"test message";
- const int messageLen = 12;
+ static const byte message[] = "test message";
+ const int messageLen = COUNTOF(message);
SecByteBlock signature(priv.MaxSignatureLength());
size_t signatureLength = priv.SignMessage(GlobalRNG(), message, messageLen, signature);
@@ -162,8 +162,9 @@ bool CryptoSystemValidate(PK_Decryptor &priv, PK_Encryptor &pub, bool thorough =
cout << (fail ? "FAILED " : "passed ");
cout << "cryptosystem key validation\n";
- const byte *message = (byte *)"test message";
- const int messageLen = 12;
+ static const byte message[] = "test message";
+ const int messageLen = COUNTOF(message);
+
SecByteBlock ciphertext(priv.CiphertextLength(messageLen));
SecByteBlock plaintext(priv.MaxPlaintextLength(ciphertext.size()));
@@ -262,7 +263,7 @@ bool ValidateRSA()
bool pass = true, fail;
{
- const char *plain = "Everyone gets Friday off.";
+ static const char plain[] = "Everyone gets Friday off.";
byte *signature = (byte *)
"\x05\xfa\x6a\x81\x2f\xc7\xdf\x8b\xf4\xf2\x54\x25\x09\xe0\x3e\x84"
"\x6e\x11\xb9\xc6\x20\xbe\x20\x09\xef\xb4\x40\xef\xbc\xc6\x69\x21"
@@ -693,8 +694,8 @@ bool ValidateESIGN()
bool pass = true, fail;
- const char *plain = "test";
- const byte *signature = (byte *)
+ static const char plain[] = "test";
+ static const byte signature[] =
"\xA3\xE3\x20\x65\xDE\xDA\xE7\xEC\x05\xC1\xBF\xCD\x25\x79\x7D\x99\xCD\xD5\x73\x9D\x9D\xF3\xA4\xAA\x9A\xA4\x5A\xC8\x23\x3D\x0D\x37\xFE\xBC\x76\x3F\xF1\x84\xF6\x59"
"\x14\x91\x4F\x0C\x34\x1B\xAE\x9A\x5C\x2E\x2E\x38\x08\x78\x77\xCB\xDC\x3C\x7E\xA0\x34\x44\x5B\x0F\x67\xD9\x35\x2A\x79\x47\x1A\x52\x37\x71\xDB\x12\x67\xC1\xB6\xC6"
"\x66\x73\xB3\x40\x2E\xD6\xF2\x1A\x84\x0A\xB6\x7B\x0F\xEB\x8B\x88\xAB\x33\xDD\xE4\x83\x21\x90\x63\x2D\x51\x2A\xB1\x6F\xAB\xA7\x5C\xFD\x77\x99\xF2\xE1\xEF\x67\x1A"
diff --git a/validat3.cpp b/validat3.cpp
index 523606d..9c6bb62 100644
--- a/validat3.cpp
+++ b/validat3.cpp
@@ -72,7 +72,7 @@ bool HashModuleTest(HashTransformation &md, const HashTestTuple *testSet, unsign
bool ValidateCRC32()
{
- HashTestTuple testSet[] =
+ static const HashTestTuple testSet[] =
{
HashTestTuple("", "\x00\x00\x00\x00"),
HashTestTuple("a", "\x43\xbe\xb7\xe8"),
@@ -92,7 +92,7 @@ bool ValidateCRC32()
bool ValidateAdler32()
{
- HashTestTuple testSet[] =
+ static const HashTestTuple testSet[] =
{
HashTestTuple("", "\x00\x00\x00\x01"),
HashTestTuple("a", "\x00\x62\x00\x62"),
@@ -111,7 +111,7 @@ bool ValidateAdler32()
bool ValidateMD2()
{
- HashTestTuple testSet[] =
+ static const 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"),
@@ -130,7 +130,7 @@ bool ValidateMD2()
bool ValidateMD4()
{
- HashTestTuple testSet[] =
+ static const 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"),
@@ -149,7 +149,7 @@ bool ValidateMD4()
bool ValidateMD5()
{
- HashTestTuple testSet[] =
+ static const 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"),
@@ -182,7 +182,7 @@ bool ValidateTiger()
{
cout << "\nTiger validation suite running...\n\n";
- HashTestTuple testSet[] =
+ static const HashTestTuple testSet[] =
{
HashTestTuple("", "\x32\x93\xac\x63\x0c\x13\xf0\x24\x5f\x92\xbb\xb1\x76\x6e\x16\x16\x7a\x4e\x58\x49\x2d\xde\x73\xf3"),
HashTestTuple("abc", "\x2a\xab\x14\x84\xe8\xc1\x58\xf2\xbf\xb8\xc5\xff\x41\xb5\x7a\x52\x51\x29\x13\x1c\x95\x7b\x5f\x93"),
@@ -202,7 +202,7 @@ bool ValidateTiger()
bool ValidateRIPEMD()
{
- HashTestTuple testSet128[] =
+ static const 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"),
@@ -215,7 +215,7 @@ bool ValidateRIPEMD()
HashTestTuple("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "\x4a\x7f\x57\x23\xf9\x54\xeb\xa1\x21\x6c\x9d\x8f\x63\x20\x43\x1f", 15625)
};
- HashTestTuple testSet160[] =
+ static const 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"),
@@ -228,7 +228,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[] =
+ static const 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"),
@@ -241,7 +241,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[] =
+ static const 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"),
@@ -278,7 +278,7 @@ bool ValidateRIPEMD()
#ifdef CRYPTOPP_REMOVED
bool ValidateHAVAL()
{
- HashTestTuple testSet[] =
+ static const 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"),
@@ -333,11 +333,11 @@ bool ValidateWhirlpool()
#ifdef CRYPTOPP_REMOVED
bool ValidateMD5MAC()
{
- const byte keys[2][MD5MAC::KEYLENGTH]={
+ static const byte keys[2][MD5MAC::KEYLENGTH]={
{0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff},
{0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10}};
- const char *TestVals[7]={
+ static const char *TestVals[7]={
"",
"a",
"abc",
@@ -346,7 +346,7 @@ bool ValidateMD5MAC()
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"};
- const byte output[2][7][MD5MAC::DIGESTSIZE]={
+ static const byte output[2][7][MD5MAC::DIGESTSIZE]={
{{0x1f,0x1e,0xf2,0x37,0x5c,0xc0,0xe0,0x84,0x4f,0x98,0xe7,0xe8,0x11,0xa3,0x4d,0xa8},
{0x7a,0x76,0xee,0x64,0xca,0x71,0xef,0x23,0x7e,0x26,0x29,0xed,0x94,0x52,0x73,0x65},
{0xe8,0x01,0x3c,0x11,0xf7,0x20,0x9d,0x13,0x28,0xc0,0xca,0xa0,0x4f,0xd0,0x12,0xa6},
@@ -402,13 +402,13 @@ bool ValidateXMACC()
{
typedef XMACC<MD5> XMACC_MD5;
- const byte keys[2][XMACC_MD5::KEYLENGTH]={
+ static const byte keys[2][XMACC_MD5::KEYLENGTH]={
{0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb},
{0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xfe,0xdc,0xba,0x98}};
- const word32 counters[2]={0xccddeeff, 0x76543210};
+ static const word32 counters[2]={0xccddeeff, 0x76543210};
- const char *TestVals[7]={
+ static const char *TestVals[7]={
"",
"a",
"abc",
@@ -417,7 +417,7 @@ bool ValidateXMACC()
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"};
- const byte output[2][7][XMACC_MD5::DIGESTSIZE]={
+ static const byte output[2][7][XMACC_MD5::DIGESTSIZE]={
{{0xcc,0xdd,0xef,0x00,0xfa,0x89,0x54,0x92,0x86,0x32,0xda,0x2a,0x3f,0x29,0xc5,0x52,0xa0,0x0d,0x05,0x13},
{0xcc,0xdd,0xef,0x01,0xae,0xdb,0x8b,0x7b,0x69,0x71,0xc7,0x91,0x71,0x48,0x9d,0x18,0xe7,0xdf,0x9d,0x5a},
{0xcc,0xdd,0xef,0x02,0x5e,0x01,0x2e,0x2e,0x4b,0xc3,0x83,0x62,0xc2,0xf4,0xe6,0x18,0x1c,0x44,0xaf,0xca},
@@ -465,11 +465,11 @@ bool ValidateXMACC()
bool ValidateTTMAC()
{
- const byte key[TTMAC::KEYLENGTH]={
+ static const byte key[TTMAC::KEYLENGTH]={
0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,
0xaa,0xbb,0xcc,0xdd,0xee,0xff,0x01,0x23,0x45,0x67};
- const char *TestVals[8]={
+ static const char *TestVals[8]={
"",
"a",
"abc",
@@ -479,7 +479,7 @@ bool ValidateTTMAC()
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"};
- const byte output[8][TTMAC::DIGESTSIZE]={
+ static const byte output[8][TTMAC::DIGESTSIZE]={
{0x2d,0xec,0x8e,0xd4,0xa0,0xfd,0x71,0x2e,0xd9,0xfb,0xf2,0xab,0x46,0x6e,0xc2,0xdf,0x21,0x21,0x5e,0x4a},
{0x58,0x93,0xe3,0xe6,0xe3,0x06,0x70,0x4d,0xd7,0x7a,0xd6,0xe6,0xed,0x43,0x2c,0xde,0x32,0x1a,0x77,0x56},
{0x70,0xbf,0xd1,0x02,0x97,0x97,0xa5,0xc1,0x6d,0xa5,0xb5,0x57,0xa1,0xf0,0xb2,0x77,0x9b,0x78,0x49,0x7e},
@@ -554,7 +554,7 @@ bool ValidatePBKDF()
{
// from OpenSSL PKCS#12 Program FAQ v1.77, at http://www.drh-consultancy.demon.co.uk/test.txt
- PBKDF_TestTuple testSet[] =
+ static const PBKDF_TestTuple testSet[] =
{
{1, 1, "0073006D006500670000", "0A58CF64530D823F", "8AAAE6297B6CB04642AB5B077851284EB7128F1A2A7FBCA3"},
{2, 1, "0073006D006500670000", "0A58CF64530D823F", "79993DFE048D3B76"},
@@ -576,7 +576,7 @@ bool ValidatePBKDF()
{
// from draft-ietf-smime-password-03.txt, at http://www.imc.org/draft-ietf-smime-password
- PBKDF_TestTuple testSet[] =
+ static const PBKDF_TestTuple testSet[] =
{
{0, 5, "70617373776f7264", "1234567878563412", "D1DAA78615F287E6"},
{0, 500, "416C6C206E2D656E746974696573206D75737420636F6D6D756E69636174652077697468206F74686572206E2d656E74697469657320766961206E2D3120656E746974656568656568656573", "1234567878563412","6A8970BF68C92CAEA84A8DF28510858607126380CC47AB2D"}