From: Pablo de Lara Date: Tue, 4 Jul 2017 00:12:42 +0000 (+0100) Subject: test/crypto: add AES-GCM 192 X-Git-Tag: spdx-start~2663 X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=677acfe5da8cb0d2af46694e66eccc71e0e5260f test/crypto: add AES-GCM 192 Added AES GCM tests for 192-bit keys, now that AES GCM PMD supports it. Signed-off-by: Pablo de Lara Acked-by: Sergio Gonzalez Monroy --- diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c index bc83caf884..8978f8c392 100644 --- a/test/test/test_cryptodev.c +++ b/test/test/test_cryptodev.c @@ -4954,6 +4954,48 @@ test_AES_GCM_authenticated_encryption_test_case_7(void) return test_AES_GCM_authenticated_encryption(&gcm_test_case_7); } +static int +test_AES_GCM_auth_encryption_test_case_192_1(void) +{ + return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_1); +} + +static int +test_AES_GCM_auth_encryption_test_case_192_2(void) +{ + return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_2); +} + +static int +test_AES_GCM_auth_encryption_test_case_192_3(void) +{ + return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_3); +} + +static int +test_AES_GCM_auth_encryption_test_case_192_4(void) +{ + return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_4); +} + +static int +test_AES_GCM_auth_encryption_test_case_192_5(void) +{ + return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_5); +} + +static int +test_AES_GCM_auth_encryption_test_case_192_6(void) +{ + return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_6); +} + +static int +test_AES_GCM_auth_encryption_test_case_192_7(void) +{ + return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_7); +} + static int test_AES_GCM_auth_encryption_test_case_256_1(void) { @@ -5120,6 +5162,48 @@ test_AES_GCM_authenticated_decryption_test_case_7(void) return test_AES_GCM_authenticated_decryption(&gcm_test_case_7); } +static int +test_AES_GCM_auth_decryption_test_case_192_1(void) +{ + return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_1); +} + +static int +test_AES_GCM_auth_decryption_test_case_192_2(void) +{ + return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_2); +} + +static int +test_AES_GCM_auth_decryption_test_case_192_3(void) +{ + return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_3); +} + +static int +test_AES_GCM_auth_decryption_test_case_192_4(void) +{ + return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_4); +} + +static int +test_AES_GCM_auth_decryption_test_case_192_5(void) +{ + return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_5); +} + +static int +test_AES_GCM_auth_decryption_test_case_192_6(void) +{ + return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_6); +} + +static int +test_AES_GCM_auth_decryption_test_case_192_7(void) +{ + return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_7); +} + static int test_AES_GCM_auth_decryption_test_case_256_1(void) { @@ -8033,6 +8117,38 @@ static struct unit_test_suite cryptodev_aesni_gcm_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_AES_GCM_authenticated_decryption_test_case_7), + /** AES GCM Authenticated Encryption 192 bits key */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_192_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_192_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_192_3), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_192_4), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_192_5), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_192_6), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_encryption_test_case_192_7), + + /** AES GCM Authenticated Decryption 192 bits key */ + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_192_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_192_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_192_3), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_192_4), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_192_5), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_192_6), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_GCM_auth_decryption_test_case_192_7), + /** AES GCM Authenticated Encryption 256 bits key */ TEST_CASE_ST(ut_setup, ut_teardown, test_AES_GCM_auth_encryption_test_case_256_1), diff --git a/test/test/test_cryptodev_gcm_test_vectors.h b/test/test/test_cryptodev_gcm_test_vectors.h index ac4b0d4836..7879c35b45 100644 --- a/test/test/test_cryptodev_gcm_test_vectors.h +++ b/test/test/test_cryptodev_gcm_test_vectors.h @@ -997,6 +997,363 @@ static const struct gcm_test_data gcm_test_case_8 = { } }; +/** AES-192 Test Vectors */ +static const struct gcm_test_data gcm_test_case_192_1 = { + .key = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + .len = 24 + }, + .iv = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + .len = 12 + }, + .aad = { + .data = gcm_aad_zero_text, + .len = 0 + }, + .plaintext = { + .data = { 0x00 }, + .len = 0 + }, + .ciphertext = { + .data = { 0x00 }, + .len = 0 + }, + .auth_tag = { + .data = { + 0xCD, 0x33, 0xB2, 0x8A, 0xC7, 0x73, 0xF7, 0x4B, + 0xA0, 0x0E, 0xD1, 0xF3, 0x12, 0x57, 0x24, 0x35 + }, + .len = 16 + } +}; + +static const struct gcm_test_data gcm_test_case_192_2 = { + .key = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + .len = 24 + }, + .iv = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + .len = 12 + }, + .aad = { + .data = gcm_aad_zero_text, + .len = 0 + }, + .plaintext = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .ciphertext = { + .data = { + 0x98, 0xE7, 0x24, 0x7C, 0x07, 0xF0, 0xFE, 0x41, + 0x1C, 0x26, 0x7E, 0x43, 0x84, 0xB0, 0xF6, 0x00 + }, + .len = 16 + }, + .auth_tag = { + .data = { + 0x2F, 0xF5, 0x8D, 0x80, 0x03, 0x39, 0x27, 0xAB, + 0x8E, 0xF4, 0xD4, 0x58, 0x75, 0x14, 0xF0, 0xFB + + }, + .len = 16 + } +}; + +static const struct gcm_test_data gcm_test_case_192_3 = { + .key = { + .data = { + 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, + 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08, + 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C + }, + .len = 24 + }, + .iv = { + .data = { + 0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD, + 0xDE, 0xCA, 0xF8, 0x88 + }, + .len = 12 + }, + .aad = { + .data = gcm_aad_zero_text, + .len = 0 + }, + .plaintext = { + .data = { + 0xD9, 0x31, 0x32, 0x25, 0xF8, 0x84, 0x06, 0xE5, + 0xA5, 0x59, 0x09, 0xC5, 0xAF, 0xF5, 0x26, 0x9A, + 0x86, 0xA7, 0xA9, 0x53, 0x15, 0x34, 0xF7, 0xDA, + 0x2E, 0x4C, 0x30, 0x3D, 0x8A, 0x31, 0x8A, 0x72, + 0x1C, 0x3C, 0x0C, 0x95, 0x95, 0x68, 0x09, 0x53, + 0x2F, 0xCF, 0x0E, 0x24, 0x49, 0xA6, 0xB5, 0x25, + 0xB1, 0x6A, 0xED, 0xF5, 0xAA, 0x0D, 0xE6, 0x57, + 0xBA, 0x63, 0x7B, 0x39, 0x1A, 0xAF, 0xD2, 0x55 + }, + .len = 64 + }, + .ciphertext = { + .data = { + 0x39, 0x80, 0xCA, 0x0B, 0x3C, 0x00, 0xE8, 0x41, + 0xEB, 0x06, 0xFA, 0xC4, 0x87, 0x2A, 0x27, 0x57, + 0x85, 0x9E, 0x1C, 0xEA, 0xA6, 0xEF, 0xD9, 0x84, + 0x62, 0x85, 0x93, 0xB4, 0x0C, 0xA1, 0xE1, 0x9C, + 0x7D, 0x77, 0x3D, 0x00, 0xC1, 0x44, 0xC5, 0x25, + 0xAC, 0x61, 0x9D, 0x18, 0xC8, 0x4A, 0x3F, 0x47, + 0x18, 0xE2, 0x44, 0x8B, 0x2F, 0xE3, 0x24, 0xD9, + 0xCC, 0xDA, 0x27, 0x10, 0xAC, 0xAD, 0xE2, 0x56 + }, + .len = 64 + }, + .auth_tag = { + .data = { + 0x99, 0x24, 0xA7, 0xC8, 0x58, 0x73, 0x36, 0xBF, + 0xB1, 0x18, 0x02, 0x4D, 0xB8, 0x67, 0x4A, 0x14 + }, + .len = 16 + } +}; + +static const struct gcm_test_data gcm_test_case_192_4 = { + .key = { + .data = { + 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, + 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08, + 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C + }, + .len = 24 + }, + .iv = { + .data = { + 0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD, + 0xDE, 0xCA, 0xF8, 0x88 + }, + .len = 12 + }, + .aad = { + .data = gcm_aad_zero_text, + .len = 8 + }, + .plaintext = { + .data = { + 0xD9, 0x31, 0x32, 0x25, 0xF8, 0x84, 0x06, 0xE5, + 0xA5, 0x59, 0x09, 0xC5, 0xAF, 0xF5, 0x26, 0x9A, + 0x86, 0xA7, 0xA9, 0x53, 0x15, 0x34, 0xF7, 0xDA, + 0x2E, 0x4C, 0x30, 0x3D, 0x8A, 0x31, 0x8A, 0x72, + 0x1C, 0x3C, 0x0C, 0x95, 0x95, 0x68, 0x09, 0x53, + 0x2F, 0xCF, 0x0E, 0x24, 0x49, 0xA6, 0xB5, 0x25, + 0xB1, 0x6A, 0xED, 0xF5, 0xAA, 0x0D, 0xE6, 0x57, + 0xBA, 0x63, 0x7B, 0x39 + }, + .len = 60 + }, + .ciphertext = { + .data = { + 0x39, 0x80, 0xCA, 0x0B, 0x3C, 0x00, 0xE8, 0x41, + 0xEB, 0x06, 0xFA, 0xC4, 0x87, 0x2A, 0x27, 0x57, + 0x85, 0x9E, 0x1C, 0xEA, 0xA6, 0xEF, 0xD9, 0x84, + 0x62, 0x85, 0x93, 0xB4, 0x0C, 0xA1, 0xE1, 0x9C, + 0x7D, 0x77, 0x3D, 0x00, 0xC1, 0x44, 0xC5, 0x25, + 0xAC, 0x61, 0x9D, 0x18, 0xC8, 0x4A, 0x3F, 0x47, + 0x18, 0xE2, 0x44, 0x8B, 0x2F, 0xE3, 0x24, 0xD9, + 0xCC, 0xDA, 0x27, 0x10 + }, + .len = 60 + }, + .auth_tag = { + .data = { + 0x57, 0x5F, 0x03, 0xA0, 0x8D, 0x8F, 0x40, 0x26, + 0xE5, 0x64, 0x1F, 0x5B, 0x5C, 0xC2, 0xFD, 0x4B + }, + .len = 16 + } +}; + +static const struct gcm_test_data gcm_test_case_192_5 = { + .key = { + .data = { + 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, + 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08, + 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C + }, + .len = 24 + }, + .iv = { + .data = { + 0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD, + 0xDE, 0xCA, 0xF8, 0x88 + }, + .len = 12 + }, + .aad = { + .data = gcm_aad_text, + .len = 8 + }, + .plaintext = { + .data = { + 0xD9, 0x31, 0x32, 0x25, 0xF8, 0x84, 0x06, 0xE5, + 0xA5, 0x59, 0x09, 0xC5, 0xAF, 0xF5, 0x26, 0x9A, + 0x86, 0xA7, 0xA9, 0x53, 0x15, 0x34, 0xF7, 0xDA, + 0x2E, 0x4C, 0x30, 0x3D, 0x8A, 0x31, 0x8A, 0x72, + 0x1C, 0x3C, 0x0C, 0x95, 0x95, 0x68, 0x09, 0x53, + 0x2F, 0xCF, 0x0E, 0x24, 0x49, 0xA6, 0xB5, 0x25, + 0xB1, 0x6A, 0xED, 0xF5, 0xAA, 0x0D, 0xE6, 0x57, + 0xBA, 0x63, 0x7B, 0x39 + }, + .len = 60 + }, + .ciphertext = { + .data = { + 0x39, 0x80, 0xCA, 0x0B, 0x3C, 0x00, 0xE8, 0x41, + 0xEB, 0x06, 0xFA, 0xC4, 0x87, 0x2A, 0x27, 0x57, + 0x85, 0x9E, 0x1C, 0xEA, 0xA6, 0xEF, 0xD9, 0x84, + 0x62, 0x85, 0x93, 0xB4, 0x0C, 0xA1, 0xE1, 0x9C, + 0x7D, 0x77, 0x3D, 0x00, 0xC1, 0x44, 0xC5, 0x25, + 0xAC, 0x61, 0x9D, 0x18, 0xC8, 0x4A, 0x3F, 0x47, + 0x18, 0xE2, 0x44, 0x8B, 0x2F, 0xE3, 0x24, 0xD9, + 0xCC, 0xDA, 0x27, 0x10 + }, + .len = 60 + }, + .auth_tag = { + .data = { + 0xB6, 0x35, 0x56, 0xE7, 0xBA, 0x46, 0xA3, 0x38, + 0xED, 0xAD, 0x79, 0x9F, 0xB3, 0x5B, 0x34, 0xA8 + }, + .len = 16 + } +}; + +static const struct gcm_test_data gcm_test_case_192_6 = { + .key = { + .data = { + 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, + 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08, + 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C + }, + .len = 24 + }, + .iv = { + .data = { + 0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD, + 0xDE, 0xCA, 0xF8, 0x88 + }, + .len = 12 + }, + .aad = { + .data = gcm_aad_zero_text, + .len = 12 + }, + .plaintext = { + .data = { + 0xD9, 0x31, 0x32, 0x25, 0xF8, 0x84, 0x06, 0xE5, + 0xA5, 0x59, 0x09, 0xC5, 0xAF, 0xF5, 0x26, 0x9A, + 0x86, 0xA7, 0xA9, 0x53, 0x15, 0x34, 0xF7, 0xDA, + 0x2E, 0x4C, 0x30, 0x3D, 0x8A, 0x31, 0x8A, 0x72, + 0x1C, 0x3C, 0x0C, 0x95, 0x95, 0x68, 0x09, 0x53, + 0x2F, 0xCF, 0x0E, 0x24, 0x49, 0xA6, 0xB5, 0x25, + 0xB1, 0x6A, 0xED, 0xF5, 0xAA, 0x0D, 0xE6, 0x57, + 0xBA, 0x63, 0x7B, 0x39 + }, + .len = 60 + }, + .ciphertext = { + .data = { + 0x39, 0x80, 0xCA, 0x0B, 0x3C, 0x00, 0xE8, 0x41, + 0xEB, 0x06, 0xFA, 0xC4, 0x87, 0x2A, 0x27, 0x57, + 0x85, 0x9E, 0x1C, 0xEA, 0xA6, 0xEF, 0xD9, 0x84, + 0x62, 0x85, 0x93, 0xB4, 0x0C, 0xA1, 0xE1, 0x9C, + 0x7D, 0x77, 0x3D, 0x00, 0xC1, 0x44, 0xC5, 0x25, + 0xAC, 0x61, 0x9D, 0x18, 0xC8, 0x4A, 0x3F, 0x47, + 0x18, 0xE2, 0x44, 0x8B, 0x2F, 0xE3, 0x24, 0xD9, + 0xCC, 0xDA, 0x27, 0x10 + }, + .len = 60 + }, + .auth_tag = { + .data = { + 0xCA, 0x8A, 0x8A, 0x91, 0x5A, 0xF9, 0x76, 0xE3, + 0xFF, 0x2C, 0xE4, 0x7D, 0xE5, 0x62, 0x75, 0x18 + }, + .len = 16 + } +}; + +static const struct gcm_test_data gcm_test_case_192_7 = { + .key = { + .data = { + 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, + 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08, + 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C + }, + .len = 24 + }, + .iv = { + .data = { + 0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD, + 0xDE, 0xCA, 0xF8, 0x88 + }, + .len = 12 + }, + .aad = { + .data = gcm_aad_text, + .len = 12 + }, + .plaintext = { + .data = { + 0xD9, 0x31, 0x32, 0x25, 0xF8, 0x84, 0x06, 0xE5, + 0xA5, 0x59, 0x09, 0xC5, 0xAF, 0xF5, 0x26, 0x9A, + 0x86, 0xA7, 0xA9, 0x53, 0x15, 0x34, 0xF7, 0xDA, + 0x2E, 0x4C, 0x30, 0x3D, 0x8A, 0x31, 0x8A, 0x72, + 0x1C, 0x3C, 0x0C, 0x95, 0x95, 0x68, 0x09, 0x53, + 0x2F, 0xCF, 0x0E, 0x24, 0x49, 0xA6, 0xB5, 0x25, + 0xB1, 0x6A, 0xED, 0xF5, 0xAA, 0x0D, 0xE6, 0x57, + 0xBA, 0x63, 0x7B, 0x39 + }, + .len = 60 + }, + .ciphertext = { + .data = { + 0x39, 0x80, 0xCA, 0x0B, 0x3C, 0x00, 0xE8, 0x41, + 0xEB, 0x06, 0xFA, 0xC4, 0x87, 0x2A, 0x27, 0x57, + 0x85, 0x9E, 0x1C, 0xEA, 0xA6, 0xEF, 0xD9, 0x84, + 0x62, 0x85, 0x93, 0xB4, 0x0C, 0xA1, 0xE1, 0x9C, + 0x7D, 0x77, 0x3D, 0x00, 0xC1, 0x44, 0xC5, 0x25, + 0xAC, 0x61, 0x9D, 0x18, 0xC8, 0x4A, 0x3F, 0x47, + 0x18, 0xE2, 0x44, 0x8B, 0x2F, 0xE3, 0x24, 0xD9, + 0xCC, 0xDA, 0x27, 0x10 + }, + .len = 60 + }, + .auth_tag = { + .data = { + 0xC2, 0xD8, 0x4C, 0x6B, 0xA8, 0x3B, 0xA5, 0x6B, + 0x18, 0x9F, 0xE6, 0xEF, 0x66, 0x24, 0xDD, 0xDA + }, + .len = 16 + } +}; + /** AES-256 Test Vectors */ static const struct gcm_test_data gcm_test_case_256_1 = { .key = {