DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nishikant Nayak <nishikanta.nayak@intel.com>
To: dev@dpdk.org
Cc: ciara.power@intel.com, kai.ji@intel.com,
	arkadiuszx.kusztal@intel.com, rakesh.s.joshi@intel.com,
	Nishikant Nayak <nishikanta.nayak@intel.com>,
	Akhil Goyal <gakhil@marvell.com>,
	Fan Zhang <fanzhang.oss@gmail.com>
Subject: [PATCH v2 4/4] test/cryptodev: add tests for GCM with AAD
Date: Mon, 26 Feb 2024 13:03:42 +0000	[thread overview]
Message-ID: <20240226130342.4115292-5-nishikanta.nayak@intel.com> (raw)
In-Reply-To: <20240226130342.4115292-1-nishikanta.nayak@intel.com>

Adding one new unit test code for validating the features
added as part of GCM with 64 byte AAD.
The new test case adds one new test for GCM algo for both
encrypt and decrypt operations.

Signed-off-by: Nishikant Nayak <nishikanta.nayak@intel.com>
---
v2:
    - Removed unused code.
    - Added one new unit test, AAD with GCM for GEN LCE.
---
---
 app/test/test_cryptodev.c                   | 48 +++++++++++++---
 app/test/test_cryptodev_aead_test_vectors.h | 62 +++++++++++++++++++++
 2 files changed, 103 insertions(+), 7 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 38a65aa88f..edd23731f7 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -12494,6 +12494,18 @@ test_AES_GCM_auth_decryption_test_case_256_7(void)
 	return test_authenticated_decryption(&gcm_test_case_256_7);
 }
 
+static int
+test_AES_GCM_auth_decryption_test_case_256_8(void)
+{
+	return test_authenticated_decryption(&gcm_test_case_256_8);
+}
+
+static int
+test_AES_GCM_auth_encryption_test_case_256_8(void)
+{
+	return test_authenticated_encryption(&gcm_test_case_256_8);
+}
+
 static int
 test_AES_GCM_auth_decryption_test_case_aad_1(void)
 {
@@ -12613,10 +12625,16 @@ test_authenticated_encryption_oop(const struct aead_test_data *tdata)
 
 	/* Verify the capabilities */
 	struct rte_cryptodev_sym_capability_idx cap_idx;
+	const struct rte_cryptodev_symmetric_capability *capability;
 	cap_idx.type = RTE_CRYPTO_SYM_XFORM_AEAD;
 	cap_idx.algo.aead = tdata->algo;
-	if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
-			&cap_idx) == NULL)
+	capability = rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+		&cap_idx);
+	if (capability == NULL)
+		return TEST_SKIPPED;
+	if (rte_cryptodev_sym_capability_check_aead(
+		capability, tdata->key.len, tdata->auth_tag.len,
+		tdata->aad.len, tdata->iv.len))
 		return TEST_SKIPPED;
 
 	rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
@@ -12719,16 +12737,22 @@ test_authenticated_decryption_oop(const struct aead_test_data *tdata)
 
 	/* Verify the capabilities */
 	struct rte_cryptodev_sym_capability_idx cap_idx;
+	const struct rte_cryptodev_symmetric_capability *capability;
 	cap_idx.type = RTE_CRYPTO_SYM_XFORM_AEAD;
 	cap_idx.algo.aead = tdata->algo;
-	if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
-			&cap_idx) == NULL)
-		return TEST_SKIPPED;
+	capability = rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+		&cap_idx);
 
 	/* not supported with CPU crypto and raw data-path APIs*/
 	if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO ||
 			global_api_test_type == CRYPTODEV_RAW_API_TEST)
 		return TEST_SKIPPED;
+	if (capability == NULL)
+		return TEST_SKIPPED;
+	if (rte_cryptodev_sym_capability_check_aead(
+		capability, tdata->key.len, tdata->auth_tag.len,
+		tdata->aad.len, tdata->iv.len))
+		return TEST_SKIPPED;
 
 	if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) &&
 			(!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) {
@@ -15749,10 +15773,16 @@ test_authenticated_encryption_SGL(const struct aead_test_data *tdata,
 
 	/* Verify the capabilities */
 	struct rte_cryptodev_sym_capability_idx cap_idx;
+	const struct rte_cryptodev_symmetric_capability *capability;
 	cap_idx.type = RTE_CRYPTO_SYM_XFORM_AEAD;
 	cap_idx.algo.aead = tdata->algo;
-	if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
-			&cap_idx) == NULL)
+	capability = rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+		&cap_idx);
+	if (capability == NULL)
+		return TEST_SKIPPED;
+	if (rte_cryptodev_sym_capability_check_aead(
+		capability, tdata->key.len, tdata->auth_tag.len,
+		tdata->aad.len, tdata->iv.len))
 		return TEST_SKIPPED;
 
 	/*
@@ -17392,6 +17422,8 @@ static struct unit_test_suite cryptodev_aes_gcm_auth_testsuite  = {
 			test_AES_GCM_auth_encryption_test_case_256_6),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_GCM_auth_encryption_test_case_256_7),
+		TEST_CASE_ST(ut_setup, ut_teardown,
+			test_AES_GCM_auth_encryption_test_case_256_8),
 
 		/** AES GCM Authenticated Decryption 256 bits key */
 		TEST_CASE_ST(ut_setup, ut_teardown,
@@ -17408,6 +17440,8 @@ static struct unit_test_suite cryptodev_aes_gcm_auth_testsuite  = {
 			test_AES_GCM_auth_decryption_test_case_256_6),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_GCM_auth_decryption_test_case_256_7),
+		TEST_CASE_ST(ut_setup, ut_teardown,
+			test_AES_GCM_auth_decryption_test_case_256_8),
 
 		/** AES GCM Authenticated Encryption big aad size */
 		TEST_CASE_ST(ut_setup, ut_teardown,
diff --git a/app/test/test_cryptodev_aead_test_vectors.h b/app/test/test_cryptodev_aead_test_vectors.h
index 07292620a4..eadf206e4d 100644
--- a/app/test/test_cryptodev_aead_test_vectors.h
+++ b/app/test/test_cryptodev_aead_test_vectors.h
@@ -17,6 +17,16 @@ static uint8_t gcm_aad_text[MAX_AAD_LENGTH] = {
 		0x00, 0xf1, 0xe2, 0xd3, 0xc4, 0xb5, 0xa6, 0x97,
 		0x88, 0x79, 0x6a, 0x5b, 0x4c, 0x3d, 0x2e, 0x1f };
 
+static uint8_t gcm_aad_64B_text[MAX_AAD_LENGTH] = {
+		0xED, 0x3E, 0xA8, 0x1F, 0x74, 0xE5, 0xD1, 0x96,
+		0xA4, 0xD5, 0x4B, 0x26, 0xBB, 0x20, 0x61, 0x7B,
+		0x3B, 0x9C, 0x2A, 0x69, 0x90, 0xEF, 0xD7, 0x9A,
+		0x94, 0xC2, 0xF5, 0x86, 0xBD, 0x00, 0xF6, 0xEA,
+		0x0B, 0x14, 0x24, 0xF2, 0x08, 0x67, 0x42, 0x3A,
+		0xB5, 0xB8, 0x32, 0x97, 0xB5, 0x99, 0x69, 0x75,
+		0x60, 0x00, 0x8F, 0xF7, 0x6F, 0x16, 0x52, 0x66,
+		0xF1, 0xA9, 0x38, 0xFD, 0xB0, 0x61, 0x60, 0xB5 };
+
 static uint8_t ccm_aad_test_1[8] = {
 		0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
 };
@@ -1736,6 +1746,58 @@ static const struct aead_test_data gcm_test_case_256_7 = {
 	}
 };
 
+static const struct aead_test_data gcm_test_case_256_8 = {
+	.algo = RTE_CRYPTO_AEAD_AES_GCM,
+	.key = {
+		.data = {
+			0xD8, 0xFD, 0x8F, 0x5A, 0x13, 0x7B, 0x05, 0x2C,
+			0xA4, 0x64, 0x7A, 0xDD, 0x1E, 0x9A, 0x68, 0x33,
+			0x04, 0x70, 0xE8, 0x1E, 0x42, 0x84, 0x64, 0xD2,
+			0x23, 0xA1, 0x6A, 0x0A, 0x05, 0x7B, 0x90, 0xDE},
+		.len = 32
+	},
+	.iv = {
+		.data = {
+			0x8D, 0xDF, 0xB8, 0x7F, 0xD0, 0x79, 0x77, 0x55,
+			0xD5, 0x48, 0x03, 0x05},
+		.len = 12
+	},
+	.aad = {
+		.data = gcm_aad_64B_text,
+		.len = 64
+	},
+	.plaintext = {
+		.data = {
+			0x4D, 0xBC, 0x2C, 0x7F, 0x25, 0x1F, 0x07, 0x25,
+			0x54, 0x8C, 0x43, 0xDB, 0xD8, 0x06, 0x9F, 0xBF,
+			0xCA, 0x60, 0xF4, 0xEF, 0x13, 0x87, 0xE8, 0x2F,
+			0x4D, 0x9D, 0x1D, 0x87, 0x9F, 0x91, 0x79, 0x7E,
+			0x3E, 0x98, 0xA3, 0x63, 0xC6, 0xFE, 0xDB, 0x35,
+			0x96, 0x59, 0xB2, 0x0C, 0x80, 0x96, 0x70, 0x07,
+			0x87, 0x42, 0xAB, 0x4F, 0x31, 0x73, 0xC4, 0xF9,
+			0xB0, 0x1E, 0xF1, 0xBC, 0x7D, 0x45, 0xE5, 0xF3},
+		.len = 64
+	},
+	.ciphertext = {
+	    .data = {
+			0x21, 0xFA, 0x59, 0x4F, 0x1F, 0x6B, 0x19, 0xC2,
+			0x68, 0xBC, 0x05, 0x93, 0x4E, 0x48, 0x6C, 0x5B,
+			0x0B, 0x7A, 0x43, 0xB7, 0x60, 0x8E, 0x00, 0xC4,
+			0xAB, 0x14, 0x6B, 0xCC, 0xA1, 0x27, 0x6A, 0xDE,
+			0x8E, 0xB6, 0x98, 0xBB, 0x4F, 0xD0, 0x6F, 0x30,
+			0x0F, 0x04, 0xA8, 0x5B, 0xDC, 0xD8, 0xE8, 0x8A,
+			0x73, 0xD9, 0xB8, 0x60, 0x7C, 0xE4, 0x32, 0x4C,
+			0x3A, 0x0B, 0xC2, 0x82, 0xDA, 0x88, 0x17, 0x69},
+	    .len = 64
+	},
+	.auth_tag = {
+		.data = {
+			0x3B, 0x80, 0x83, 0x72, 0xE5, 0x1B, 0x94, 0x15,
+			0x75, 0xC8, 0x62, 0xBC, 0xA1, 0x66, 0x91, 0x45},
+		.len = 16
+	}
+};
+
 /** variable AAD AES-GCM-128 Test Vectors */
 static const struct aead_test_data gcm_test_case_aad_1 = {
 	.algo = RTE_CRYPTO_AEAD_AES_GCM,
-- 
2.25.1


  parent reply	other threads:[~2024-02-26 13:04 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20 13:26 [PATCH 1/4] common/qat: add files specific to GEN5 Nishikant Nayak
2023-12-20 13:26 ` [PATCH 2/4] common/qat: update common driver to support GEN5 Nishikant Nayak
2023-12-20 13:26 ` [PATCH 3/4] crypto/qat: update headers for GEN5 support Nishikant Nayak
2023-12-20 13:26 ` [PATCH 4/4] test/cryptodev: add tests for GCM with AAD Nishikant Nayak
2024-02-23 15:17 ` [PATCH 1/4] common/qat: add files specific to GEN5 Power, Ciara
2024-02-26 13:03 ` [PATCH v2 0/4] add QAT GEN LCE device Nishikant Nayak
2024-02-26 13:03   ` [PATCH v2 1/4] common/qat: add files specific to GEN LCE Nishikant Nayak
2024-02-26 13:03   ` [PATCH v2 2/4] common/qat: update common driver to support " Nishikant Nayak
2024-02-26 13:03   ` [PATCH v2 3/4] crypto/qat: update headers for GEN LCE support Nishikant Nayak
2024-02-26 13:03   ` Nishikant Nayak [this message]
2024-02-27  9:35 ` [PATCH v3 0/4] add new QAT gen3 and gen5 Nishikant Nayak
2024-02-27  9:35   ` [PATCH v3 1/4] common/qat: add files specific to GEN LCE Nishikant Nayak
2024-02-27  9:35   ` [PATCH v3 2/4] common/qat: update common driver to support " Nishikant Nayak
2024-02-27  9:35   ` [PATCH v3 3/4] crypto/qat: update headers for GEN LCE support Nishikant Nayak
2024-02-27  9:35   ` [PATCH v3 4/4] test/cryptodev: add tests for GCM with AAD Nishikant Nayak
2024-02-27  9:40 ` [PATCH v4 0/4] add QAT GEN LCE device Nishikant Nayak
2024-02-27  9:40   ` [PATCH v4 1/4] common/qat: add files specific to GEN LCE Nishikant Nayak
2024-02-27  9:40   ` [PATCH v4 2/4] common/qat: update common driver to support " Nishikant Nayak
2024-02-27  9:40   ` [PATCH v4 3/4] crypto/qat: update headers for GEN LCE support Nishikant Nayak
2024-02-27  9:40   ` [PATCH v4 4/4] test/cryptodev: add tests for GCM with AAD Nishikant Nayak
2024-02-27  9:54   ` [PATCH v4 0/4] add QAT GEN LCE device Power, Ciara
2024-02-29  9:47     ` Kusztal, ArkadiuszX
2024-02-27 11:33 ` [PATCH v5 " Nishikant Nayak
2024-02-27 11:33   ` [PATCH v5 1/4] common/qat: add files specific to GEN LCE Nishikant Nayak
2024-02-27 11:33   ` [PATCH v5 2/4] common/qat: update common driver to support " Nishikant Nayak
2024-02-27 11:33   ` [PATCH v5 3/4] crypto/qat: update headers for GEN LCE support Nishikant Nayak
2024-02-27 11:33   ` [PATCH v5 4/4] test/cryptodev: add tests for GCM with AAD Nishikant Nayak
2024-02-28 14:00 ` [PATCH v6 0/4] add QAT GEN LCE device Nishikant Nayak
2024-02-28 14:00   ` [PATCH v6 1/4] common/qat: add files specific to GEN LCE Nishikant Nayak
2024-02-29 16:09     ` [EXT] " Akhil Goyal
2024-02-29 16:14     ` Akhil Goyal
2024-02-29 16:30       ` Power, Ciara
2024-02-28 14:00   ` [PATCH v6 2/4] common/qat: update common driver to support " Nishikant Nayak
2024-02-28 14:00   ` [PATCH v6 3/4] crypto/qat: update headers for GEN LCE support Nishikant Nayak
2024-02-29 16:04     ` [EXT] " Akhil Goyal
2024-02-28 14:00   ` [PATCH v6 4/4] test/cryptodev: add tests for GCM with AAD Nishikant Nayak
2024-02-29 15:52     ` [EXT] " Akhil Goyal
2024-02-29 16:32       ` Power, Ciara
2024-02-29 18:43 ` [PATCH v7 0/3] add QAT GEN LCE device Ciara Power
2024-02-29 18:43   ` [PATCH v7 1/3] common/qat: add support for " Ciara Power
2024-02-29 18:43   ` [PATCH v7 2/3] crypto/qat: update headers for GEN LCE support Ciara Power
2024-02-29 18:43   ` [PATCH v7 3/3] test/cryptodev: add tests for GCM with 64 byte AAD Ciara Power
2024-02-29 19:45 ` [PATCH v8 0/3] add QAT GEN LCE device Ciara Power
2024-02-29 19:45   ` [PATCH v8 1/3] common/qat: add support for " Ciara Power
2024-02-29 19:45   ` [PATCH v8 2/3] crypto/qat: update headers for GEN LCE support Ciara Power
2024-02-29 19:45   ` [PATCH v8 3/3] test/cryptodev: add tests for GCM with 64 byte AAD Ciara Power
2024-03-01  6:12   ` [EXTERNAL] [PATCH v8 0/3] add QAT GEN LCE device Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240226130342.4115292-5-nishikanta.nayak@intel.com \
    --to=nishikanta.nayak@intel.com \
    --cc=arkadiuszx.kusztal@intel.com \
    --cc=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=gakhil@marvell.com \
    --cc=kai.ji@intel.com \
    --cc=rakesh.s.joshi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).