Commit e896feaf authored by Paul Bakker's avatar Paul Bakker
Browse files

- Added additional cases for MPI, MDx

 - Added test case set for Camellia, DES and 3-DES
parent f3eedce8
......@@ -19,3 +19,5 @@ add_test_suite(mdx)
add_test_suite(shax)
add_test_suite(hmac_shax)
add_test_suite(aes)
add_test_suite(camellia)
add_test_suite(des)
643808006803554439230129854961492699151386107534013432918073439524138264842370630061369715394739134090922937332590384720397133335969549256322620979036686633213903952966175107096769180017646161851573147596390153
Camellia-128-ECB Encrypt RFC3713 #1
camellia_encrypt_ecb:"0123456789abcdeffedcba9876543210":"0123456789abcdeffedcba9876543210":"67673138549669730857065648eabe43"
Camellia-192-ECB Encrypt RFC3713 #1
camellia_encrypt_ecb:"0123456789abcdeffedcba98765432100011223344556677":"0123456789abcdeffedcba9876543210":"b4993401b3e996f84ee5cee7d79b09b9"
Camellia-256-ECB Encrypt RFC3713 #1
camellia_encrypt_ecb:"0123456789abcdeffedcba987654321000112233445566778899aabbccddeeff":"0123456789abcdeffedcba9876543210":"9acc237dff16d76c20ef7c919e3a7509"
Camellia-128-ECB Encrypt Perl EVP #1
camellia_encrypt_ecb:"000102030405060708090A0B0C0D0E0F":"00112233445566778899AABBCCDDEEFF":"77CF412067AF8270613529149919546F"
Camellia-192-ECB Encrypt Perl EVP #1
camellia_encrypt_ecb:"000102030405060708090A0B0C0D0E0F1011121314151617":"00112233445566778899AABBCCDDEEFF":"B22F3C36B72D31329EEE8ADDC2906C68"
Camellia-256-ECB Encrypt Perl EVP #1
camellia_encrypt_ecb:"000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F":"00112233445566778899AABBCCDDEEFF":"2EDF1F3418D53B88841FC8985FB1ECF2"
Camellia-128-ECB Encrypt Perl EVP #1
camellia_encrypt_ecb:"2B7E151628AED2A6ABF7158809CF4F3C":"6BC1BEE22E409F96E93D7E117393172A":"432FC5DCD628115B7C388D770B270C96"
Camellia-128-ECB Encrypt Perl EVP #2
camellia_encrypt_ecb:"2B7E151628AED2A6ABF7158809CF4F3C":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"0BE1F14023782A22E8384C5ABB7FAB2B"
Camellia-128-ECB Encrypt Perl EVP #3
camellia_encrypt_ecb:"2B7E151628AED2A6ABF7158809CF4F3C":"30C81C46A35CE411E5FBC1191A0A52EF":"A0A1ABCD1893AB6FE0FE5B65DF5F8636"
Camellia-128-ECB Encrypt Perl EVP #4
camellia_encrypt_ecb:"2B7E151628AED2A6ABF7158809CF4F3C":"F69F2445DF4F9B17AD2B417BE66C3710":"E61925E0D5DFAA9BB29F815B3076E51A"
Camellia-192-ECB Encrypt Perl EVP #1
camellia_encrypt_ecb:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"6BC1BEE22E409F96E93D7E117393172A":"CCCC6C4E138B45848514D48D0D3439D3"
Camellia-192-ECB Encrypt Perl EVP #2
camellia_encrypt_ecb:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"5713C62C14B2EC0F8393B6AFD6F5785A"
Camellia-192-ECB Encrypt Perl EVP #3
camellia_encrypt_ecb:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"30C81C46A35CE411E5FBC1191A0A52EF":"B40ED2B60EB54D09D030CF511FEEF366"
Camellia-192-ECB Encrypt Perl EVP #4
camellia_encrypt_ecb:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"F69F2445DF4F9B17AD2B417BE66C3710":"909DBD95799096748CB27357E73E1D26"
Camellia-256-ECB Encrypt Perl EVP #1
camellia_encrypt_ecb:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"6BC1BEE22E409F96E93D7E117393172A":"BEFD219B112FA00098919CD101C9CCFA"
Camellia-256-ECB Encrypt Perl EVP #2
camellia_encrypt_ecb:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"C91D3A8F1AEA08A9386CF4B66C0169EA"
Camellia-256-ECB Encrypt Perl EVP #3
camellia_encrypt_ecb:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"30C81C46A35CE411E5FBC1191A0A52EF":"A623D711DC5F25A51BB8A80D56397D28"
Camellia-256-ECB Encrypt Perl EVP #4
camellia_encrypt_ecb:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"F69F2445DF4F9B17AD2B417BE66C3710":"7960109FB6DC42947FCFE59EA3C5EB6B"
Camellia-128-CBC Encrypt Perl EVP #1
camellia_encrypt_cbc:"2B7E151628AED2A6ABF7158809CF4F3C":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"1607CF494B36BBF00DAEB0B503C831AB"
Camellia-128-CBC Encrypt Perl EVP #2
camellia_encrypt_cbc:"2B7E151628AED2A6ABF7158809CF4F3C":"1607CF494B36BBF00DAEB0B503C831AB":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"A2F2CF671629EF7840C5A5DFB5074887"
Camellia-128-CBC Encrypt Perl EVP #3
camellia_encrypt_cbc:"2B7E151628AED2A6ABF7158809CF4F3C":"A2F2CF671629EF7840C5A5DFB5074887":"30C81C46A35CE411E5FBC1191A0A52EF":"0F06165008CF8B8B5A63586362543E54"
Camellia-128-CBC Encrypt Perl EVP #4
camellia_encrypt_cbc:"2B7E151628AED2A6ABF7158809CF4F3C":"36A84CDAFD5F9A85ADA0F0A993D6D577":"F69F2445DF4F9B17AD2B417BE66C3710":"74C64268CDB8B8FAF5B34E8AF3732980"
Camellia-192-CBC Encrypt Perl EVP #1
camellia_encrypt_cbc:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"2A4830AB5AC4A1A2405955FD2195CF93"
Camellia-192-CBC Encrypt Perl EVP #2
camellia_encrypt_cbc:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"2A4830AB5AC4A1A2405955FD2195CF93":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"5D5A869BD14CE54264F892A6DD2EC3D5"
Camellia-192-CBC Encrypt Perl EVP #3
camellia_encrypt_cbc:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"5D5A869BD14CE54264F892A6DD2EC3D5":"30C81C46A35CE411E5FBC1191A0A52EF":"37D359C3349836D884E310ADDF68C449"
Camellia-192-CBC Encrypt Perl EVP #4
camellia_encrypt_cbc:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"37D359C3349836D884E310ADDF68C449":"F69F2445DF4F9B17AD2B417BE66C3710":"01FAAA930B4AB9916E9668E1428C6B08"
Camellia-256-CBC Encrypt Perl EVP #1
camellia_encrypt_cbc:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"E6CFA35FC02B134A4D2C0B6737AC3EDA"
Camellia-256-CBC Encrypt Perl EVP #2
camellia_encrypt_cbc:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"E6CFA35FC02B134A4D2C0B6737AC3EDA":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"36CBEB73BD504B4070B1B7DE2B21EB50"
Camellia-256-CBC Encrypt Perl EVP #3
camellia_encrypt_cbc:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"36CBEB73BD504B4070B1B7DE2B21EB50":"30C81C46A35CE411E5FBC1191A0A52EF":"E31A6055297D96CA3330CDF1B1860A83"
Camellia-256-CBC Encrypt Perl EVP #4
camellia_encrypt_cbc:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"E31A6055297D96CA3330CDF1B1860A83":"F69F2445DF4F9B17AD2B417BE66C3710":"5D563F6D1CCCF236051C0C5C1C58F28F"
Camellia-128-CFB128 Encrypt Perl EVP #1
camellia_encrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"14F7646187817EB586599146B82BD719"
Camellia-128-CFB128 Encrypt Perl EVP #2
camellia_encrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"14F7646187817EB586599146B82BD719":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"A53D28BB82DF741103EA4F921A44880B"
Camellia-128-CFB128 Encrypt Perl EVP #3
camellia_encrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"A53D28BB82DF741103EA4F921A44880B":"30C81C46A35CE411E5FBC1191A0A52EF":"9C2157A664626D1DEF9EA420FDE69B96"
Camellia-128-CFB128 Encrypt Perl EVP #4
camellia_encrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"9C2157A664626D1DEF9EA420FDE69B96":"F69F2445DF4F9B17AD2B417BE66C3710":"742A25F0542340C7BAEF24CA8482BB09"
Camellia-128-CFB128 Decrypt Perl EVP #1
camellia_decrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"14F7646187817EB586599146B82BD719"
Camellia-128-CFB128 Decrypt Perl EVP #2
camellia_decrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"14F7646187817EB586599146B82BD719":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"A53D28BB82DF741103EA4F921A44880B"
Camellia-128-CFB128 Decrypt Perl EVP #3
camellia_decrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"A53D28BB82DF741103EA4F921A44880B":"30C81C46A35CE411E5FBC1191A0A52EF":"9C2157A664626D1DEF9EA420FDE69B96"
Camellia-128-CFB128 Decrypt Perl EVP #4
camellia_decrypt_cfb128:"2B7E151628AED2A6ABF7158809CF4F3C":"9C2157A664626D1DEF9EA420FDE69B96":"F69F2445DF4F9B17AD2B417BE66C3710":"742A25F0542340C7BAEF24CA8482BB09"
Camellia-192-CFB128 Encrypt Perl EVP #1
camellia_encrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"C832BB9780677DAA82D9B6860DCD565E"
Camellia-192-CFB128 Encrypt Perl EVP #2
camellia_encrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"C832BB9780677DAA82D9B6860DCD565E":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"86F8491627906D780C7A6D46EA331F98"
Camellia-192-CFB128 Encrypt Perl EVP #3
camellia_encrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"86F8491627906D780C7A6D46EA331F98":"30C81C46A35CE411E5FBC1191A0A52EF":"69511CCE594CF710CB98BB63D7221F01"
Camellia-192-CFB128 Encrypt Perl EVP #4
camellia_encrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"69511CCE594CF710CB98BB63D7221F01":"F69F2445DF4F9B17AD2B417BE66C3710":"D5B5378A3ABED55803F25565D8907B84"
Camellia-192-CFB128 Decrypt Perl EVP #1
camellia_decrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"C832BB9780677DAA82D9B6860DCD565E"
Camellia-192-CFB128 Decrypt Perl EVP #2
camellia_decrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"C832BB9780677DAA82D9B6860DCD565E":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"86F8491627906D780C7A6D46EA331F98"
Camellia-192-CFB128 Decrypt Perl EVP #3
camellia_decrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"86F8491627906D780C7A6D46EA331F98":"30C81C46A35CE411E5FBC1191A0A52EF":"69511CCE594CF710CB98BB63D7221F01"
Camellia-192-CFB128 Decrypt Perl EVP #4
camellia_decrypt_cfb128:"8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B":"69511CCE594CF710CB98BB63D7221F01":"F69F2445DF4F9B17AD2B417BE66C3710":"D5B5378A3ABED55803F25565D8907B84"
Camellia-256-CFB128 Encrypt Perl EVP #1
camellia_encrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"CF6107BB0CEA7D7FB1BD31F5E7B06C93"
Camellia-256-CFB128 Encrypt Perl EVP #2
camellia_encrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"CF6107BB0CEA7D7FB1BD31F5E7B06C93":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"89BEDB4CCDD864EA11BA4CBE849B5E2B"
Camellia-256-CFB128 Encrypt Perl EVP #3
camellia_encrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"89BEDB4CCDD864EA11BA4CBE849B5E2B":"30C81C46A35CE411E5FBC1191A0A52EF":"555FC3F34BDD2D54C62D9E3BF338C1C4"
Camellia-256-CFB128 Encrypt Perl EVP #4
camellia_encrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"555FC3F34BDD2D54C62D9E3BF338C1C4":"F69F2445DF4F9B17AD2B417BE66C3710":"5953ADCE14DB8C7F39F1BD39F359BFFA"
Camellia-256-CFB128 Decrypt Perl EVP #1
camellia_decrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"000102030405060708090A0B0C0D0E0F":"6BC1BEE22E409F96E93D7E117393172A":"CF6107BB0CEA7D7FB1BD31F5E7B06C93"
Camellia-256-CFB128 Decrypt Perl EVP #2
camellia_decrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"CF6107BB0CEA7D7FB1BD31F5E7B06C93":"AE2D8A571E03AC9C9EB76FAC45AF8E51":"89BEDB4CCDD864EA11BA4CBE849B5E2B"
Camellia-256-CFB128 Decrypt Perl EVP #3
camellia_decrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"89BEDB4CCDD864EA11BA4CBE849B5E2B":"30C81C46A35CE411E5FBC1191A0A52EF":"555FC3F34BDD2D54C62D9E3BF338C1C4"
Camellia-256-CFB128 Decrypt Perl EVP #4
camellia_decrypt_cfb128:"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4":"555FC3F34BDD2D54C62D9E3BF338C1C4":"F69F2445DF4F9B17AD2B417BE66C3710":"5953ADCE14DB8C7F39F1BD39F359BFFA"
Camellia Selftest
camellia_selftest:
BEGIN_HEADER
#include <polarssl/camellia.h>
END_HEADER
BEGIN_CASE
camellia_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string
{
unsigned char key_str[100];
unsigned char src_str[100];
unsigned char dst_str[100];
unsigned char output[100];
camellia_context ctx;
memset(key_str, 0x00, 100);
memset(src_str, 0x00, 100);
memset(dst_str, 0x00, 100);
memset(output, 0x00, 100);
int key_len = unhexify( key_str, {hex_key_string} );
unhexify( src_str, {hex_src_string} );
camellia_setkey_enc( &ctx, key_str, key_len * 8 );
camellia_crypt_ecb( &ctx, CAMELLIA_ENCRYPT, src_str, output );
hexify( dst_str, output, 16 );
TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 );
}
END_CASE
BEGIN_CASE
camellia_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string
{
unsigned char key_str[100];
unsigned char src_str[100];
unsigned char dst_str[100];
unsigned char output[100];
camellia_context ctx;
memset(key_str, 0x00, 100);
memset(src_str, 0x00, 100);
memset(dst_str, 0x00, 100);
memset(output, 0x00, 100);
int key_len = unhexify( key_str, {hex_key_string} );
unhexify( src_str, {hex_src_string} );
camellia_setkey_dec( &ctx, key_str, key_len * 8 );
camellia_crypt_ecb( &ctx, CAMELLIA_DECRYPT, src_str, output );
hexify( dst_str, output, 16 );
TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 );
}
END_CASE
BEGIN_CASE
camellia_encrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string
{
unsigned char key_str[100];
unsigned char iv_str[100];
unsigned char src_str[100];
unsigned char dst_str[100];
unsigned char output[100];
camellia_context ctx;
memset(key_str, 0x00, 100);
memset(iv_str, 0x00, 100);
memset(src_str, 0x00, 100);
memset(dst_str, 0x00, 100);
memset(output, 0x00, 100);
int key_len = unhexify( key_str, {hex_key_string} );
unhexify( iv_str, {hex_iv_string} );
unhexify( src_str, {hex_src_string} );
camellia_setkey_enc( &ctx, key_str, key_len * 8 );
camellia_crypt_cbc( &ctx, CAMELLIA_ENCRYPT, 16, iv_str, src_str, output );
hexify( dst_str, output, 16 );
TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 );
}
END_CASE
BEGIN_CASE
camellia_decrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string
{
unsigned char key_str[100];
unsigned char iv_str[100];
unsigned char src_str[100];
unsigned char dst_str[100];
unsigned char output[100];
camellia_context ctx;
memset(key_str, 0x00, 100);
memset(iv_str, 0x00, 100);
memset(src_str, 0x00, 100);
memset(dst_str, 0x00, 100);
memset(output, 0x00, 100);
int key_len = unhexify( key_str, {hex_key_string} );
unhexify( iv_str, {hex_iv_string} );
unhexify( src_str, {hex_src_string} );
camellia_setkey_dec( &ctx, key_str, key_len * 8 );
camellia_crypt_cbc( &ctx, CAMELLIA_DECRYPT, 16, iv_str, src_str, output );
hexify( dst_str, output, 16 );
TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 );
}
END_CASE
BEGIN_CASE
camellia_encrypt_cfb128:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string
{
unsigned char key_str[100];
unsigned char iv_str[100];
unsigned char src_str[100];
unsigned char dst_str[100];
unsigned char output[100];
camellia_context ctx;
int iv_offset = 0;
memset(key_str, 0x00, 100);
memset(iv_str, 0x00, 100);
memset(src_str, 0x00, 100);
memset(dst_str, 0x00, 100);
memset(output, 0x00, 100);
int key_len = unhexify( key_str, {hex_key_string} );
unhexify( iv_str, {hex_iv_string} );
unhexify( src_str, {hex_src_string} );
camellia_setkey_enc( &ctx, key_str, key_len * 8 );
camellia_crypt_cfb128( &ctx, CAMELLIA_ENCRYPT, 16, &iv_offset, iv_str, src_str, output );
hexify( dst_str, output, 16 );
TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 );
}
END_CASE
BEGIN_CASE
camellia_decrypt_cfb128:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string
{
unsigned char key_str[100];
unsigned char iv_str[100];
unsigned char src_str[100];
unsigned char dst_str[100];
unsigned char output[100];
camellia_context ctx;
int iv_offset = 0;
memset(key_str, 0x00, 100);
memset(iv_str, 0x00, 100);
memset(src_str, 0x00, 100);
memset(dst_str, 0x00, 100);
memset(output, 0x00, 100);
int key_len = unhexify( key_str, {hex_key_string} );
unhexify( iv_str, {hex_iv_string} );
unhexify( src_str, {hex_src_string} );
camellia_setkey_enc( &ctx, key_str, key_len * 8 );
camellia_crypt_cfb128( &ctx, CAMELLIA_DECRYPT, 16, &iv_offset, iv_str, src_str, output );
hexify( dst_str, output, 16 );
TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 );
}
END_CASE
BEGIN_CASE
camellia_selftest:
{
TEST_ASSERT( camellia_self_test( 0 ) == 0 );
}
END_CASE
DES Encrypt OpenSSL Test Vector #1
des_encrypt_ecb:"0000000000000000":"0000000000000000":"8CA64DE9C1B123A7"
DES Encrypt OpenSSL Test Vector #2
des_encrypt_ecb:"FFFFFFFFFFFFFFFF":"FFFFFFFFFFFFFFFF":"7359B2163E4EDC58"
DES Encrypt OpenSSL Test Vector #3
des_encrypt_ecb:"3000000000000000":"1000000000000001":"958E6E627A05557B"
DES Encrypt OpenSSL Test Vector #4
des_encrypt_ecb:"1111111111111111":"1111111111111111":"F40379AB9E0EC533"
DES Encrypt OpenSSL Test Vector #5
des_encrypt_ecb:"0123456789ABCDEF":"1111111111111111":"17668DFC7292532D"
DES Encrypt OpenSSL Test Vector #6
des_encrypt_ecb:"1111111111111111":"0123456789ABCDEF":"8A5AE1F81AB8F2DD"
DES Encrypt OpenSSL Test Vector #7
des_encrypt_ecb:"0000000000000000":"0000000000000000":"8CA64DE9C1B123A7"
DES Encrypt OpenSSL Test Vector #8
des_encrypt_ecb:"FEDCBA9876543210":"0123456789ABCDEF":"ED39D950FA74BCC4"
DES Encrypt OpenSSL Test Vector #9
des_encrypt_ecb:"7CA110454A1A6E57":"01A1D6D039776742":"690F5B0D9A26939B"
DES Encrypt OpenSSL Test Vector #10
des_encrypt_ecb:"0131D9619DC1376E":"5CD54CA83DEF57DA":"7A389D10354BD271"
DES Encrypt OpenSSL Test Vector #11
des_encrypt_ecb:"07A1133E4A0B2686":"0248D43806F67172":"868EBB51CAB4599A"
DES Encrypt OpenSSL Test Vector #12
des_encrypt_ecb:"3849674C2602319E":"51454B582DDF440A":"7178876E01F19B2A"
DES Encrypt OpenSSL Test Vector #13
des_encrypt_ecb:"04B915BA43FEB5B6":"42FD443059577FA2":"AF37FB421F8C4095"
DES Encrypt OpenSSL Test Vector #14
des_encrypt_ecb:"0113B970FD34F2CE":"059B5E0851CF143A":"86A560F10EC6D85B"
DES Encrypt OpenSSL Test Vector #15
des_encrypt_ecb:"0170F175468FB5E6":"0756D8E0774761D2":"0CD3DA020021DC09"
DES Encrypt OpenSSL Test Vector #16
des_encrypt_ecb:"43297FAD38E373FE":"762514B829BF486A":"EA676B2CB7DB2B7A"
DES Encrypt OpenSSL Test Vector #17
des_encrypt_ecb:"07A7137045DA2A16":"3BDD119049372802":"DFD64A815CAF1A0F"
DES Encrypt OpenSSL Test Vector #18
des_encrypt_ecb:"04689104C2FD3B2F":"26955F6835AF609A":"5C513C9C4886C088"
DES Encrypt OpenSSL Test Vector #19
des_encrypt_ecb:"37D06BB516CB7546":"164D5E404F275232":"0A2AEEAE3FF4AB77"
DES Encrypt OpenSSL Test Vector #20
des_encrypt_ecb:"1F08260D1AC2465E":"6B056E18759F5CCA":"EF1BF03E5DFA575A"
DES Encrypt OpenSSL Test Vector #21
des_encrypt_ecb:"584023641ABA6176":"004BD6EF09176062":"88BF0DB6D70DEE56"
DES Encrypt OpenSSL Test Vector #22
des_encrypt_ecb:"025816164629B007":"480D39006EE762F2":"A1F9915541020B56"
DES Encrypt OpenSSL Test Vector #23
des_encrypt_ecb:"49793EBC79B3258F":"437540C8698F3CFA":"6FBF1CAFCFFD0556"
DES Encrypt OpenSSL Test Vector #24
des_encrypt_ecb:"4FB05E1515AB73A7":"072D43A077075292":"2F22E49BAB7CA1AC"
DES Encrypt OpenSSL Test Vector #25
des_encrypt_ecb:"49E95D6D4CA229BF":"02FE55778117F12A":"5A6B612CC26CCE4A"
DES Encrypt OpenSSL Test Vector #26
des_encrypt_ecb:"018310DC409B26D6":"1D9D5C5018F728C2":"5F4C038ED12B2E41"
DES Encrypt OpenSSL Test Vector #27
des_encrypt_ecb:"1C587F1C13924FEF":"305532286D6F295A":"63FAC0D034D9F793"
DES Encrypt OpenSSL Test Vector #28
des_encrypt_ecb:"0101010101010101":"0123456789ABCDEF":"617B3A0CE8F07100"
DES Encrypt OpenSSL Test Vector #29
des_encrypt_ecb:"1F1F1F1F0E0E0E0E":"0123456789ABCDEF":"DB958605F8C8C606"
DES Encrypt OpenSSL Test Vector #30
des_encrypt_ecb:"E0FEE0FEF1FEF1FE":"0123456789ABCDEF":"EDBFD1C66C29CCC7"
DES Encrypt OpenSSL Test Vector #31
des_encrypt_ecb:"0000000000000000":"FFFFFFFFFFFFFFFF":"355550B2150E2451"
DES Encrypt OpenSSL Test Vector #32
des_encrypt_ecb:"FFFFFFFFFFFFFFFF":"0000000000000000":"CAAAAF4DEAF1DBAE"
DES Encrypt OpenSSL Test Vector #33
des_encrypt_ecb:"0123456789ABCDEF":"0000000000000000":"D5D44FF720683D0D"
DES Encrypt OpenSSL Test Vector #34
des_encrypt_ecb:"FEDCBA9876543210":"FFFFFFFFFFFFFFFF":"2A2BB008DF97C2F2"
DES Decrypt OpenSSL Test Vector #1
des_decrypt_ecb:"0000000000000000":"8CA64DE9C1B123A7":"0000000000000000"
DES Decrypt OpenSSL Test Vector #2
des_decrypt_ecb:"FFFFFFFFFFFFFFFF":"7359B2163E4EDC58":"FFFFFFFFFFFFFFFF"
DES Decrypt OpenSSL Test Vector #3
des_decrypt_ecb:"3000000000000000":"958E6E627A05557B":"1000000000000001"
DES Decrypt OpenSSL Test Vector #4
des_decrypt_ecb:"1111111111111111":"F40379AB9E0EC533":"1111111111111111"
DES Decrypt OpenSSL Test Vector #5
des_decrypt_ecb:"0123456789ABCDEF":"17668DFC7292532D":"1111111111111111"
DES Decrypt OpenSSL Test Vector #6
des_decrypt_ecb:"1111111111111111":"8A5AE1F81AB8F2DD":"0123456789ABCDEF"
DES Decrypt OpenSSL Test Vector #7
des_decrypt_ecb:"0000000000000000":"8CA64DE9C1B123A7":"0000000000000000"
DES Decrypt OpenSSL Test Vector #8
des_decrypt_ecb:"FEDCBA9876543210":"ED39D950FA74BCC4":"0123456789ABCDEF"
DES Decrypt OpenSSL Test Vector #9
des_decrypt_ecb:"7CA110454A1A6E57":"690F5B0D9A26939B":"01A1D6D039776742"
DES Decrypt OpenSSL Test Vector #10
des_decrypt_ecb:"0131D9619DC1376E":"7A389D10354BD271":"5CD54CA83DEF57DA"
DES Decrypt OpenSSL Test Vector #11
des_decrypt_ecb:"07A1133E4A0B2686":"868EBB51CAB4599A":"0248D43806F67172"
DES Decrypt OpenSSL Test Vector #12
des_decrypt_ecb:"3849674C2602319E":"7178876E01F19B2A":"51454B582DDF440A"
DES Decrypt OpenSSL Test Vector #13
des_decrypt_ecb:"04B915BA43FEB5B6":"AF37FB421F8C4095":"42FD443059577FA2"
DES Decrypt OpenSSL Test Vector #14
des_decrypt_ecb:"0113B970FD34F2CE":"86A560F10EC6D85B":"059B5E0851CF143A"
DES Decrypt OpenSSL Test Vector #15
des_decrypt_ecb:"0170F175468FB5E6":"0CD3DA020021DC09":"0756D8E0774761D2"
DES Decrypt OpenSSL Test Vector #16
des_decrypt_ecb:"43297FAD38E373FE":"EA676B2CB7DB2B7A":"762514B829BF486A"
DES Decrypt OpenSSL Test Vector #17
des_decrypt_ecb:"07A7137045DA2A16":"DFD64A815CAF1A0F":"3BDD119049372802"
DES Decrypt OpenSSL Test Vector #18
des_decrypt_ecb:"04689104C2FD3B2F":"5C513C9C4886C088":"26955F6835AF609A"
DES Decrypt OpenSSL Test Vector #19
des_decrypt_ecb:"37D06BB516CB7546":"0A2AEEAE3FF4AB77":"164D5E404F275232"
DES Decrypt OpenSSL Test Vector #20
des_decrypt_ecb:"1F08260D1AC2465E":"EF1BF03E5DFA575A":"6B056E18759F5CCA"
DES Decrypt OpenSSL Test Vector #21
des_decrypt_ecb:"584023641ABA6176":"88BF0DB6D70DEE56":"004BD6EF09176062"
DES Decrypt OpenSSL Test Vector #22
des_decrypt_ecb:"025816164629B007":"A1F9915541020B56":"480D39006EE762F2"
DES Decrypt OpenSSL Test Vector #23
des_decrypt_ecb:"49793EBC79B3258F":"6FBF1CAFCFFD0556":"437540C8698F3CFA"
DES Decrypt OpenSSL Test Vector #24
des_decrypt_ecb:"4FB05E1515AB73A7":"2F22E49BAB7CA1AC":"072D43A077075292"
DES Decrypt OpenSSL Test Vector #25
des_decrypt_ecb:"49E95D6D4CA229BF":"5A6B612CC26CCE4A":"02FE55778117F12A"
DES Decrypt OpenSSL Test Vector #26
des_decrypt_ecb:"018310DC409B26D6":"5F4C038ED12B2E41":"1D9D5C5018F728C2"
DES Decrypt OpenSSL Test Vector #27
des_decrypt_ecb:"1C587F1C13924FEF":"63FAC0D034D9F793":"305532286D6F295A"
DES Decrypt OpenSSL Test Vector #28
des_decrypt_ecb:"0101010101010101":"617B3A0CE8F07100":"0123456789ABCDEF"
DES Decrypt OpenSSL Test Vector #29
des_decrypt_ecb:"1F1F1F1F0E0E0E0E":"DB958605F8C8C606":"0123456789ABCDEF"
DES Decrypt OpenSSL Test Vector #30
des_decrypt_ecb:"E0FEE0FEF1FEF1FE":"EDBFD1C66C29CCC7":"0123456789ABCDEF"
DES Decrypt OpenSSL Test Vector #31
des_decrypt_ecb:"0000000000000000":"355550B2150E2451":"FFFFFFFFFFFFFFFF"
DES Decrypt OpenSSL Test Vector #32
des_decrypt_ecb:"FFFFFFFFFFFFFFFF":"CAAAAF4DEAF1DBAE":"0000000000000000"
DES Decrypt OpenSSL Test Vector #33
des_decrypt_ecb:"0123456789ABCDEF":"D5D44FF720683D0D":"0000000000000000"
DES Decrypt OpenSSL Test Vector #34
des_decrypt_ecb:"FEDCBA9876543210":"2A2BB008DF97C2F2":"FFFFFFFFFFFFFFFF"
DES-CBC Encrypt OpenSSL Test Vector #1
des_encrypt_cbc:"0123456789abcdef":"fedcba9876543210":"37363534333231204E6F77206973207468652074696D6520":"ccd173ffab2039f4acd8aefddfd8a1eb468e91157888ba68"
DES-CBC Decrypt OpenSSL Test Vector #1
des_decrypt_cbc:"0123456789abcdef":"fedcba9876543210":"ccd173ffab2039f4acd8aefddfd8a1eb468e91157888ba68":"37363534333231204E6F77206973207468652074696D6520"
3DES-ECB 2Key Encrypt OpenSSL Test Vector #1
des3_encrypt_ecb:2:"0000000000000000FFFFFFFFFFFFFFFF":"0000000000000000":"9295B59BB384736E"
3DES-ECB 2Key Encrypt OpenSSL Test Vector #2
des3_encrypt_ecb:2:"FFFFFFFFFFFFFFFF3000000000000000":"FFFFFFFFFFFFFFFF":"199E9D6DF39AA816"
3DES-ECB 2Key Decrypt OpenSSL Test Vector #1
des3_decrypt_ecb:2:"0000000000000000FFFFFFFFFFFFFFFF":"9295B59BB384736E":"0000000000000000"
3DES-ECB 2Key Decrypt OpenSSL Test Vector #2
des3_decrypt_ecb:2:"FFFFFFFFFFFFFFFF3000000000000000":"199E9D6DF39AA816":"FFFFFFFFFFFFFFFF"
3DES-CBC 3Key Encrypt OpenSSL Test Vector #1
des3_encrypt_cbc:3:"0123456789abcdeff1e0d3c2b5a49786fedcba9876543210":"fedcba9876543210":"37363534333231204E6F77206973207468652074696D6520":"3FE301C962AC01D02213763C1CBD4CDC799657C064ECF5D4"
3DES-CBC 3Key Decrypt OpenSSL Test Vector #1
des3_decrypt_cbc:3:"0123456789abcdeff1e0d3c2b5a49786fedcba9876543210":"fedcba9876543210":"3FE301C962AC01D02213763C1CBD4CDC799657C064ECF5D4":"37363534333231204E6F77206973207468652074696D6520"
DES Selftest
des_selftest:
BEGIN_HEADER
#include <polarssl/des.h>
END_HEADER
BEGIN_CASE
des_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string
{
unsigned char key_str[100];
unsigned char src_str[100];
unsigned char dst_str[100];
unsigned char output[100];
des_context ctx;
memset(key_str, 0x00, 100);
memset(src_str, 0x00, 100);
memset(dst_str, 0x00, 100);
memset(output, 0x00, 100);
unhexify( key_str, {hex_key_string} );
unhexify( src_str, {hex_src_string} );
des_setkey_enc( &ctx, key_str );
des_crypt_ecb( &ctx, src_str, output );
hexify( dst_str, output, 8 );
TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 );
}
END_CASE
BEGIN_CASE
des_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string
{
unsigned char key_str[100];
unsigned char src_str[100];
unsigned char dst_str[100];
unsigned char output[100];
des_context ctx;
memset(key_str, 0x00, 100);
memset(src_str, 0x00, 100);
memset(dst_str, 0x00, 100);
memset(output, 0x00, 100);
unhexify( key_str, {hex_key_string} );
unhexify( src_str, {hex_src_string} );
des_setkey_dec( &ctx, key_str );
des_crypt_ecb( &ctx, src_str, output );
hexify( dst_str, output, 8 );
TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 );
}
END_CASE
BEGIN_CASE
des_encrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string