diff --git a/src/crypto/crypto_module_tests.c b/src/crypto/crypto_module_tests.c index f6b37d688..42cdced3b 100644 --- a/src/crypto/crypto_module_tests.c +++ b/src/crypto/crypto_module_tests.c @@ -404,6 +404,239 @@ static int test_cbc(void) } +static int test_key_wrap(void) +{ + int ret = 0; + + /* RFC 3394 - Test vector 4.1 */ + u8 kek41[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f + }; + u8 plain41[] = { + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff + }; + u8 crypt41[] = { + 0x1F, 0xA6, 0x8B, 0x0A, 0x81, 0x12, 0xB4, 0x47, + 0xAE, 0xF3, 0x4B, 0xD8, 0xFB, 0x5A, 0x7B, 0x82, + 0x9D, 0x3E, 0x86, 0x23, 0x71, 0xD2, 0xCF, 0xE5 + }; + /* RFC 3394 - Test vector 4.2 */ + u8 kek42[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 + }; + u8 plain42[] = { + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff + }; + u8 crypt42[] = { + 0x96, 0x77, 0x8B, 0x25, 0xAE, 0x6C, 0xA4, 0x35, + 0xF9, 0x2B, 0x5B, 0x97, 0xC0, 0x50, 0xAE, 0xD2, + 0x46, 0x8A, 0xB8, 0xA1, 0x7A, 0xD8, 0x4E, 0x5D + }; + /* RFC 3394 - Test vector 4.3 */ + u8 kek43[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F + }; + u8 plain43[] = { + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff + }; + u8 crypt43[] = { + 0x64, 0xE8, 0xC3, 0xF9, 0xCE, 0x0F, 0x5B, 0xA2, + 0x63, 0xE9, 0x77, 0x79, 0x05, 0x81, 0x8A, 0x2A, + 0x93, 0xC8, 0x19, 0x1E, 0x7D, 0x6E, 0x8A, 0xE7, + }; + /* RFC 3394 - Test vector 4.4 */ + u8 kek44[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 + }; + u8 plain44[] = { + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 + }; + u8 crypt44[] = { + 0x03, 0x1D, 0x33, 0x26, 0x4E, 0x15, 0xD3, 0x32, + 0x68, 0xF2, 0x4E, 0xC2, 0x60, 0x74, 0x3E, 0xDC, + 0xE1, 0xC6, 0xC7, 0xDD, 0xEE, 0x72, 0x5A, 0x93, + 0x6B, 0xA8, 0x14, 0x91, 0x5C, 0x67, 0x62, 0xD2 + }; + /* RFC 3394 - Test vector 4.5 */ + u8 kek45[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F + }; + u8 plain45[] = { + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 + }; + u8 crypt45[] = { + 0xA8, 0xF9, 0xBC, 0x16, 0x12, 0xC6, 0x8B, 0x3F, + 0xF6, 0xE6, 0xF4, 0xFB, 0xE3, 0x0E, 0x71, 0xE4, + 0x76, 0x9C, 0x8B, 0x80, 0xA3, 0x2C, 0xB8, 0x95, + 0x8C, 0xD5, 0xD1, 0x7D, 0x6B, 0x25, 0x4D, 0xA1, + }; + /* RFC 3394 - Test vector 4.6 */ + u8 kek46[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F + }; + u8 plain46[] = { + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F + }; + u8 crypt46[] = { + 0x28, 0xC9, 0xF4, 0x04, 0xC4, 0xB8, 0x10, 0xF4, + 0xCB, 0xCC, 0xB3, 0x5C, 0xFB, 0x87, 0xF8, 0x26, + 0x3F, 0x57, 0x86, 0xE2, 0xD8, 0x0E, 0xD3, 0x26, + 0xCB, 0xC7, 0xF0, 0xE7, 0x1A, 0x99, 0xF4, 0x3B, + 0xFB, 0x98, 0x8B, 0x9B, 0x7A, 0x02, 0xDD, 0x21 + }; + u8 result[40]; + + wpa_printf(MSG_INFO, "RFC 3394 - Test vector 4.1"); + if (aes_wrap(kek41, sizeof(kek41), sizeof(plain41) / 8, plain41, + result)) { + wpa_printf(MSG_ERROR, "AES-WRAP-128 reported failure"); + ret++; + } + if (os_memcmp(result, crypt41, sizeof(crypt41)) != 0) { + wpa_printf(MSG_ERROR, "AES-WRAP-128 failed"); + ret++; + } + if (aes_unwrap(kek41, sizeof(kek41), sizeof(plain41) / 8, crypt41, + result)) { + wpa_printf(MSG_ERROR, "AES-UNWRAP-128 reported failure"); + ret++; + } + if (os_memcmp(result, plain41, sizeof(plain41)) != 0) { + wpa_printf(MSG_ERROR, "AES-UNWRAP-128 failed"); + ret++; + } + + wpa_printf(MSG_INFO, "RFC 3394 - Test vector 4.2"); + if (aes_wrap(kek42, sizeof(kek42), sizeof(plain42) / 8, plain42, + result)) { + wpa_printf(MSG_ERROR, "AES-WRAP-192 reported failure"); + ret++; + } + if (os_memcmp(result, crypt42, sizeof(crypt42)) != 0) { + wpa_printf(MSG_ERROR, "AES-WRAP-192 failed"); + ret++; + } + if (aes_unwrap(kek42, sizeof(kek42), sizeof(plain42) / 8, crypt42, + result)) { + wpa_printf(MSG_ERROR, "AES-UNWRAP-192 reported failure"); + ret++; + } + if (os_memcmp(result, plain42, sizeof(plain42)) != 0) { + wpa_printf(MSG_ERROR, "AES-UNWRAP-192 failed"); + ret++; + } + + wpa_printf(MSG_INFO, "RFC 3394 - Test vector 4.3"); + if (aes_wrap(kek43, sizeof(kek43), sizeof(plain43) / 8, plain43, + result)) { + wpa_printf(MSG_ERROR, "AES-WRAP-256 reported failure"); + ret++; + } + if (os_memcmp(result, crypt43, sizeof(crypt43)) != 0) { + wpa_printf(MSG_ERROR, "AES-WRAP-256 failed"); + ret++; + } + if (aes_unwrap(kek43, sizeof(kek43), sizeof(plain43) / 8, crypt43, + result)) { + wpa_printf(MSG_ERROR, "AES-UNWRAP-256 reported failure"); + ret++; + } + if (os_memcmp(result, plain43, sizeof(plain43)) != 0) { + wpa_printf(MSG_ERROR, "AES-UNWRAP-256 failed"); + ret++; + } + + wpa_printf(MSG_INFO, "RFC 3394 - Test vector 4.4"); + if (aes_wrap(kek44, sizeof(kek44), sizeof(plain44) / 8, plain44, + result)) { + wpa_printf(MSG_ERROR, "AES-WRAP-192 reported failure"); + ret++; + } + if (os_memcmp(result, crypt44, sizeof(crypt44)) != 0) { + wpa_printf(MSG_ERROR, "AES-WRAP-192 failed"); + ret++; + } + if (aes_unwrap(kek44, sizeof(kek44), sizeof(plain44) / 8, crypt44, + result)) { + wpa_printf(MSG_ERROR, "AES-UNWRAP-192 reported failure"); + ret++; + } + if (os_memcmp(result, plain44, sizeof(plain44)) != 0) { + wpa_printf(MSG_ERROR, "AES-UNWRAP-192 failed"); + ret++; + } + + wpa_printf(MSG_INFO, "RFC 3394 - Test vector 4.5"); + if (aes_wrap(kek45, sizeof(kek45), sizeof(plain45) / 8, plain45, + result)) { + wpa_printf(MSG_ERROR, "AES-WRAP-256 reported failure"); + ret++; + } + if (os_memcmp(result, crypt45, sizeof(crypt45)) != 0) { + wpa_printf(MSG_ERROR, "AES-WRAP-256 failed"); + ret++; + } + if (aes_unwrap(kek45, sizeof(kek45), sizeof(plain45) / 8, crypt45, + result)) { + wpa_printf(MSG_ERROR, "AES-UNWRAP-256 reported failure"); + ret++; + } + if (os_memcmp(result, plain45, sizeof(plain45)) != 0) { + wpa_printf(MSG_ERROR, "AES-UNWRAP-256 failed"); + ret++; + } + + wpa_printf(MSG_INFO, "RFC 3394 - Test vector 4.6"); + if (aes_wrap(kek46, sizeof(kek46), sizeof(plain46) / 8, plain46, + result)) { + wpa_printf(MSG_ERROR, "AES-WRAP-256 reported failure"); + ret++; + } + if (os_memcmp(result, crypt46, sizeof(crypt46)) != 0) { + wpa_printf(MSG_ERROR, "AES-WRAP-256 failed"); + ret++; + } + if (aes_unwrap(kek46, sizeof(kek46), sizeof(plain46) / 8, crypt46, + result)) { + wpa_printf(MSG_ERROR, "AES-UNWRAP-256 reported failure"); + ret++; + } + if (os_memcmp(result, plain46, sizeof(plain46)) != 0) { + wpa_printf(MSG_ERROR, "AES-UNWRAP-256 failed"); + ret++; + } + + if (!ret) + wpa_printf(MSG_INFO, "AES key wrap/unwrap test cases passed"); + + return ret; +} + + int crypto_module_tests(void) { int ret = 0; @@ -412,7 +645,8 @@ int crypto_module_tests(void) if (test_siv() || test_omac1() || test_eax() || - test_cbc()) + test_cbc() || + test_key_wrap()) ret = -1; return ret; diff --git a/tests/test-aes.c b/tests/test-aes.c index ab26179ce..9d76c07b5 100644 --- a/tests/test-aes.c +++ b/tests/test-aes.c @@ -329,258 +329,6 @@ static int test_gcm(void) } -static int test_key_wrap(void) -{ - unsigned int i; - int ret = 0; - - /* RFC 3394 - Test vector 4.1 */ - u8 kek41[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f - }; - u8 plain41[] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff - }; - u8 crypt41[] = { - 0x1F, 0xA6, 0x8B, 0x0A, 0x81, 0x12, 0xB4, 0x47, - 0xAE, 0xF3, 0x4B, 0xD8, 0xFB, 0x5A, 0x7B, 0x82, - 0x9D, 0x3E, 0x86, 0x23, 0x71, 0xD2, 0xCF, 0xE5 - }; - /* RFC 3394 - Test vector 4.2 */ - u8 kek42[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 - }; - u8 plain42[] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff - }; - u8 crypt42[] = { - 0x96, 0x77, 0x8B, 0x25, 0xAE, 0x6C, 0xA4, 0x35, - 0xF9, 0x2B, 0x5B, 0x97, 0xC0, 0x50, 0xAE, 0xD2, - 0x46, 0x8A, 0xB8, 0xA1, 0x7A, 0xD8, 0x4E, 0x5D - }; - /* RFC 3394 - Test vector 4.3 */ - u8 kek43[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F - }; - u8 plain43[] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff - }; - u8 crypt43[] = { - 0x64, 0xE8, 0xC3, 0xF9, 0xCE, 0x0F, 0x5B, 0xA2, - 0x63, 0xE9, 0x77, 0x79, 0x05, 0x81, 0x8A, 0x2A, - 0x93, 0xC8, 0x19, 0x1E, 0x7D, 0x6E, 0x8A, 0xE7, - }; - /* RFC 3394 - Test vector 4.4 */ - u8 kek44[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 - }; - u8 plain44[] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 - }; - u8 crypt44[] = { - 0x03, 0x1D, 0x33, 0x26, 0x4E, 0x15, 0xD3, 0x32, - 0x68, 0xF2, 0x4E, 0xC2, 0x60, 0x74, 0x3E, 0xDC, - 0xE1, 0xC6, 0xC7, 0xDD, 0xEE, 0x72, 0x5A, 0x93, - 0x6B, 0xA8, 0x14, 0x91, 0x5C, 0x67, 0x62, 0xD2 - }; - /* RFC 3394 - Test vector 4.5 */ - u8 kek45[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F - }; - u8 plain45[] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 - }; - u8 crypt45[] = { - 0xA8, 0xF9, 0xBC, 0x16, 0x12, 0xC6, 0x8B, 0x3F, - 0xF6, 0xE6, 0xF4, 0xFB, 0xE3, 0x0E, 0x71, 0xE4, - 0x76, 0x9C, 0x8B, 0x80, 0xA3, 0x2C, 0xB8, 0x95, - 0x8C, 0xD5, 0xD1, 0x7D, 0x6B, 0x25, 0x4D, 0xA1, - }; - /* RFC 3394 - Test vector 4.6 */ - u8 kek46[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F - }; - u8 plain46[] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F - }; - u8 crypt46[] = { - 0x28, 0xC9, 0xF4, 0x04, 0xC4, 0xB8, 0x10, 0xF4, - 0xCB, 0xCC, 0xB3, 0x5C, 0xFB, 0x87, 0xF8, 0x26, - 0x3F, 0x57, 0x86, 0xE2, 0xD8, 0x0E, 0xD3, 0x26, - 0xCB, 0xC7, 0xF0, 0xE7, 0x1A, 0x99, 0xF4, 0x3B, - 0xFB, 0x98, 0x8B, 0x9B, 0x7A, 0x02, 0xDD, 0x21 - }; - u8 result[40]; - - printf("RFC 3394 - Test vector 4.1\n"); - if (aes_wrap(kek41, sizeof(kek41), sizeof(plain41) / 8, plain41, - result)) { - printf("AES-WRAP-128 reported failure\n"); - ret++; - } - if (memcmp(result, crypt41, sizeof(crypt41)) != 0) { - printf("AES-WRAP-128 failed\n"); - ret++; - } - if (aes_unwrap(kek41, sizeof(kek41), sizeof(plain41) / 8, crypt41, - result)) { - printf("AES-UNWRAP-128 reported failure\n"); - ret++; - } - if (memcmp(result, plain41, sizeof(plain41)) != 0) { - printf("AES-UNWRAP-128 failed\n"); - ret++; - for (i = 0; i < sizeof(plain41); i++) - printf(" %02x", result[i]); - printf("\n"); - } - - printf("RFC 3394 - Test vector 4.2\n"); - if (aes_wrap(kek42, sizeof(kek42), sizeof(plain42) / 8, plain42, - result)) { - printf("AES-WRAP-192 reported failure\n"); - ret++; - } - if (memcmp(result, crypt42, sizeof(crypt42)) != 0) { - printf("AES-WRAP-192 failed\n"); - ret++; - } - if (aes_unwrap(kek42, sizeof(kek42), sizeof(plain42) / 8, crypt42, - result)) { - printf("AES-UNWRAP-192 reported failure\n"); - ret++; - } - if (memcmp(result, plain42, sizeof(plain42)) != 0) { - printf("AES-UNWRAP-192 failed\n"); - ret++; - for (i = 0; i < sizeof(plain42); i++) - printf(" %02x", result[i]); - printf("\n"); - } - - printf("RFC 3394 - Test vector 4.3\n"); - if (aes_wrap(kek43, sizeof(kek43), sizeof(plain43) / 8, plain43, - result)) { - printf("AES-WRAP-256 reported failure\n"); - ret++; - } - if (memcmp(result, crypt43, sizeof(crypt43)) != 0) { - printf("AES-WRAP-256 failed\n"); - ret++; - } - if (aes_unwrap(kek43, sizeof(kek43), sizeof(plain43) / 8, crypt43, - result)) { - printf("AES-UNWRAP-256 reported failure\n"); - ret++; - } - if (memcmp(result, plain43, sizeof(plain43)) != 0) { - printf("AES-UNWRAP-256 failed\n"); - ret++; - for (i = 0; i < sizeof(plain43); i++) - printf(" %02x", result[i]); - printf("\n"); - } - - printf("RFC 3394 - Test vector 4.4\n"); - if (aes_wrap(kek44, sizeof(kek44), sizeof(plain44) / 8, plain44, - result)) { - printf("AES-WRAP-192 reported failure\n"); - ret++; - } - if (memcmp(result, crypt44, sizeof(crypt44)) != 0) { - printf("AES-WRAP-192 failed\n"); - ret++; - } - if (aes_unwrap(kek44, sizeof(kek44), sizeof(plain44) / 8, crypt44, - result)) { - printf("AES-UNWRAP-192 reported failure\n"); - ret++; - } - if (memcmp(result, plain44, sizeof(plain44)) != 0) { - printf("AES-UNWRAP-192 failed\n"); - ret++; - for (i = 0; i < sizeof(plain44); i++) - printf(" %02x", result[i]); - printf("\n"); - } - - printf("RFC 3394 - Test vector 4.5\n"); - if (aes_wrap(kek45, sizeof(kek45), sizeof(plain45) / 8, plain45, - result)) { - printf("AES-WRAP-256 reported failure\n"); - ret++; - } - if (memcmp(result, crypt45, sizeof(crypt45)) != 0) { - printf("AES-WRAP-256 failed\n"); - ret++; - for (i = 0; i < sizeof(crypt45); i++) - printf(" %02x", result[i]); - printf("\n"); - } - if (aes_unwrap(kek45, sizeof(kek45), sizeof(plain45) / 8, crypt45, - result)) { - printf("AES-UNWRAP-256 reported failure\n"); - ret++; - } - if (memcmp(result, plain45, sizeof(plain45)) != 0) { - printf("AES-UNWRAP-256 failed\n"); - ret++; - for (i = 0; i < sizeof(plain45); i++) - printf(" %02x", result[i]); - printf("\n"); - } - - printf("RFC 3394 - Test vector 4.6\n"); - if (aes_wrap(kek46, sizeof(kek46), sizeof(plain46) / 8, plain46, - result)) { - printf("AES-WRAP-256 reported failure\n"); - ret++; - } - if (memcmp(result, crypt46, sizeof(crypt46)) != 0) { - printf("AES-WRAP-256 failed\n"); - ret++; - } - if (aes_unwrap(kek46, sizeof(kek46), sizeof(plain46) / 8, crypt46, - result)) { - printf("AES-UNWRAP-256 reported failure\n"); - ret++; - } - if (memcmp(result, plain46, sizeof(plain46)) != 0) { - printf("AES-UNWRAP-256 failed\n"); - ret++; - for (i = 0; i < sizeof(plain46); i++) - printf(" %02x", result[i]); - printf("\n"); - } - - return ret; -} - - static int test_nist_key_wrap_ae(const char *fname) { FILE *f; @@ -865,8 +613,6 @@ int main(int argc, char *argv[]) else if (argc >= 3 && os_strcmp(argv[1], "NIST-KW-AD") == 0) ret += test_nist_key_wrap_ad(argv[2]); - ret += test_key_wrap(); - test_aes_perf(); ret += test_gcm();