add testvectors for smaller RC2 keysizes
originates from rfc2268 1 byte keylen is commented
This commit is contained in:
parent
19c81bbbee
commit
952caf3cd7
@ -288,12 +288,25 @@ int rc2_test(void)
|
|||||||
unsigned char key[16], pt[8], ct[8];
|
unsigned char key[16], pt[8], ct[8];
|
||||||
} tests[] = {
|
} tests[] = {
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
{ 1,
|
||||||
|
{ 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||||
|
{ 0x61, 0xa8, 0xa2, 0x44, 0xad, 0xac, 0xcc, 0xf0 }
|
||||||
|
},
|
||||||
|
#endif
|
||||||
|
{ 7,
|
||||||
|
{ 0x88, 0xbc, 0xa9, 0x0e, 0x90, 0x87, 0x5a, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||||
|
{ 0x6c, 0xcf, 0x43, 0x08, 0x97, 0x4c, 0x26, 0x7f }
|
||||||
|
},
|
||||||
{ 8,
|
{ 8,
|
||||||
{ 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
{ 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||||
{ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
|
{ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
|
||||||
{ 0x30, 0x64, 0x9e, 0xdf, 0x9b, 0xe7, 0xd2, 0xc2 }
|
{ 0x30, 0x64, 0x9e, 0xdf, 0x9b, 0xe7, 0xd2, 0xc2 }
|
||||||
|
|
||||||
},
|
},
|
||||||
{ 16,
|
{ 16,
|
||||||
{ 0x88, 0xbc, 0xa9, 0x0e, 0x90, 0x87, 0x5a, 0x7f,
|
{ 0x88, 0xbc, 0xa9, 0x0e, 0x90, 0x87, 0x5a, 0x7f,
|
||||||
@ -315,7 +328,8 @@ int rc2_test(void)
|
|||||||
rc2_ecb_encrypt(tests[x].pt, tmp[0], &skey);
|
rc2_ecb_encrypt(tests[x].pt, tmp[0], &skey);
|
||||||
rc2_ecb_decrypt(tmp[0], tmp[1], &skey);
|
rc2_ecb_decrypt(tmp[0], tmp[1], &skey);
|
||||||
|
|
||||||
if (XMEMCMP(tmp[0], tests[x].ct, 8) != 0 || XMEMCMP(tmp[1], tests[x].pt, 8) != 0) {
|
if (compare_testvector(tmp[0], 8, tests[x].ct, 8, "RC2 CT", x) != 0 ||
|
||||||
|
compare_testvector(tmp[1], 8, tests[x].pt, 8, "RC2 PT", x) != 0) {
|
||||||
return CRYPT_FAIL_TESTVECTOR;
|
return CRYPT_FAIL_TESTVECTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user