patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>, Ankur Dwivedi <adwivedi@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>,
	Tejasree Kondoj <ktejasree@marvell.com>
Cc: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>, <stable@dpdk.org>
Subject: [PATCH] crypto/cnxk: fix ECDH pubkey verify
Date: Sat, 15 Jun 2024 17:04:31 +0530	[thread overview]
Message-ID: <20240615113434.2331-1-gmuthukrishn@marvell.com> (raw)

Fix dequeue operation for ECDH pubkey verify.

Fixes: baae0994fa96 ("crypto/cnxk: support ECDH")
Fixes: 5c9025583167 ("crypto/cnxk: fix CN9K ECDH public key verification")
Cc: stable@dpdk.org

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 23 ++++++++++++++---------
 drivers/crypto/cnxk/cn9k_cryptodev_ops.c  | 21 +++++++++++++--------
 2 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 720b756001..07bd13b16d 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -1186,15 +1186,20 @@ cn10k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop
 
 		return;
 	} else if (cop->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC &&
-			   cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION &&
-			   cop->asym->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY) {
-		if (likely(compcode == CPT_COMP_GOOD)) {
-			if (uc_compcode == ROC_AE_ERR_ECC_POINT_NOT_ON_CURVE) {
-				cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
-				return;
-			} else if (uc_compcode == ROC_AE_ERR_ECC_PAI) {
-				cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
-				return;
+		   cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
+		struct cnxk_ae_sess *sess;
+
+		sess = (struct cnxk_ae_sess *)cop->asym->session;
+		if (sess->xfrm_type == RTE_CRYPTO_ASYM_XFORM_ECDH &&
+		    cop->asym->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY) {
+			if (likely(compcode == CPT_COMP_GOOD)) {
+				if (uc_compcode == ROC_AE_ERR_ECC_POINT_NOT_ON_CURVE) {
+					cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
+					return;
+				} else if (uc_compcode == ROC_AE_ERR_ECC_PAI) {
+					cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+					return;
+				}
 			}
 		}
 	}
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index 96a75a7797..f443cb9563 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -523,14 +523,19 @@ cn9k_cpt_dequeue_post_process(struct cnxk_cpt_qp *qp, struct rte_crypto_op *cop,
 			if (res->uc_compcode == ROC_SE_ERR_GC_ICV_MISCOMPARE)
 				cop->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
 			else if (cop->type == RTE_CRYPTO_OP_TYPE_ASYMMETRIC &&
-				 cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION &&
-				 cop->asym->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY) {
-				if (res->uc_compcode == ROC_AE_ERR_ECC_POINT_NOT_ON_CURVE) {
-					cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
-					return;
-				} else if (res->uc_compcode == ROC_AE_ERR_ECC_PAI) {
-					cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
-					return;
+				 cop->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
+				struct cnxk_ae_sess *sess;
+
+				sess = (struct cnxk_ae_sess *)cop->asym->session;
+				if (sess->xfrm_type == RTE_CRYPTO_ASYM_XFORM_ECDH &&
+				    cop->asym->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY) {
+					if (res->uc_compcode == ROC_AE_ERR_ECC_POINT_NOT_ON_CURVE) {
+						cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
+						return;
+					} else if (res->uc_compcode == ROC_AE_ERR_ECC_PAI) {
+						cop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+						return;
+					}
 				}
 			} else
 				cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
-- 
2.25.1


             reply	other threads:[~2024-06-15 11:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-15 11:34 Gowrishankar Muthukrishnan [this message]
2024-06-17  6:40 ` Anoob Joseph
2024-06-26  7:56   ` 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=20240615113434.2331-1-gmuthukrishn@marvell.com \
    --to=gmuthukrishn@marvell.com \
    --cc=adwivedi@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ktejasree@marvell.com \
    --cc=stable@dpdk.org \
    /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).