DPDK patches and discussions
 help / color / mirror / Atom feed
From: Arek Kusztal <arkadiuszx.kusztal@intel.com>
To: dev@dpdk.org
Cc: gakhil@marvell.com, roy.fan.zhang@intel.com,
	Arek Kusztal <arkadiuszx.kusztal@intel.com>
Subject: [PATCH v2 1/2] cryptodev: add dh verify option
Date: Wed, 13 Apr 2022 15:03:26 +0100	[thread overview]
Message-ID: <20220413140327.12915-2-arkadiuszx.kusztal@intel.com> (raw)
In-Reply-To: <20220413140327.12915-1-arkadiuszx.kusztal@intel.com>

For some elliptic curves public point in DH exchange
needs to be checked, if lays on the curve.
Modular exponentiation needs certain checks as well, though
mathematically much easier.
This commit adds verify option to asym_op operations.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
 lib/cryptodev/rte_crypto_asym.h | 19 +++++++++++++++++++
 lib/cryptodev/rte_cryptodev.c   |  1 +
 2 files changed, 20 insertions(+)

diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h
index 5b30083f30..c4f4afa07f 100644
--- a/lib/cryptodev/rte_crypto_asym.h
+++ b/lib/cryptodev/rte_crypto_asym.h
@@ -117,6 +117,8 @@ enum rte_crypto_asym_op_type {
 	/**< DH Public Key generation operation */
 	RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE,
 	/**< DH Shared Secret compute operation */
+	RTE_CRYPTO_ASYM_OP_DH_KEY_VERIFY,
+	/**< DH Public Key Verification */
 	RTE_CRYPTO_ASYM_OP_LIST_END
 };
 
@@ -412,6 +414,11 @@ struct rte_crypto_dh_op_param {
 	 * For ECDH it is a point on the curve.
 	 * Output for RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE
 	 * Input for RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE
+	 * Input for RTE_CRYPTO_ASYM_OP_DH_KEY_VERIFY
+	 *
+	 * VERIFY option can be used only for elliptic curve
+	 * point validation, for FFDH (DH) it is user's reponsability
+	 * to check the public key accordingly.
 	 */
 
 	union {
@@ -424,6 +431,18 @@ struct rte_crypto_dh_op_param {
 	 * For ECDH it is a point on the curve.
 	 * Output for RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE
 	 */
+	 uint16_t flags;
+	 /*
+	  * Diffie-Hellman operation flags
+	  * Flag                | Bit pos |      Description
+	  *--------------------------------------------------------------------------------
+	  *                     |         | If set to 1 - verification will use all four
+	  * Full verification   |    0    | steps of point verification (full validation),
+	  *                     |         | otherwise three (partial validation - default).
+	  *--------------------------------------------------------------------------------
+	  * Reserved            |   1-15  | Reserved
+	  */
+
 };
 
 /**
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 3500a2d470..2679ef54f8 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -181,6 +181,7 @@ const char *rte_crypto_asym_op_strings[] = {
 	[RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE]	= "priv_key_generate",
 	[RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE] = "pub_key_generate",
 	[RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE] = "sharedsecret_compute",
+	[RTE_CRYPTO_ASYM_OP_DH_KEY_VERIFY] = "dh_pubkey_verify",
 };
 
 /**
-- 
2.13.6


  reply	other threads:[~2022-04-13 14:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13 14:03 [PATCH v2 0/2] " Arek Kusztal
2022-04-13 14:03 ` Arek Kusztal [this message]
2022-05-16 18:50   ` [EXT] [PATCH v2 1/2] " Akhil Goyal
2022-04-13 14:03 ` [PATCH v2 2/2] cryptodev: add dh padding options Arek Kusztal
2022-05-16 18:51   ` [EXT] " 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=20220413140327.12915-2-arkadiuszx.kusztal@intel.com \
    --to=arkadiuszx.kusztal@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=roy.fan.zhang@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).