Skip to contentSkip to conversation

crypto/aesni_mb: support 3DES

PATCH Applied Kovacevic, Marko 2 participants 3 messages Jun 8, 2018 – Jul 23, 2018 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/aesni_mb: support 3DES

From: Marko Kovacevic <[email protected]>

Added support for 3DES cipher algorithm which will support 8, 16 and 24 byte keys, which also has been added in the v0.50 of the IPSec Multi-buffer lib.

---
 doc/guides/cryptodevs/aesni_mb.rst                 |  1 +
 doc/guides/cryptodevs/features/aesni_mb.ini        |  1 +
 doc/guides/rel_notes/release_18_08.rst             |  5 ++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         | 68 +++++++++++++++++++++-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     | 20 +++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 18 ++++--
 test/test/test_cryptodev.c                         | 20 +++++++
 test/test/test_cryptodev_des_test_vectors.h        | 48 +++++++++++++--
 8 files changed, 169 insertions(+), 12 deletions(-)
doc/guides/cryptodevs/aesni_mb.rst +1 -0
index 236828c..e53b121 100644
@@ -27,6 +27,7 @@ Cipher algorithms:
 * RTE_CRYPTO_CIPHER_AES256_CTR
 * RTE_CRYPTO_CIPHER_AES_DOCSISBPI
 * RTE_CRYPTO_CIPHER_DES_CBC
+* RTE_CRYPTO_CIPHER_3DES_CBC
 * RTE_CRYPTO_CIPHER_DES_DOCSISBPI
 
 Hash algorithms:
doc/guides/cryptodevs/features/aesni_mb.ini +1 -0
index 1e263c2..f729574 100644
@@ -24,6 +24,7 @@ AES CTR (192)  = Y
 AES CTR (256)  = Y
 AES DOCSIS BPI = Y
 DES CBC        = Y
+3DES CBC       = Y
 DES DOCSIS BPI = Y
 
 ;
doc/guides/rel_notes/release_18_08.rst +5 -0
index 5bc23c5..b931665 100644
@@ -41,6 +41,11 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated the AESNI MB PMD.**
+
+  The AESNI MB PMD has been updated with additional support for:
+
+  * 3DES for 8, 16 and 24 byte keys.
 
 API Changes
 -----------
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +66 -2

97 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +20 -0
index 0153052..a674afb 100644
@@ -239,6 +239,26 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/*  3DES CBC */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+			{.cipher = {
+				.algo = RTE_CRYPTO_CIPHER_3DES_CBC,
+				.block_size = 8,
+				.key_size = {
+					.min = 8,
+					.max = 24,
+					.increment = 8
+				},
+				.iv_size = {
+					.min = 8,
+					.max = 8,
+					.increment = 0
+				}
+			}, }
+		}, }
+	},
 	{	/* DES DOCSIS BPI */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h +12 -6
index a33b2f6..b6920bc 100644
@@ -173,12 +173,18 @@ struct aesni_mb_session {
 
 		uint64_t key_length_in_bytes;
 
-		struct {
-			uint32_t encode[60] __rte_aligned(16);
-			/**< encode key */
-			uint32_t decode[60] __rte_aligned(16);
-			/**< decode key */
-		} expanded_aes_keys;
+		union {
+			struct {
+				uint32_t encode[60] __rte_aligned(16);
+				/**< encode key */
+				uint32_t decode[60] __rte_aligned(16);
+				/**< decode key */
+			} expanded_aes_keys;
+			struct {
+				const void *ks_ptr[3];
+				uint64_t key[3][16];
+			} exp_3des_keys;
+		};
 		/**< Expanded AES keys - Allocating space to
 		 * contain the maximum expanded key size which
 		 * is 240 bytes for 256 bit AES, calculate by:
test/test/test_cryptodev.c +20 -0
index 389f796..feb3c13 100644
@@ -4998,6 +4998,24 @@ test_DES_cipheronly_mb_all(void)
 
 	return TEST_SUCCESS;
 }
+static int
+test_3DES_cipheronly_mb_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->valid_devs[0],
+		rte_cryptodev_driver_id_get(
+		RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
+		BLKCIPHER_3DES_CIPHERONLY_TYPE);
+
+	TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+	return TEST_SUCCESS;
+}
 
 static int
 test_DES_docsis_mb_all(void)
@@ -9003,6 +9021,8 @@ static struct unit_test_suite cryptodev_aesni_mb_testsuite  = {
 		TEST_CASE_ST(ut_setup, ut_teardown,
 						test_DES_docsis_mb_all),
 		TEST_CASE_ST(ut_setup, ut_teardown,
+						test_3DES_cipheronly_mb_all),
+		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_CCM_authenticated_encryption_test_case_128_1),
 		TEST_CASE_ST(ut_setup, ut_teardown,
 			test_AES_CCM_authenticated_decryption_test_case_128_1),
test/test/test_cryptodev_des_test_vectors.h +44 -4

84 lines not on this page · raw message

Signature · 1 line
2.9.5
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: Kovacevic, Marko
Sent: Friday, June 8, 2018 10:10 AM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>; Jain, Deepak K <[email protected]>; Kovacevic, Marko <[email protected]>
Subject: [PATCH v1] crypto/aesni_mb: support 3DES

Quoted 6 lines

From: Marko Kovacevic <[email protected]>

Added support for 3DES cipher algorithm which will support 8, 16 and 24 byte keys, which also has been added in the v0.50 of the IPSec Multi-buffer lib.

#2 lore raw
Quoted 22 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of De Lara Guarch, Pablo
Sent: Monday, July 23, 2018 9:49 AM
To: Kovacevic, Marko <[email protected]>; [email protected]
Cc: Jain, Deepak K <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1] crypto/aesni_mb: support 3DES

Quoted 11 lines

-----Original Message-----
From: Kovacevic, Marko
Sent: Friday, June 8, 2018 10:10 AM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>; Jain, Deepak K <[email protected]>; Kovacevic, Marko <[email protected]>
Subject: [PATCH v1] crypto/aesni_mb: support 3DES

From: Marko Kovacevic <[email protected]>

Quoted 7 lines
Quoted 2 lines

Added support for 3DES cipher algorithm which will support 8, 16 and 24 byte keys, which also has been added in the v0.50 of the IPSec Multi-buffer

lib.

Quoted 2 lines

Applied to dpdk-next-crypto.
Thanks,

Pablo