DPDK patches and discussions
 help / color / mirror / Atom feed
From: Fan Zhang <roy.fan.zhang@intel.com>
To: dev@dpdk.org
Cc: gakhil@marvell.com, Fan Zhang <roy.fan.zhang@intel.com>,
	Declan Doherty <declan.doherty@intel.com>,
	Radu Nicolau <radu.nicolau@intel.com>
Subject: [PATCH v2] crypto/ipsec_mb: add NULL/NULL support to aesni-mb
Date: Mon, 21 Feb 2022 13:39:46 +0000	[thread overview]
Message-ID: <20220221133946.2023823-1-roy.fan.zhang@intel.com> (raw)
In-Reply-To: <20210907090715.460856-1-radu.nicolau@intel.com>

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(+)

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 = {
-- 
2.25.1


  parent reply	other threads:[~2022-02-21 13:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07  9:07 [dpdk-dev] [PATCH 1/3] crypto/aesni_mb: add NULL/NULL support Radu Nicolau
2021-09-07  9:07 ` [dpdk-dev] [PATCH 2/3] crypto/aesni_mb: add AES CCM 192-bit key support Radu Nicolau
2021-09-07  9:07 ` [dpdk-dev] [PATCH 3/3] crypto/aesni_gcm: add AES CCM support Radu Nicolau
2021-10-08 12:21 ` [dpdk-dev] [EXT] [PATCH 1/3] crypto/aesni_mb: add NULL/NULL support Akhil Goyal
2021-10-08 12:49   ` Zhang, Roy Fan
2021-10-08 18:18     ` Akhil Goyal
2021-10-11  8:47       ` Nicolau, Radu
2022-02-21 13:39 ` Fan Zhang [this message]
2022-02-22 19:07   ` [EXT] [PATCH v2] crypto/ipsec_mb: add NULL/NULL support to aesni-mb 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=20220221133946.2023823-1-roy.fan.zhang@intel.com \
    --to=roy.fan.zhang@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=radu.nicolau@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).