From 5f8cdb8df3d14c53c616ad0650edbe05c2842316 Mon Sep 17 00:00:00 2001 From: Tejasree Kondoj <ktejasree@marvell.com> Date: Thu, 23 Jun 2022 23:49:47 +0530 Subject: [PATCH] test/crypto: add additional stream cipher cases Added ZUC, SNOW3G and AES-CTR-CMAC auth-cipher test vectors with same auth and cipher offsets and total digest data encrypted. Existing tests have different cipher and auth offsets and partial or no digest encrypted. Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> Acked-by: Ciara Power <ciara.power@intel.com> --- app/test/test_cryptodev.c | 270 ++++++++++++++++++ app/test/test_cryptodev_mixed_test_vectors.h | 194 +++++++++++++ app/test/test_cryptodev_snow3g_test_vectors.h | 67 +++++ app/test/test_cryptodev_zuc_test_vectors.h | 77 +++++ 4 files changed, 608 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index bd7e232847..69a0301de0 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -6967,6 +6967,34 @@ test_snow3g_auth_cipher_part_digest_enc_oop_sgl(void) OUT_OF_PLACE, 0); } +static int +test_snow3g_auth_cipher_total_digest_enc_1(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_1_oop(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, OUT_OF_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_1_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_1_oop_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_1, OUT_OF_PLACE, 0); +} + static int test_snow3g_auth_cipher_verify_test_case_1(void) { @@ -7034,6 +7062,34 @@ test_snow3g_auth_cipher_verify_part_digest_enc_oop_sgl(void) OUT_OF_PLACE, 1); } +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1_oop(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, OUT_OF_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1_oop_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_1, OUT_OF_PLACE, 1); +} + static int test_snow3g_auth_cipher_with_digest_test_case_1(void) { @@ -7259,6 +7315,20 @@ test_zuc_auth_cipher_test_case_1_oop_sgl(void) &zuc_auth_cipher_test_case_1, OUT_OF_PLACE, 0); } +static int +test_zuc_auth_cipher_test_case_2(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, IN_PLACE, 0); +} + +static int +test_zuc_auth_cipher_test_case_2_oop(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, OUT_OF_PLACE, 0); +} + static int test_zuc_auth_cipher_verify_test_case_1(void) { @@ -7287,6 +7357,20 @@ test_zuc_auth_cipher_verify_test_case_1_oop_sgl(void) &zuc_auth_cipher_test_case_1, OUT_OF_PLACE, 1); } +static int +test_zuc_auth_cipher_verify_test_case_2(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, IN_PLACE, 1); +} + +static int +test_zuc_auth_cipher_verify_test_case_2_oop(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, OUT_OF_PLACE, 1); +} + static int test_zuc256_encryption_test_case_1(void) { @@ -7776,6 +7860,20 @@ test_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl(void) &auth_aes_cmac_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 0); } +static int +test_aes_cmac_aes_ctr_digest_enc_test_case_2(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, IN_PLACE, 0); +} + +static int +test_aes_cmac_aes_ctr_digest_enc_test_case_2_oop(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, OUT_OF_PLACE, 0); +} + static int test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1(void) { @@ -7783,6 +7881,13 @@ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1(void) &auth_aes_cmac_cipher_aes_ctr_test_case_1, IN_PLACE, 1); } +static int +test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, IN_PLACE, 1); +} + static int test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop(void) { @@ -7804,6 +7909,13 @@ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl(void) &auth_aes_cmac_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2_oop(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, OUT_OF_PLACE, 1); +} + /** MIXED AUTH + CIPHER */ static int @@ -7820,6 +7932,21 @@ test_verify_auth_zuc_cipher_snow_test_case_1(void) &auth_zuc_cipher_snow_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_zuc_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_snow_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_zuc_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_snow_test_case_1, IN_PLACE, 1); +} + + static int test_auth_aes_cmac_cipher_snow_test_case_1(void) { @@ -7834,6 +7961,20 @@ test_verify_auth_aes_cmac_cipher_snow_test_case_1(void) &auth_aes_cmac_cipher_snow_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_aes_cmac_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_snow_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_aes_cmac_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_snow_test_case_1, IN_PLACE, 1); +} + static int test_auth_zuc_cipher_aes_ctr_test_case_1(void) { @@ -7848,6 +7989,20 @@ test_verify_auth_zuc_cipher_aes_ctr_test_case_1(void) &auth_zuc_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_zuc_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_zuc_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + static int test_auth_snow_cipher_aes_ctr_test_case_1(void) { @@ -7862,6 +8017,34 @@ test_verify_auth_snow_cipher_aes_ctr_test_case_1(void) &auth_snow_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl(void) +{ + return test_mixed_auth_cipher_sgl( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_auth_snow_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl(void) +{ + return test_mixed_auth_cipher_sgl( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + +static int +test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + static int test_auth_snow_cipher_zuc_test_case_1(void) { @@ -7876,6 +8059,20 @@ test_verify_auth_snow_cipher_zuc_test_case_1(void) &auth_snow_cipher_zuc_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_snow_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_zuc_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_snow_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_zuc_test_case_1, IN_PLACE, 1); +} + static int test_auth_aes_cmac_cipher_zuc_test_case_1(void) { @@ -7889,6 +8086,19 @@ test_verify_auth_aes_cmac_cipher_zuc_test_case_1(void) return test_mixed_auth_cipher( &auth_aes_cmac_cipher_zuc_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_aes_cmac_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_zuc_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_aes_cmac_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_zuc_test_case_1, IN_PLACE, 1); +} static int test_auth_null_cipher_snow_test_case_1(void) @@ -15791,6 +16001,14 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = { test_snow3g_auth_cipher_part_digest_enc_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_snow3g_auth_cipher_part_digest_enc_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1_oop_sgl), /** SNOW 3G decrypt (UEA2), then verify auth */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15811,6 +16029,14 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = { test_snow3g_auth_cipher_verify_part_digest_enc_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_snow3g_auth_cipher_verify_part_digest_enc_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1_oop_sgl), /** SNOW 3G decrypt only (UEA2) */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15919,6 +16145,10 @@ static struct unit_test_suite cryptodev_zuc_testsuite = { test_zuc_auth_cipher_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_zuc_auth_cipher_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_test_case_2_oop), /** ZUC decrypt (EEA3), then verify auth */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15929,6 +16159,10 @@ static struct unit_test_suite cryptodev_zuc_testsuite = { test_zuc_auth_cipher_verify_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_zuc_auth_cipher_verify_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_verify_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_verify_test_case_2_oop), /** ZUC-256 encrypt only **/ TEST_CASE_ST(ut_setup, ut_teardown, @@ -16132,37 +16366,73 @@ static struct unit_test_suite cryptodev_mixed_cipher_hash_testsuite = { test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_aes_cmac_aes_ctr_digest_enc_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_aes_cmac_aes_ctr_digest_enc_test_case_2_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2_oop), /** AUTH ZUC + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_zuc_cipher_snow_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_zuc_cipher_snow_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_zuc_cipher_snow_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_zuc_cipher_snow_test_case_1_inplace), /** AUTH AES CMAC + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_aes_cmac_cipher_snow_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_aes_cmac_cipher_snow_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_aes_cmac_cipher_snow_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_aes_cmac_cipher_snow_test_case_1_inplace), /** AUTH ZUC + CIPHER AES CTR */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_zuc_cipher_aes_ctr_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_zuc_cipher_aes_ctr_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_zuc_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_zuc_cipher_aes_ctr_test_case_1_inplace), /** AUTH SNOW3G + CIPHER AES CTR */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_snow_cipher_aes_ctr_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_snow_cipher_aes_ctr_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl), /** AUTH SNOW3G + CIPHER ZUC */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_snow_cipher_zuc_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_snow_cipher_zuc_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_zuc_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_zuc_test_case_1_inplace), /** AUTH AES CMAC + CIPHER ZUC */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_aes_cmac_cipher_zuc_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_aes_cmac_cipher_zuc_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_aes_cmac_cipher_zuc_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_aes_cmac_cipher_zuc_test_case_1_inplace), /** AUTH NULL + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, diff --git a/app/test/test_cryptodev_mixed_test_vectors.h b/app/test/test_cryptodev_mixed_test_vectors.h index f50dcb0457..2816ecc6a4 100644 --- a/app/test/test_cryptodev_mixed_test_vectors.h +++ b/app/test/test_cryptodev_mixed_test_vectors.h @@ -169,6 +169,200 @@ struct mixed_cipher_auth_test_data auth_aes_cmac_cipher_aes_ctr_test_case_1 = { } }; +struct mixed_cipher_auth_test_data auth_aes_cmac_cipher_aes_ctr_test_case_2 = { + .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, + .auth_key = { + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16, + }, + .auth_iv = { + .data = { + }, + .len = 0, + }, + .auth = { + .len_bits = 512 << 3, + .offset_bits = 0, + }, + .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR, + .cipher_key = { + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16, + }, + .cipher_iv = { + .data = { + 0xa9, 0x40, 0x59, 0xda, 0x50, 0x00, 0x00, 0x00, + 0x29, 0x40, 0x59, 0xda, 0x50, 0x00, 0x80, 0x00 + }, + .len = 16, + }, + .cipher = { + .len_bits = 516 << 3, + .offset_bits = 0, + }, + .plaintext = { + .data = { + 0x57, 0x68, 0x61, 0x74, 0x20, 0x61, 0x20, 0x6C, + 0x6F, 0x75, 0x73, 0x79, 0x20, 0x65, 0x61, 0x72, + 0x74, 0x68, 0x21, 0x20, 0x48, 0x65, 0x20, 0x77, + 0x6F, 0x6E, 0x64, 0x65, 0x72, 0x65, 0x64, 0x20, + 0x68, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, + 0x20, 0x70, 0x65, 0x6F, 0x70, 0x6C, 0x65, 0x20, + 0x77, 0x65, 0x72, 0x65, 0x20, 0x64, 0x65, 0x73, + 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x20, 0x74, + 0x68, 0x61, 0x74, 0x20, 0x73, 0x61, 0x6D, 0x65, + 0x20, 0x6E, 0x69, 0x67, 0x68, 0x74, 0x20, 0x65, + 0x76, 0x65, 0x6E, 0x20, 0x69, 0x6E, 0x20, 0x68, + 0x69, 0x73, 0x20, 0x6F, 0x77, 0x6E, 0x20, 0x70, + 0x72, 0x6F, 0x73, 0x70, 0x65, 0x72, 0x6F, 0x75, + 0x73, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x72, + 0x79, 0x2C, 0x20, 0x68, 0x6F, 0x77, 0x20, 0x6D, + 0x61, 0x6E, 0x79, 0x20, 0x68, 0x6F, 0x6D, 0x65, + 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x73, + 0x68, 0x61, 0x6E, 0x74, 0x69, 0x65, 0x73, 0x2C, + 0x20, 0x68, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, + 0x79, 0x20, 0x68, 0x75, 0x73, 0x62, 0x61, 0x6E, + 0x64, 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, + 0x64, 0x72, 0x75, 0x6E, 0x6B, 0x20, 0x61, 0x6E, + 0x64, 0x20, 0x77, 0x69, 0x76, 0x65, 0x73, 0x20, + 0x73, 0x6F, 0x63, 0x6B, 0x65, 0x64, 0x2C, 0x20, + 0x61, 0x6E, 0x64, 0x20, 0x68, 0x6F, 0x77, 0x20, + 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x63, 0x68, 0x69, + 0x6C, 0x64, 0x72, 0x65, 0x6E, 0x20, 0x77, 0x65, + 0x72, 0x65, 0x20, 0x62, 0x75, 0x6C, 0x6C, 0x69, + 0x65, 0x64, 0x2C, 0x20, 0x61, 0x62, 0x75, 0x73, + 0x65, 0x64, 0x2C, 0x20, 0x6F, 0x72, 0x20, 0x61, + 0x62, 0x61, 0x6E, 0x64, 0x6F, 0x6E, 0x65, 0x64, + 0x2E, 0x20, 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, + 0x6E, 0x79, 0x20, 0x66, 0x61, 0x6D, 0x69, 0x6C, + 0x69, 0x65, 0x73, 0x20, 0x68, 0x75, 0x6E, 0x67, + 0x65, 0x72, 0x65, 0x64, 0x20, 0x66, 0x6F, 0x72, + 0x20, 0x66, 0x6F, 0x6F, 0x64, 0x20, 0x74, 0x68, + 0x65, 0x79, 0x20, 0x63, 0x6F, 0x75, 0x6C, 0x64, + 0x20, 0x6E, 0x6F, 0x74, 0x20, 0x61, 0x66, 0x66, + 0x6F, 0x72, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x62, + 0x75, 0x79, 0x3F, 0x20, 0x48, 0x6F, 0x77, 0x20, + 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x68, 0x65, 0x61, + 0x72, 0x74, 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, + 0x20, 0x62, 0x72, 0x6F, 0x6B, 0x65, 0x6E, 0x3F, + 0x20, 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, + 0x79, 0x20, 0x73, 0x75, 0x69, 0x63, 0x69, 0x64, + 0x65, 0x73, 0x20, 0x77, 0x6F, 0x75, 0x6C, 0x64, + 0x20, 0x74, 0x61, 0x6B, 0x65, 0x20, 0x70, 0x6C, + 0x61, 0x63, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, + 0x20, 0x73, 0x61, 0x6D, 0x65, 0x20, 0x6E, 0x69, + 0x67, 0x68, 0x74, 0x2C, 0x20, 0x68, 0x6F, 0x77, + 0x20, 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x70, 0x65, + 0x6F, 0x70, 0x6C, 0x65, 0x20, 0x77, 0x6F, 0x75, + 0x6C, 0x64, 0x20, 0x67, 0x6F, 0x20, 0x69, 0x6E, + 0x73, 0x61, 0x6E, 0x65, 0x3F, 0x20, 0x48, 0x6F, + 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x63, + 0x6F, 0x63, 0x6B, 0x72, 0x6F, 0x61, 0x63, 0x68, + 0x65, 0x73, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x6C, + 0x61, 0x6E, 0x64, 0x6C, 0x6F, 0x72, 0x64, 0x73, + 0x20, 0x77, 0x6F, 0x75, 0x6C, 0x64, 0x20, 0x74, + 0x72, 0x69, 0x75, 0x6D, 0x70, 0x68, 0x3F, 0x20, + 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, + 0x20, 0x77, 0x69, 0x6E, 0x6E, 0x65, 0x72, 0x73, + 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x6C, 0x6F, + 0x73, 0x65, 0x72, 0x73, 0x2C, 0x20, 0x73, 0x75 + }, + .len_bits = 512 << 3, + }, + .ciphertext = { + .data = { + 0xA5, 0xC3, 0xEC, 0xC5, 0x14, 0x36, 0xC8, 0x00, + 0x6E, 0xA6, 0xAD, 0xFB, 0x1C, 0x4F, 0x60, 0x6C, + 0x60, 0xC0, 0x9C, 0x00, 0xED, 0xC0, 0x2A, 0xD8, + 0x41, 0xD3, 0x44, 0x27, 0xE6, 0x1A, 0x6E, 0xB3, + 0x9C, 0x5E, 0x3C, 0x71, 0x19, 0x96, 0x13, 0xED, + 0x06, 0xCA, 0xFB, 0x74, 0x7C, 0x23, 0x3E, 0x54, + 0x49, 0xF1, 0x32, 0xA4, 0xCD, 0xF3, 0x92, 0x33, + 0x22, 0xDB, 0xE0, 0x0D, 0x3F, 0x31, 0xA3, 0x2B, + 0x85, 0x11, 0x41, 0x11, 0x02, 0xE0, 0x2B, 0x0E, + 0x35, 0xDF, 0xE4, 0x03, 0x6B, 0x48, 0x80, 0x4A, + 0xB8, 0x2D, 0xD4, 0xB3, 0x5B, 0xF1, 0xB4, 0xF9, + 0xC9, 0x83, 0x4E, 0x2A, 0x53, 0x92, 0xB2, 0xF6, + 0x0C, 0xBA, 0xC4, 0x94, 0x8E, 0x96, 0x60, 0x26, + 0x4F, 0xA1, 0x85, 0xC6, 0x31, 0x57, 0xAE, 0xC3, + 0x8C, 0x09, 0x1B, 0xDB, 0xC1, 0x0D, 0x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0xC0, 0xEE, 0xD1, 0xA1, 0x80, + 0x98, 0xE8, 0xDF, 0x0D, 0x8A, 0x44, 0xC2, 0x36, + 0x16, 0xCC, 0x03, 0x68, 0xD9, 0xC2, 0xCF, 0xE2, + 0x78, 0xBD, 0x1A, 0x31, 0x19, 0x5D, 0xE0, 0x6E, + 0x09, 0x6E, 0xD5, 0x17, 0xB8, 0xA8, 0xF4, 0xBE, + 0x2C, 0xD6, 0xD1, 0x04 + }, + .len_bits = 516 << 3, + }, + .digest_enc = { + .data = { + 0x2C, 0xD6, 0xD1, 0x04 + }, + .len = 4, + .offset = 512, + }, + .validDataLen = { + .len_bits = 516 << 3, + }, + .validCipherLen = { + .len_bits = 516 << 3, + }, + .validAuthLen = { + .len_bits = 512 << 3, + } +}; + struct mixed_cipher_auth_test_data auth_zuc_cipher_snow_test_case_1 = { .auth_algo = RTE_CRYPTO_AUTH_ZUC_EIA3, .auth_key = { diff --git a/app/test/test_cryptodev_snow3g_test_vectors.h b/app/test/test_cryptodev_snow3g_test_vectors.h index b49a07bcf2..3b7e442573 100644 --- a/app/test/test_cryptodev_snow3g_test_vectors.h +++ b/app/test/test_cryptodev_snow3g_test_vectors.h @@ -736,4 +736,71 @@ struct snow3g_test_data snow3g_auth_cipher_partial_digest_encryption = { }, }; +struct snow3g_test_data snow3g_auth_cipher_total_digest_encryption_1 = { + .key = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 + + }, + .len = 16 + }, + .cipher_iv = { + .data = { + 0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00, + 0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .auth_iv = { + .data = { + 0xB6, 0xAF, 0x61, 0x44, 0x98, 0x38, 0x70, 0x3A, + 0x36, 0xAF, 0x61, 0x44, 0x98, 0x38, 0xF0, 0x3A + }, + .len = 16 + }, + .plaintext = { + .data = { + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x06, 0xC3, 0x52, 0x5B, 0x98, 0x07, 0xE4, 0x67, + 0xE2, 0xD8, 0xFF, 0x58, 0x05, 0xF5, 0x13, 0x22, + }, + .len = 32 << 3 + }, + .ciphertext = { + .data = { + 0x5A, 0x5A, 0xCF, 0xCF, 0x3D, 0x11, 0xBF, 0xD9, + 0xC3, 0x7F, 0x7C, 0xA8, 0x1A, 0x9F, 0x9F, 0x34, + 0x99, 0xF7, 0x13, 0x2D, 0x22, 0xDC, 0xF5, 0x5B, + 0x3F, 0x49, 0x70, 0x63, 0x26, 0x6C, 0x4E, 0x8E + }, + .len = 32 << 3 + }, + .cipher = { + .len_bits = 30 << 3, + .offset_bits = 2 << 3 + }, + .auth = { + .len_bits = 26 << 3, + .offset_bits = 2 << 3 + }, + .digest = { + .data = { + 0x26, 0x6C, 0x4E, 0x8E + }, + .len = 4, + .offset_bytes = 28 + }, + .validDataLenInBits = { + .len = 32 << 3 + }, + .validCipherLenInBits = { + .len = 30 << 3 + }, + .validAuthLenInBits = { + .len = 26 << 3 + }, +}; + #endif /* TEST_CRYPTODEV_SNOW3G_TEST_VECTORS_H_ */ diff --git a/app/test/test_cryptodev_zuc_test_vectors.h b/app/test/test_cryptodev_zuc_test_vectors.h index 299d7649fe..25297a2f8b 100644 --- a/app/test/test_cryptodev_zuc_test_vectors.h +++ b/app/test/test_cryptodev_zuc_test_vectors.h @@ -1239,6 +1239,83 @@ struct wireless_test_data zuc_auth_cipher_test_case_1 = { } }; +struct wireless_test_data zuc_auth_cipher_test_case_2 = { + .key = { + .data = { + 0xE5, 0xBD, 0x3E, 0xA0, 0xEB, 0x55, 0xAD, 0xE8, + 0x66, 0xC6, 0xAC, 0x58, 0xBD, 0x54, 0x30, 0x2A + }, + .len = 16 + }, + .cipher_iv = { + .data = { + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .auth_iv = { + .data = { + 0xFA, 0x55, 0x6B, 0x26, 0x18, 0x00, 0x00, 0x00, + 0xFA, 0x55, 0x6B, 0x26, 0x18, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .plaintext = { + .data = { + 0x14, 0xA8, 0xEF, 0x69, 0x3D, 0x67, 0x85, 0x07, + 0xBB, 0xE7, 0x27, 0x0A, 0x7F, 0x67, 0xFF, 0x50, + 0x06, 0xC3, 0x52, 0x5B, 0x98, 0x07, 0xE4, 0x67, + 0xC4, 0xE5, 0x60, 0x00, 0xBA, 0x33, 0x8F, 0x5D, + 0x42, 0x95, 0x59, 0x03, 0x67, 0x51, 0x82, 0x22, + 0x46, 0xC8, 0x0D, 0x3B, 0x38, 0xF0, 0x7F, 0x4B, + 0xE2, 0xD8, 0xFF, 0x58, 0x05, 0xF5, 0x13, 0x22, + 0x29, 0xBD, 0xE9, 0x3B, 0xBB, 0xDC, 0xAF, 0x38, + 0x2B, 0xF1, 0xEE, 0x97, 0x2F, 0xBF, 0x99, 0x77, + 0xBA, 0xDA, 0x89, 0x45, 0x84, 0x7A, 0x2A, 0x6C, + 0x9A, 0xD3, 0x4A, 0x66, 0x75, 0x54, 0xE0, 0x4D, + 0x1F, 0x7F, 0xA2, 0xC3, 0x32, 0x41, 0xBD, 0x8F, + 0x01, 0xBA, 0x22, 0x0D + }, + .len = 96 << 3 + }, + .ciphertext = { + .data = { + 0x13, 0x1D, 0x43, 0xE0, 0xDE, 0xA1, 0xBE, 0x5C, + 0x5A, 0x1B, 0xFD, 0x97, 0x1D, 0x85, 0x2C, 0xBF, + 0x71, 0x2D, 0x7B, 0x4F, 0x57, 0x96, 0x1F, 0xEA, + 0x32, 0x08, 0xAF, 0xA8, 0xBC, 0xA4, 0x33, 0xF4, + 0x56, 0xAD, 0x09, 0xC7, 0x41, 0x7E, 0x58, 0xBC, + 0x69, 0xCF, 0x88, 0x66, 0xD1, 0x35, 0x3F, 0x74, + 0x86, 0x5E, 0x80, 0x78, 0x1D, 0x20, 0x2D, 0xFB, + 0x3E, 0xCF, 0xF7, 0xFC, 0xBC, 0x3B, 0x19, 0x0F, + 0xE8, 0x2A, 0x20, 0x4E, 0xD0, 0xE3, 0x50, 0xFC, + 0x0F, 0x6F, 0x26, 0x13, 0xB2, 0xF2, 0xBC, 0xA6, + 0xDF, 0x5A, 0x47, 0x3A, 0x57, 0xA4, 0xA0, 0x0D, + 0x98, 0x5E, 0xBA, 0xD8, 0x80, 0xD6, 0xF2, 0x38, + 0x00, 0x3B, 0x7C, 0x75 + }, + .len = 800 + }, + .validDataLenInBits = { + .len = 800 + }, + .validCipherLenInBits = { + .len = 800 + }, + .validAuthLenInBits = { + .len = 96 << 3 + }, + .validCipherOffsetInBits = { + .len = 0 + }, + .digest = { + .data = { 0x00, 0x3B, 0x7C, 0x75 }, + .len = 4, + .offset_bytes = 96 + } +}; + /** ZUC-256 vectors **/ static struct wireless_test_data zuc256_test_case_cipher_1 = { .key = { -- 2.39.5