* [PATCH] crypto/cnxk: fix ECDH pubkey verify
@ 2024-06-15 11:34 Gowrishankar Muthukrishnan
2024-06-17 6:40 ` Anoob Joseph
0 siblings, 1 reply; 3+ messages in thread
From: Gowrishankar Muthukrishnan @ 2024-06-15 11:34 UTC (permalink / raw)
To: dev, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj
Cc: Gowrishankar Muthukrishnan, stable
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-26 7:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-15 11:34 [PATCH] crypto/cnxk: fix ECDH pubkey verify Gowrishankar Muthukrishnan
2024-06-17 6:40 ` Anoob Joseph
2024-06-26 7:56 ` Akhil Goyal
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).