From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 68FDA1B616 for ; Fri, 26 Apr 2019 21:32:06 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Apr 2019 12:32:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,398,1549958400"; d="scan'208";a="165239317" Received: from sivswdev09.ir.intel.com (HELO localhost.localdomain) ([10.237.217.48]) by fmsmga002.fm.intel.com with ESMTP; 26 Apr 2019 12:32:03 -0700 From: Fiona Trahe To: dev@dpdk.org Cc: thomas@monjalon.net, akhil.goyal@nxp.com, arkadiuszx.kusztal@intel.com, bernard.iremonger@intel.com, anoobj@marvell.com, Fiona Trahe Date: Fri, 26 Apr 2019 20:31:58 +0100 Message-Id: <1556307118-16624-1-git-send-email-fiona.trahe@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] test/crypto: added NULL algo tests to loop test mechanism X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Apr 2019 19:32:07 -0000 Added NULL algo tests into loop test mechanism used by block cipher tests as easier to extend there. Included chain, cipher-only and auth-only use-cases. Extended to cover out-of-place use-cases and use-cases where data length is not an 8-byte multiple. Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 82 ++++++-- app/test/test_cryptodev_aes_test_vectors.h | 277 +++++++++++++++++++++++++++- app/test/test_cryptodev_blockcipher.c | 9 +- app/test/test_cryptodev_blockcipher.h | 1 + app/test/test_cryptodev_hash_test_vectors.h | 56 +++++- 5 files changed, 406 insertions(+), 19 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9f31aaa7e..2b76f3ffc 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1673,6 +1673,64 @@ test_authonly_qat_all(void) return TEST_SUCCESS; } + +static int +test_AES_chain_null_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, ts_params->session_priv_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)), + BLKCIPHER_AES_CHAIN_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_AES_cipheronly_null_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, ts_params->session_priv_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)), + BLKCIPHER_AES_CIPHERONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_authonly_null_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, ts_params->session_priv_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)), + BLKCIPHER_AUTHONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + static int test_AES_chain_mb_all(void) { @@ -9257,15 +9315,9 @@ static struct unit_test_suite cryptodev_qat_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_MD5_HMAC_verify_case_2), - /** NULL tests */ - TEST_CASE_ST(ut_setup, ut_teardown, - test_null_auth_only_operation), - TEST_CASE_ST(ut_setup, ut_teardown, - test_null_cipher_only_operation), - TEST_CASE_ST(ut_setup, ut_teardown, - test_null_cipher_auth_operation), - TEST_CASE_ST(ut_setup, ut_teardown, - test_null_auth_cipher_operation), + /** NULL algo tests done in chain_all, + * cipheronly and authonly suites + */ /** KASUMI tests */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -10304,17 +10356,15 @@ static struct unit_test_suite cryptodev_null_testsuite = { .teardown = testsuite_teardown, .unit_test_cases = { TEST_CASE_ST(ut_setup, ut_teardown, - test_null_auth_only_operation), - TEST_CASE_ST(ut_setup, ut_teardown, - test_null_cipher_only_operation), + test_null_invalid_operation), TEST_CASE_ST(ut_setup, ut_teardown, - test_null_cipher_auth_operation), + test_null_burst_operation), TEST_CASE_ST(ut_setup, ut_teardown, - test_null_auth_cipher_operation), + test_AES_chain_null_all), TEST_CASE_ST(ut_setup, ut_teardown, - test_null_invalid_operation), + test_AES_cipheronly_null_all), TEST_CASE_ST(ut_setup, ut_teardown, - test_null_burst_operation), + test_authonly_null_all), TEST_CASES_END() /**< NULL terminate unit test array */ } diff --git a/app/test/test_cryptodev_aes_test_vectors.h b/app/test/test_cryptodev_aes_test_vectors.h index e5b9da4fa..ee4fdc9a7 100644 --- a/app/test/test_cryptodev_aes_test_vectors.h +++ b/app/test/test_cryptodev_aes_test_vectors.h @@ -221,6 +221,141 @@ static const uint8_t ciphertext512_aes128cbc[] = { 0xBB, 0xFF, 0xAE, 0xB5, 0x99, 0x6E, 0xCB, 0x0C }; +/* NULL cipher NULL auth 8-byte multiple test vector */ +static const struct blockcipher_test_data null_test_data_chain_x8_multiple = { + .crypto_algo = RTE_CRYPTO_CIPHER_NULL, + .cipher_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16 + }, + .iv = { /* arbitrary data - shouldn't be used */ + .data = { + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF + }, + .len = 16 + }, + .plaintext = { + .data = plaintext_aes_common, + .len = 512 + }, + .ciphertext = { + .data = plaintext_aes_common, + .len = 512 + }, + .auth_algo = RTE_CRYPTO_AUTH_NULL, + .auth_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA, + 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD, + 0xDE, 0xF4, 0xDE, 0xAD + }, + .len = 20 + }, + .digest = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + .len = 20, + .truncated_len = 12 + } +}; + +/* NULL cipher NULL auth 4-byte multiple test vector */ +static const struct blockcipher_test_data null_test_data_chain_x4_multiple = { + .crypto_algo = RTE_CRYPTO_CIPHER_NULL, + .cipher_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16 + }, + .iv = { /* arbitrary data - shouldn't be used */ + .data = { + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF + }, + .len = 16 + }, + .plaintext = { + .data = plaintext_aes128ctr, + .len = 20 + }, + .ciphertext = { + .data = plaintext_aes128ctr, + .len = 20 + }, + .auth_algo = RTE_CRYPTO_AUTH_NULL, + .auth_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA, + 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD, + 0xDE, 0xF4, 0xDE, 0xAD + }, + .len = 20 + }, + .digest = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + .len = 20, + .truncated_len = 12 + } +}; + +/* NULL cipher NULL auth 1-byte multiple test vector */ +static const struct blockcipher_test_data null_test_data_chain_x1_multiple = { + .crypto_algo = RTE_CRYPTO_CIPHER_NULL, + .cipher_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16 + }, + .iv = { /* arbitrary data - shouldn't be used */ + .data = { + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF + }, + .len = 16 + }, + .plaintext = { + .data = plaintext_aes128ctr, + .len = 21 + }, + .ciphertext = { + .data = plaintext_aes128ctr, + .len = 21 + }, + .auth_algo = RTE_CRYPTO_AUTH_NULL, + .auth_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA, + 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD, + 0xDE, 0xF4, 0xDE, 0xAD + }, + .len = 20 + }, + .digest = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + .len = 20, + .truncated_len = 12 + } +}; + /* AES128-CTR-SHA1 test vector */ static const struct blockcipher_test_data aes_test_data_1 = { .crypto_algo = RTE_CRYPTO_CIPHER_AES_CTR, @@ -1822,6 +1957,90 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_CCP | BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX }, + { + .test_descr = "NULL-CIPHER-NULL-AUTH encrypt & gen x8byte", + .test_data = &null_test_data_chain_x8_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-AUTH-NULL-CIPHER verify & decrypt x8byte", + .test_data = &null_test_data_chain_x8_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-CIPHER-NULL-AUTH encrypt & gen x8byte - OOP", + .test_data = &null_test_data_chain_x8_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-AUTH-NULL-CIPHER verify & decrypt x8byte - OOP", + .test_data = &null_test_data_chain_x8_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-CIPHER-NULL-AUTH encrypt & gen x4byte", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-AUTH-NULL-CIPHER verify & decrypt x4byte", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-CIPHER-NULL-AUTH encrypt & gen x4byte - OOP", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-AUTH-NULL-CIPHER verify & decrypt x4byte - OOP", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-CIPHER-NULL-AUTH encrypt & gen x1byte", + .test_data = &null_test_data_chain_x1_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-AUTH-NULL-CIPHER verify & decrypt x1byte", + .test_data = &null_test_data_chain_x1_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-CIPHER-NULL-AUTH encrypt & gen x1byte - OOP", + .test_data = &null_test_data_chain_x1_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-AUTH-NULL-CIPHER verify & decrypt x1byte - OOP", + .test_data = &null_test_data_chain_x1_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, }; static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { @@ -2125,7 +2344,63 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { .test_data = &aes_test_data_xts_key_64_pt_48, .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT - } + }, + { + .test_descr = "cipher-only - NULL algo - x8 - encryption", + .test_data = &null_test_data_chain_x8_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x8 - decryption", + .test_data = &null_test_data_chain_x8_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x4 - encryption", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x4 - decryption", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x4 - encryption - OOP", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x4 - decryption - OOP", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x1 - encryption", + .test_data = &null_test_data_chain_x1_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x1 - decryption", + .test_data = &null_test_data_chain_x1_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, }; static const struct blockcipher_test_case aes_docsis_test_cases[] = { diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c index cdbdcce1e..b8dcc3962 100644 --- a/app/test/test_cryptodev_blockcipher.c +++ b/app/test/test_cryptodev_blockcipher.c @@ -77,6 +77,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD)); int octeontx_pmd = rte_cryptodev_driver_id_get( RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)); + int null_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)); int nb_segs = 1; uint32_t nb_iterates = 0; @@ -122,7 +124,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, driver_id == mrvl_pmd || driver_id == ccp_pmd || driver_id == virtio_pmd || - driver_id == octeontx_pmd) { /* Fall through */ + driver_id == octeontx_pmd || + driver_id == null_pmd) { /* Fall through */ digest_len = tdata->digest.len; } else if (driver_id == aesni_mb_pmd || driver_id == scheduler_pmd) { @@ -712,6 +715,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD)); int octeontx_pmd = rte_cryptodev_driver_id_get( RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)); + int null_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)); switch (test_type) { case BLKCIPHER_AES_CHAIN_TYPE: @@ -782,6 +787,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO; else if (driver_id == octeontx_pmd) target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX; + else if (driver_id == null_pmd) + target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL; else TEST_ASSERT(0, "Unrecognized cryptodev type"); diff --git a/app/test/test_cryptodev_blockcipher.h b/app/test/test_cryptodev_blockcipher.h index 060d10498..3d4b97533 100644 --- a/app/test/test_cryptodev_blockcipher.h +++ b/app/test/test_cryptodev_blockcipher.h @@ -31,6 +31,7 @@ #define BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO 0x0200 /* VIRTIO flag */ #define BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR 0x0400 /* CAAM_JR flag */ #define BLOCKCIPHER_TEST_TARGET_PMD_CCP 0x0800 /* CCP flag */ +#define BLOCKCIPHER_TEST_TARGET_PMD_NULL 0x1000 /* NULL flag */ #define BLOCKCIPHER_TEST_OP_CIPHER (BLOCKCIPHER_TEST_OP_ENCRYPT | \ BLOCKCIPHER_TEST_OP_DECRYPT) diff --git a/app/test/test_cryptodev_hash_test_vectors.h b/app/test/test_cryptodev_hash_test_vectors.h index d3a26609c..6f201c08a 100644 --- a/app/test/test_cryptodev_hash_test_vectors.h +++ b/app/test/test_cryptodev_hash_test_vectors.h @@ -358,6 +358,31 @@ cmac_test_vector = { }; static const struct blockcipher_test_data +null_auth_test_vector = { + .auth_algo = RTE_CRYPTO_AUTH_NULL, + .ciphertext = { /* arbitrary data - shouldn't be used */ + .data = plaintext_hash, + .len = 512 + }, + .auth_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16 + }, + .digest = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + .len = 20, + .truncated_len = 12 + } +}; + +static const struct blockcipher_test_data cmac_test_vector_12 = { .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, .ciphertext = { @@ -741,7 +766,36 @@ static const struct blockcipher_test_case hash_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_QAT - } + }, + { + .test_descr = "NULL algo - auth generate", + .test_data = &null_auth_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL algo - auth verify", + .test_data = &null_auth_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL algo - auth generate - OOP", + .test_data = &null_auth_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL algo - auth verify - OOP", + .test_data = &null_auth_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + }; #endif /* TEST_CRYPTODEV_HASH_TEST_VECTORS_H_ */ -- 2.13.6 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9DA82A05D3 for ; Fri, 26 Apr 2019 21:32:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0FA671B710; Fri, 26 Apr 2019 21:32:09 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 68FDA1B616 for ; Fri, 26 Apr 2019 21:32:06 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Apr 2019 12:32:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,398,1549958400"; d="scan'208";a="165239317" Received: from sivswdev09.ir.intel.com (HELO localhost.localdomain) ([10.237.217.48]) by fmsmga002.fm.intel.com with ESMTP; 26 Apr 2019 12:32:03 -0700 From: Fiona Trahe To: dev@dpdk.org Cc: thomas@monjalon.net, akhil.goyal@nxp.com, arkadiuszx.kusztal@intel.com, bernard.iremonger@intel.com, anoobj@marvell.com, Fiona Trahe Date: Fri, 26 Apr 2019 20:31:58 +0100 Message-Id: <1556307118-16624-1-git-send-email-fiona.trahe@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] test/crypto: added NULL algo tests to loop test mechanism X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190426193158.i-rYlVBGRWtRZPzKtvWknMgNeeCv2tBp5A7Bjhp7qX8@z> Added NULL algo tests into loop test mechanism used by block cipher tests as easier to extend there. Included chain, cipher-only and auth-only use-cases. Extended to cover out-of-place use-cases and use-cases where data length is not an 8-byte multiple. Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 82 ++++++-- app/test/test_cryptodev_aes_test_vectors.h | 277 +++++++++++++++++++++++++++- app/test/test_cryptodev_blockcipher.c | 9 +- app/test/test_cryptodev_blockcipher.h | 1 + app/test/test_cryptodev_hash_test_vectors.h | 56 +++++- 5 files changed, 406 insertions(+), 19 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9f31aaa7e..2b76f3ffc 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1673,6 +1673,64 @@ test_authonly_qat_all(void) return TEST_SUCCESS; } + +static int +test_AES_chain_null_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, ts_params->session_priv_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)), + BLKCIPHER_AES_CHAIN_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_AES_cipheronly_null_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, ts_params->session_priv_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)), + BLKCIPHER_AES_CIPHERONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int +test_authonly_null_all(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, ts_params->session_priv_mpool, + ts_params->valid_devs[0], + rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)), + BLKCIPHER_AUTHONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + static int test_AES_chain_mb_all(void) { @@ -9257,15 +9315,9 @@ static struct unit_test_suite cryptodev_qat_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_MD5_HMAC_verify_case_2), - /** NULL tests */ - TEST_CASE_ST(ut_setup, ut_teardown, - test_null_auth_only_operation), - TEST_CASE_ST(ut_setup, ut_teardown, - test_null_cipher_only_operation), - TEST_CASE_ST(ut_setup, ut_teardown, - test_null_cipher_auth_operation), - TEST_CASE_ST(ut_setup, ut_teardown, - test_null_auth_cipher_operation), + /** NULL algo tests done in chain_all, + * cipheronly and authonly suites + */ /** KASUMI tests */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -10304,17 +10356,15 @@ static struct unit_test_suite cryptodev_null_testsuite = { .teardown = testsuite_teardown, .unit_test_cases = { TEST_CASE_ST(ut_setup, ut_teardown, - test_null_auth_only_operation), - TEST_CASE_ST(ut_setup, ut_teardown, - test_null_cipher_only_operation), + test_null_invalid_operation), TEST_CASE_ST(ut_setup, ut_teardown, - test_null_cipher_auth_operation), + test_null_burst_operation), TEST_CASE_ST(ut_setup, ut_teardown, - test_null_auth_cipher_operation), + test_AES_chain_null_all), TEST_CASE_ST(ut_setup, ut_teardown, - test_null_invalid_operation), + test_AES_cipheronly_null_all), TEST_CASE_ST(ut_setup, ut_teardown, - test_null_burst_operation), + test_authonly_null_all), TEST_CASES_END() /**< NULL terminate unit test array */ } diff --git a/app/test/test_cryptodev_aes_test_vectors.h b/app/test/test_cryptodev_aes_test_vectors.h index e5b9da4fa..ee4fdc9a7 100644 --- a/app/test/test_cryptodev_aes_test_vectors.h +++ b/app/test/test_cryptodev_aes_test_vectors.h @@ -221,6 +221,141 @@ static const uint8_t ciphertext512_aes128cbc[] = { 0xBB, 0xFF, 0xAE, 0xB5, 0x99, 0x6E, 0xCB, 0x0C }; +/* NULL cipher NULL auth 8-byte multiple test vector */ +static const struct blockcipher_test_data null_test_data_chain_x8_multiple = { + .crypto_algo = RTE_CRYPTO_CIPHER_NULL, + .cipher_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16 + }, + .iv = { /* arbitrary data - shouldn't be used */ + .data = { + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF + }, + .len = 16 + }, + .plaintext = { + .data = plaintext_aes_common, + .len = 512 + }, + .ciphertext = { + .data = plaintext_aes_common, + .len = 512 + }, + .auth_algo = RTE_CRYPTO_AUTH_NULL, + .auth_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA, + 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD, + 0xDE, 0xF4, 0xDE, 0xAD + }, + .len = 20 + }, + .digest = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + .len = 20, + .truncated_len = 12 + } +}; + +/* NULL cipher NULL auth 4-byte multiple test vector */ +static const struct blockcipher_test_data null_test_data_chain_x4_multiple = { + .crypto_algo = RTE_CRYPTO_CIPHER_NULL, + .cipher_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16 + }, + .iv = { /* arbitrary data - shouldn't be used */ + .data = { + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF + }, + .len = 16 + }, + .plaintext = { + .data = plaintext_aes128ctr, + .len = 20 + }, + .ciphertext = { + .data = plaintext_aes128ctr, + .len = 20 + }, + .auth_algo = RTE_CRYPTO_AUTH_NULL, + .auth_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA, + 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD, + 0xDE, 0xF4, 0xDE, 0xAD + }, + .len = 20 + }, + .digest = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + .len = 20, + .truncated_len = 12 + } +}; + +/* NULL cipher NULL auth 1-byte multiple test vector */ +static const struct blockcipher_test_data null_test_data_chain_x1_multiple = { + .crypto_algo = RTE_CRYPTO_CIPHER_NULL, + .cipher_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16 + }, + .iv = { /* arbitrary data - shouldn't be used */ + .data = { + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF + }, + .len = 16 + }, + .plaintext = { + .data = plaintext_aes128ctr, + .len = 21 + }, + .ciphertext = { + .data = plaintext_aes128ctr, + .len = 21 + }, + .auth_algo = RTE_CRYPTO_AUTH_NULL, + .auth_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA, + 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD, + 0xDE, 0xF4, 0xDE, 0xAD + }, + .len = 20 + }, + .digest = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + .len = 20, + .truncated_len = 12 + } +}; + /* AES128-CTR-SHA1 test vector */ static const struct blockcipher_test_data aes_test_data_1 = { .crypto_algo = RTE_CRYPTO_CIPHER_AES_CTR, @@ -1822,6 +1957,90 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = { BLOCKCIPHER_TEST_TARGET_PMD_CCP | BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX }, + { + .test_descr = "NULL-CIPHER-NULL-AUTH encrypt & gen x8byte", + .test_data = &null_test_data_chain_x8_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-AUTH-NULL-CIPHER verify & decrypt x8byte", + .test_data = &null_test_data_chain_x8_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-CIPHER-NULL-AUTH encrypt & gen x8byte - OOP", + .test_data = &null_test_data_chain_x8_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-AUTH-NULL-CIPHER verify & decrypt x8byte - OOP", + .test_data = &null_test_data_chain_x8_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-CIPHER-NULL-AUTH encrypt & gen x4byte", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-AUTH-NULL-CIPHER verify & decrypt x4byte", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-CIPHER-NULL-AUTH encrypt & gen x4byte - OOP", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-AUTH-NULL-CIPHER verify & decrypt x4byte - OOP", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-CIPHER-NULL-AUTH encrypt & gen x1byte", + .test_data = &null_test_data_chain_x1_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-AUTH-NULL-CIPHER verify & decrypt x1byte", + .test_data = &null_test_data_chain_x1_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-CIPHER-NULL-AUTH encrypt & gen x1byte - OOP", + .test_data = &null_test_data_chain_x1_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL-AUTH-NULL-CIPHER verify & decrypt x1byte - OOP", + .test_data = &null_test_data_chain_x1_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, }; static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { @@ -2125,7 +2344,63 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { .test_data = &aes_test_data_xts_key_64_pt_48, .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT - } + }, + { + .test_descr = "cipher-only - NULL algo - x8 - encryption", + .test_data = &null_test_data_chain_x8_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x8 - decryption", + .test_data = &null_test_data_chain_x8_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x4 - encryption", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x4 - decryption", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x4 - encryption - OOP", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x4 - decryption - OOP", + .test_data = &null_test_data_chain_x4_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x1 - encryption", + .test_data = &null_test_data_chain_x1_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "cipher-only - NULL algo - x1 - decryption", + .test_data = &null_test_data_chain_x1_multiple, + .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, }; static const struct blockcipher_test_case aes_docsis_test_cases[] = { diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c index cdbdcce1e..b8dcc3962 100644 --- a/app/test/test_cryptodev_blockcipher.c +++ b/app/test/test_cryptodev_blockcipher.c @@ -77,6 +77,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD)); int octeontx_pmd = rte_cryptodev_driver_id_get( RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)); + int null_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)); int nb_segs = 1; uint32_t nb_iterates = 0; @@ -122,7 +124,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, driver_id == mrvl_pmd || driver_id == ccp_pmd || driver_id == virtio_pmd || - driver_id == octeontx_pmd) { /* Fall through */ + driver_id == octeontx_pmd || + driver_id == null_pmd) { /* Fall through */ digest_len = tdata->digest.len; } else if (driver_id == aesni_mb_pmd || driver_id == scheduler_pmd) { @@ -712,6 +715,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD)); int octeontx_pmd = rte_cryptodev_driver_id_get( RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)); + int null_pmd = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)); switch (test_type) { case BLKCIPHER_AES_CHAIN_TYPE: @@ -782,6 +787,8 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO; else if (driver_id == octeontx_pmd) target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX; + else if (driver_id == null_pmd) + target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL; else TEST_ASSERT(0, "Unrecognized cryptodev type"); diff --git a/app/test/test_cryptodev_blockcipher.h b/app/test/test_cryptodev_blockcipher.h index 060d10498..3d4b97533 100644 --- a/app/test/test_cryptodev_blockcipher.h +++ b/app/test/test_cryptodev_blockcipher.h @@ -31,6 +31,7 @@ #define BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO 0x0200 /* VIRTIO flag */ #define BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR 0x0400 /* CAAM_JR flag */ #define BLOCKCIPHER_TEST_TARGET_PMD_CCP 0x0800 /* CCP flag */ +#define BLOCKCIPHER_TEST_TARGET_PMD_NULL 0x1000 /* NULL flag */ #define BLOCKCIPHER_TEST_OP_CIPHER (BLOCKCIPHER_TEST_OP_ENCRYPT | \ BLOCKCIPHER_TEST_OP_DECRYPT) diff --git a/app/test/test_cryptodev_hash_test_vectors.h b/app/test/test_cryptodev_hash_test_vectors.h index d3a26609c..6f201c08a 100644 --- a/app/test/test_cryptodev_hash_test_vectors.h +++ b/app/test/test_cryptodev_hash_test_vectors.h @@ -358,6 +358,31 @@ cmac_test_vector = { }; static const struct blockcipher_test_data +null_auth_test_vector = { + .auth_algo = RTE_CRYPTO_AUTH_NULL, + .ciphertext = { /* arbitrary data - shouldn't be used */ + .data = plaintext_hash, + .len = 512 + }, + .auth_key = { /* arbitrary data - shouldn't be used */ + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16 + }, + .digest = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + .len = 20, + .truncated_len = 12 + } +}; + +static const struct blockcipher_test_data cmac_test_vector_12 = { .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, .ciphertext = { @@ -741,7 +766,36 @@ static const struct blockcipher_test_case hash_test_cases[] = { .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB | BLOCKCIPHER_TEST_TARGET_PMD_QAT - } + }, + { + .test_descr = "NULL algo - auth generate", + .test_data = &null_auth_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL algo - auth verify", + .test_data = &null_auth_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_NULL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL algo - auth generate - OOP", + .test_data = &null_auth_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + { + .test_descr = "NULL algo - auth verify - OOP", + .test_data = &null_auth_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP, + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT + }, + }; #endif /* TEST_CRYPTODEV_HASH_TEST_VECTORS_H_ */ -- 2.13.6