[3/3] crypto/aesni_gcm: add AES CCM support

Message ID 20210907090715.460856-3-radu.nicolau@intel.com (mailing list archive)
State Not Applicable, archived
Delegated to: akhil goyal
Headers
Series [1/3] crypto/aesni_mb: add NULL/NULL support |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance fail Performance Testing issues
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Radu Nicolau Sept. 7, 2021, 9:07 a.m. UTC
  Add support for AES CCM.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c     |  8 +++---
 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c | 30 ++++++++++++++++++++
 2 files changed, 34 insertions(+), 4 deletions(-)
  

Patch

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 886e2a5aaa..ee36b36f42 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -73,13 +73,13 @@  aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *gcm_ops,
 		key = auth_xform->auth.key.data;
 		sess->req_digest_length = auth_xform->auth.digest_length;
 
-	/* AES-GCM */
+	/* AES-GCM - AES-CCM */
 	} else if (xform->type == RTE_CRYPTO_SYM_XFORM_AEAD) {
 		aead_xform = xform;
-
-		if (aead_xform->aead.algo != RTE_CRYPTO_AEAD_AES_GCM) {
+		if ((aead_xform->aead.algo != RTE_CRYPTO_AEAD_AES_GCM) &&
+		    (aead_xform->aead.algo != RTE_CRYPTO_AEAD_AES_CCM)) {
 			AESNI_GCM_LOG(ERR, "The only combined operation "
-						"supported is AES GCM");
+						"supported is AES GCM/CCM");
 			return -ENOTSUP;
 		}
 
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
index 18dbc4c18c..989d42b4b7 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
@@ -66,6 +66,36 @@  static const struct rte_cryptodev_capabilities aesni_gcm_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{       /* AES CCM */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AEAD,
+			{.aead = {
+				.algo = RTE_CRYPTO_AEAD_AES_CCM,
+				.block_size = 16,
+				.key_size = {
+					.min = 16,
+					.max = 32,
+					.increment = 8
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 16,
+					.increment = 1
+				},
+				.aad_size = {
+					.min = 0,
+					.max = 65535,
+					.increment = 1
+				},
+				.iv_size = {
+					.min = 12,
+					.max = 12,
+					.increment = 0
+				}
+			}, }
+		}, }
+	},
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };