From: Radu Nicolau <radu.nicolau@intel.com>
To: dev@dpdk.org
Cc: Radu Nicolau <radu.nicolau@intel.com>, Kai Ji <kai.ji@intel.com>
Subject: [PATCH 1/3] crypto/qat: Add ECDH, ECDSA and ECPM capabilities
Date: Wed, 27 Aug 2025 09:23:56 +0000 [thread overview]
Message-ID: <20250827092358.765222-1-radu.nicolau@intel.com> (raw)
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
next reply other threads:[~2025-08-27 9:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-27 9:23 Radu Nicolau [this message]
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
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=20250827092358.765222-1-radu.nicolau@intel.com \
--to=radu.nicolau@intel.com \
--cc=dev@dpdk.org \
--cc=kai.ji@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).