DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test/crypto: added NULL algo tests to loop test mechanism
@ 2019-04-26 19:31 Fiona Trahe
  2019-04-26 19:31 ` Fiona Trahe
  2019-04-30  7:20 ` Akhil Goyal
  0 siblings, 2 replies; 7+ messages in thread
From: Fiona Trahe @ 2019-04-26 19:31 UTC (permalink / raw)
  To: dev
  Cc: thomas, akhil.goyal, arkadiuszx.kusztal, bernard.iremonger,
	anoobj, Fiona Trahe

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 <fiona.trahe@intel.com>
---
 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-25 12:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-26 19:31 [dpdk-dev] [PATCH] test/crypto: added NULL algo tests to loop test mechanism Fiona Trahe
2019-04-26 19:31 ` Fiona Trahe
2019-04-30  7:20 ` Akhil Goyal
2019-04-30  7:20   ` Akhil Goyal
2019-04-30  9:54   ` Trahe, Fiona
2019-04-30  9:54     ` Trahe, Fiona
2019-06-25 12:54     ` Akhil Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).