DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: gakhil@marvell.com
Cc: dev@dpdk.org
Subject: [PATCH v2 13/13] crypto/dpaax_sec: enable sha224-hmac support for IPsec
Date: Wed, 20 Sep 2023 19:04:03 +0530	[thread overview]
Message-ID: <20230920133403.6420-14-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20230920133403.6420-1-hemant.agrawal@nxp.com>

Enabling the SHA224 support in ipsec proto mode
for dpaax drivers.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/common/dpaax/caamflib/desc.h             |  5 ++++-
 drivers/common/dpaax/caamflib/desc/ipsec.h       |  5 +++++
 drivers/common/dpaax/caamflib/rta/protocol_cmd.h |  5 ++++-
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c      | 10 +++++++++-
 drivers/crypto/dpaa_sec/dpaa_sec.c               | 10 +++++++++-
 5 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/drivers/common/dpaax/caamflib/desc.h b/drivers/common/dpaax/caamflib/desc.h
index 635d6bad07..4a1285c4d4 100644
--- a/drivers/common/dpaax/caamflib/desc.h
+++ b/drivers/common/dpaax/caamflib/desc.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  *
  * Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016, 2019 NXP
+ * Copyright 2016, 2019, 2023 NXP
  *
  */
 
@@ -662,6 +662,9 @@ extern enum rta_sec_era rta_sec_era;
 #define OP_PCL_IPSEC_HMAC_SHA2_256_128		 0x000c
 #define OP_PCL_IPSEC_HMAC_SHA2_384_192		 0x000d
 #define OP_PCL_IPSEC_HMAC_SHA2_512_256		 0x000e
+#define OP_PCL_IPSEC_HMAC_SHA2_224_96		 0x00f2
+#define OP_PCL_IPSEC_HMAC_SHA2_224_112		 0x00f4
+#define OP_PCL_IPSEC_HMAC_SHA2_224_224		 0x00f8
 
 /* For SRTP - OP_PCLID_SRTP */
 #define OP_PCL_SRTP_CIPHER_MASK			 0xff00
diff --git a/drivers/common/dpaax/caamflib/desc/ipsec.h b/drivers/common/dpaax/caamflib/desc/ipsec.h
index 14e80baf77..95fc3ea5ba 100644
--- a/drivers/common/dpaax/caamflib/desc/ipsec.h
+++ b/drivers/common/dpaax/caamflib/desc/ipsec.h
@@ -710,6 +710,11 @@ static inline void __gen_auth_key(struct program *program,
 	case OP_PCL_IPSEC_HMAC_SHA2_512_256:
 		dkp_protid = OP_PCLID_DKP_SHA512;
 		break;
+	case OP_PCL_IPSEC_HMAC_SHA2_224_96:
+	case OP_PCL_IPSEC_HMAC_SHA2_224_112:
+	case OP_PCL_IPSEC_HMAC_SHA2_224_224:
+		dkp_protid = OP_PCLID_DKP_SHA224;
+		break;
 	default:
 		KEY(program, KEY2, authdata->key_enc_flags, authdata->key,
 		    authdata->keylen, INLINE_KEY(authdata));
diff --git a/drivers/common/dpaax/caamflib/rta/protocol_cmd.h b/drivers/common/dpaax/caamflib/rta/protocol_cmd.h
index ac5c8af716..5b33f103be 100644
--- a/drivers/common/dpaax/caamflib/rta/protocol_cmd.h
+++ b/drivers/common/dpaax/caamflib/rta/protocol_cmd.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  *
  * Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016,2019 NXP
+ * Copyright 2016,2019,2023 NXP
  *
  */
 
@@ -241,6 +241,9 @@ __rta_ipsec_proto(uint16_t protoinfo)
 	case OP_PCL_IPSEC_HMAC_MD5_128:
 	case OP_PCL_IPSEC_HMAC_SHA1_160:
 	case OP_PCL_IPSEC_AES_CMAC_96:
+	case OP_PCL_IPSEC_HMAC_SHA2_224_96:
+	case OP_PCL_IPSEC_HMAC_SHA2_224_112:
+	case OP_PCL_IPSEC_HMAC_SHA2_224_224:
 	case OP_PCL_IPSEC_HMAC_SHA2_256_128:
 	case OP_PCL_IPSEC_HMAC_SHA2_384_192:
 	case OP_PCL_IPSEC_HMAC_SHA2_512_256:
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 77ed68ad6d..bb5a2c629e 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -3005,6 +3005,15 @@ dpaa2_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,
 		authdata->algtype = OP_PCL_IPSEC_HMAC_MD5_96;
 		authdata->algmode = OP_ALG_AAI_HMAC;
 		break;
+	case RTE_CRYPTO_AUTH_SHA224_HMAC:
+		authdata->algmode = OP_ALG_AAI_HMAC;
+		if (session->digest_length == 6)
+			authdata->algtype = OP_PCL_IPSEC_HMAC_SHA2_224_96;
+		else if (session->digest_length == 14)
+			authdata->algtype = OP_PCL_IPSEC_HMAC_SHA2_224_224;
+		else
+			authdata->algtype = OP_PCL_IPSEC_HMAC_SHA2_224_112;
+		break;
 	case RTE_CRYPTO_AUTH_SHA256_HMAC:
 		authdata->algtype = OP_PCL_IPSEC_HMAC_SHA2_256_128;
 		authdata->algmode = OP_ALG_AAI_HMAC;
@@ -3032,7 +3041,6 @@ dpaa2_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,
 	case RTE_CRYPTO_AUTH_NULL:
 		authdata->algtype = OP_PCL_IPSEC_HMAC_NULL;
 		break;
-	case RTE_CRYPTO_AUTH_SHA224_HMAC:
 	case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
 	case RTE_CRYPTO_AUTH_SHA1:
 	case RTE_CRYPTO_AUTH_SHA256:
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 0fcba95916..a301e8edb2 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -2817,6 +2817,15 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,
 			"+++Using sha256-hmac truncated len is non-standard,"
 			"it will not work with lookaside proto");
 		break;
+	case RTE_CRYPTO_AUTH_SHA224_HMAC:
+		session->auth_key.algmode = OP_ALG_AAI_HMAC;
+		if (session->digest_length == 6)
+			session->auth_key.alg = OP_PCL_IPSEC_HMAC_SHA2_224_96;
+		else if (session->digest_length == 14)
+			session->auth_key.alg = OP_PCL_IPSEC_HMAC_SHA2_224_224;
+		else
+			session->auth_key.alg = OP_PCL_IPSEC_HMAC_SHA2_224_112;
+		break;
 	case RTE_CRYPTO_AUTH_SHA384_HMAC:
 		session->auth_key.alg = OP_PCL_IPSEC_HMAC_SHA2_384_192;
 		session->auth_key.algmode = OP_ALG_AAI_HMAC;
@@ -2836,7 +2845,6 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,
 		session->auth_key.alg = OP_PCL_IPSEC_AES_XCBC_MAC_96;
 		session->auth_key.algmode = OP_ALG_AAI_XCBC_MAC;
 		break;
-	case RTE_CRYPTO_AUTH_SHA224_HMAC:
 	case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
 	case RTE_CRYPTO_AUTH_SHA1:
 	case RTE_CRYPTO_AUTH_SHA256:
-- 
2.17.1


  parent reply	other threads:[~2023-09-20 13:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23  7:08 [PATCH 00/12] crypto/dpaax_sec: misc enhancements Hemant Agrawal
2023-08-23  7:08 ` [PATCH 01/12] common/dpaax: update IPsec base descriptor length Hemant Agrawal
2023-08-23  7:08 ` [PATCH 02/12] common/dpaax: change mode to wait in shared desc Hemant Agrawal
2023-08-23  7:08 ` [PATCH 03/12] crypto/dpaa2_sec: initialize the pdcp alg to null Hemant Agrawal
2023-08-23  7:08 ` [PATCH 04/12] crypto/dpaa2_sec: supporting null cipher and auth Hemant Agrawal
2023-08-23  7:08 ` [PATCH 05/12] crypto/dpaa_sec: " Hemant Agrawal
2023-08-23  7:08 ` [PATCH 06/12] crypto/dpaax_sec: set the authdata in non-auth case Hemant Agrawal
2023-08-23  7:08 ` [PATCH 07/12] crypto/dpaa2_sec: enhance dpaa FD FL FMT offset set Hemant Agrawal
2023-08-23  7:08 ` [PATCH 08/12] crypto/dpaa2_sec: support copy df and dscp in proto offload Hemant Agrawal
2023-08-23  7:08 ` [PATCH 09/12] crypto/dpaa2_sec: increase the anti replay window size Hemant Agrawal
2023-08-23  7:08 ` [PATCH 10/12] crypto/dpaa2_sec: enable esn support Hemant Agrawal
2023-08-23  7:08 ` [PATCH 11/12] crypto/dpaa2_sec: add NAT-T support in IPsec offload Hemant Agrawal
2023-08-23  7:08 ` [PATCH 12/12] crypto/dpaa2_sec: add support to set df and diffserv Hemant Agrawal
2023-09-18 10:31 ` [EXT] [PATCH 00/12] crypto/dpaax_sec: misc enhancements Akhil Goyal
2023-09-20 13:33 ` [PATCH v2 00/13] " Hemant Agrawal
2023-09-20 13:33   ` [PATCH v2 01/13] common/dpaax: update IPsec base descriptor length Hemant Agrawal
2023-09-20 13:33   ` [PATCH v2 02/13] common/dpaax: change mode to wait in shared desc Hemant Agrawal
2023-09-20 13:33   ` [PATCH v2 03/13] crypto/dpaa2_sec: initialize the pdcp alg to null Hemant Agrawal
2023-09-20 13:33   ` [PATCH v2 04/13] crypto/dpaa2_sec: supporting null cipher and auth Hemant Agrawal
2023-09-20 13:33   ` [PATCH v2 05/13] crypto/dpaa_sec: " Hemant Agrawal
2023-09-20 13:33   ` [PATCH v2 06/13] crypto/dpaax_sec: set the authdata in non-auth case Hemant Agrawal
2023-09-20 13:33   ` [PATCH v2 07/13] crypto/dpaa2_sec: enhance dpaa FD FL FMT offset set Hemant Agrawal
2023-09-20 13:33   ` [PATCH v2 08/13] crypto/dpaa2_sec: support copy df and dscp in proto offload Hemant Agrawal
2023-09-20 13:33   ` [PATCH v2 09/13] crypto/dpaa2_sec: increase the anti replay window size Hemant Agrawal
2023-09-20 13:34   ` [PATCH v2 10/13] crypto/dpaa2_sec: enable esn support Hemant Agrawal
2023-09-20 13:34   ` [PATCH v2 11/13] crypto/dpaa2_sec: add NAT-T support in IPsec offload Hemant Agrawal
2023-09-20 13:34   ` [PATCH v2 12/13] crypto/dpaa2_sec: add support to set df and diffserv Hemant Agrawal
2023-09-20 13:34   ` Hemant Agrawal [this message]
2023-09-21  8:05   ` [EXT] [PATCH v2 00/13] crypto/dpaax_sec: misc enhancements Akhil Goyal
2023-09-21  8:55     ` Hemant Agrawal

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=20230920133403.6420-14-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.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).