DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/3] crypto/qat: Add ECDH, ECDSA and ECPM capabilities
@ 2025-08-27  9:23 Radu Nicolau
  2025-08-27  9:23 ` [PATCH 2/3] test/crypto: add QAT EC tests Radu Nicolau
  2025-08-27  9:23 ` [PATCH 3/3] crypto/qat: fix ECDH implementation Radu Nicolau
  0 siblings, 2 replies; 4+ messages in thread
From: Radu Nicolau @ 2025-08-27  9:23 UTC (permalink / raw)
  To: dev; +Cc: Radu Nicolau, Kai Ji

Add missing eliptic curves capabilities.
Small fixes on ECDH implementation.

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 drivers/crypto/qat/dev/qat_asym_pmd_gen1.c | 13 +++++++++++++
 drivers/crypto/qat/qat_asym.c              |  9 +++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/qat/dev/qat_asym_pmd_gen1.c b/drivers/crypto/qat/dev/qat_asym_pmd_gen1.c
index 67b1892c32..20001bd1cc 100644
--- a/drivers/crypto/qat/dev/qat_asym_pmd_gen1.c
+++ b/drivers/crypto/qat/dev/qat_asym_pmd_gen1.c
@@ -38,6 +38,19 @@ static struct rte_cryptodev_capabilities qat_asym_crypto_caps_gen1[] = {
 			(1 << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
 			(1 << RTE_CRYPTO_ASYM_OP_DECRYPT)),
 			64, 512, 64),
+	QAT_ASYM_CAP(ECDH,
+			((1 << RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE) |
+			(1 << RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE) |
+			(1 << RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY)),
+			64, 512, 64),
+	QAT_ASYM_CAP(ECDSA,
+			((1 << RTE_CRYPTO_ASYM_OP_SIGN) |
+			(1 << RTE_CRYPTO_ASYM_OP_VERIFY)),
+			64, 512, 64),
+	QAT_ASYM_CAP(ECPM,
+			((1 << RTE_CRYPTO_ASYM_OP_SIGN) |
+			(1 << RTE_CRYPTO_ASYM_OP_VERIFY)),
+			64, 512, 64),
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c
index d8a1406819..bd22fc0a6f 100644
--- a/drivers/crypto/qat/qat_asym.c
+++ b/drivers/crypto/qat/qat_asym.c
@@ -801,11 +801,14 @@ ecdh_set_input(struct icp_qat_fw_pke_request *qat_req,
 		SET_PKE_LN(asym_op->ecdh.priv_key, qat_func_alignsize, 0);
 		SET_PKE_LN_EC(curve[curve_id], x, 1);
 		SET_PKE_LN_EC(curve[curve_id], y, 2);
-	} else {
+	} else if (asym_op->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE) {
 		SET_PKE_LN(asym_op->ecdh.priv_key, qat_func_alignsize, 0);
 		SET_PKE_LN(asym_op->ecdh.pub_key.x, qat_func_alignsize, 1);
 		SET_PKE_LN(asym_op->ecdh.pub_key.y, qat_func_alignsize, 2);
+	} else {
+		return -EINVAL;
 	}
+
 	SET_PKE_LN_EC(curve[curve_id], a, 3);
 	SET_PKE_LN_EC(curve[curve_id], b, 4);
 	SET_PKE_LN_EC(curve[curve_id], p, 5);
@@ -894,11 +897,13 @@ ecdh_collect(struct rte_crypto_asym_op *asym_op,
 		asym_op->ecdh.pub_key.y.length = alg_bytesize;
 		x = asym_op->ecdh.pub_key.x.data;
 		y = asym_op->ecdh.pub_key.y.data;
-	} else {
+	} else if (asym_op->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE) {
 		asym_op->ecdh.shared_secret.x.length = alg_bytesize;
 		asym_op->ecdh.shared_secret.y.length = alg_bytesize;
 		x = asym_op->ecdh.shared_secret.x.data;
 		y = asym_op->ecdh.shared_secret.y.data;
+	} else {
+		return -EINVAL;
 	}
 
 	rte_memcpy(x, &cookie->output_array[0][ltrim], alg_bytesize);
-- 
2.50.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-27 14:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-27  9:23 [PATCH 1/3] crypto/qat: Add ECDH, ECDSA and ECPM capabilities Radu Nicolau
2025-08-27  9:23 ` [PATCH 2/3] test/crypto: add QAT EC tests Radu Nicolau
2025-08-27 14:31   ` Ji, Kai
2025-08-27  9:23 ` [PATCH 3/3] crypto/qat: fix ECDH implementation Radu Nicolau

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).