[v2] crypto/ipsec_mb: add NULL/NULL support to aesni-mb

Message ID 20220221133946.2023823-1-roy.fan.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series [v2] crypto/ipsec_mb: add NULL/NULL support to aesni-mb |

Checks

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

Commit Message

Fan Zhang Feb. 21, 2022, 1:39 p.m. UTC
  Add NULL cipher and auth support to AESNI-MB PMD type.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
v2:
- Added actual PMD support.

 drivers/crypto/ipsec_mb/pmd_aesni_mb.c      | 18 ++++++++++
 drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h | 37 +++++++++++++++++++++
 2 files changed, 55 insertions(+)
  

Comments

Akhil Goyal Feb. 22, 2022, 7:07 p.m. UTC | #1
> Add NULL cipher and auth support to AESNI-MB PMD type.
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> ---
Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index a308d42ffa..0111c6f540 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -88,6 +88,12 @@  aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr,
 	sess->auth.operation = xform->auth.op;
 
 	/* Set Authentication Parameters */
+	if (xform->auth.algo == RTE_CRYPTO_AUTH_NULL) {
+		sess->auth.algo = IMB_AUTH_NULL;
+		sess->auth.gen_digest_len = 0;
+		return 0;
+	}
+
 	if (xform->auth.algo == RTE_CRYPTO_AUTH_AES_XCBC_MAC) {
 		sess->auth.algo = IMB_AUTH_AES_XCBC;
 
@@ -434,6 +440,12 @@  aesni_mb_set_session_cipher_parameters(const IMB_MGR *mb_mgr,
 		sess->cipher.mode = IMB_CIPHER_KASUMI_UEA1_BITLEN;
 		is_kasumi = 1;
 		break;
+	case RTE_CRYPTO_CIPHER_NULL:
+		sess->cipher.mode = IMB_CIPHER_NULL;
+		sess->cipher.key_length_in_bytes = 0;
+		sess->iv.offset = xform->cipher.iv.offset;
+		sess->iv.length = xform->cipher.iv.length;
+		return 0;
 	default:
 		IPSEC_MB_LOG(ERR, "Unsupported cipher mode parameter");
 		return -ENOTSUP;
@@ -1324,6 +1336,12 @@  set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp,
 			session->iv.offset);
 	}
 
+	if (job->cipher_mode == IMB_CIPHER_NULL && oop) {
+		memcpy(job->dst + job->cipher_start_src_offset_in_bytes,
+			job->src + job->cipher_start_src_offset_in_bytes,
+			job->msg_len_to_cipher_in_bytes);
+	}
+
 	if (job->cipher_mode == IMB_CIPHER_ZUC_EEA3)
 		job->msg_len_to_cipher_in_bytes >>= 3;
 	else if (job->hash_alg == IMB_AUTH_KASUMI_UIA1)
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
index d37cc787a0..f46037ff76 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
@@ -275,6 +275,43 @@  static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* NULL (AUTH) */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_NULL,
+				.block_size = 1,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.iv_size = { 0 }
+			}, },
+		}, },
+	},
+	{	/* NULL (CIPHER) */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+			{.cipher = {
+				.algo = RTE_CRYPTO_CIPHER_NULL,
+				.block_size = 1,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.iv_size = { 0 }
+			}, },
+		}, }
+	},
 	{	/* AES CBC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {