[v4,1/3] cryptodev: move dh type from xform to dh op

Message ID 20220427074400.2091-2-arkadiuszx.kusztal@intel.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series cryptodev: move dh type from xform to dh op |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Arkadiusz Kusztal April 27, 2022, 7:43 a.m. UTC
  Operation type (PUBLIC_KEY_GENERATION, SHARED_SECRET) should
be free to choose for any operation. One xform/session should
be enough to perform both DH operations, if op_type would be xform
member, session would have to be to be created twice for the same
group. Similar problem would be observed in sessionless case.
Additionally, it will help extend DH to support Elliptic Curves.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
 lib/cryptodev/rte_crypto_asym.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
  

Comments

Fan Zhang April 27, 2022, 8:11 a.m. UTC | #1
> -----Original Message-----
> From: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Sent: Wednesday, April 27, 2022 8:44 AM
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; Zhang, Roy Fan <roy.fan.zhang@intel.com>; Kusztal,
> ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Subject: [PATCH v4 1/3] cryptodev: move dh type from xform to dh op
> 
> Operation type (PUBLIC_KEY_GENERATION, SHARED_SECRET) should
> be free to choose for any operation. One xform/session should
> be enough to perform both DH operations, if op_type would be xform
> member, session would have to be to be created twice for the same
> group. Similar problem would be observed in sessionless case.
> Additionally, it will help extend DH to support Elliptic Curves.
> 
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> ---
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
  
Ji, Kai May 10, 2022, 9:26 a.m. UTC | #2
Acked-by: Kai Ji <kai.ji@intel.com>

> -----Original Message-----
> From: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> Sent: Wednesday, April 27, 2022 8:44 AM
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; Zhang, Roy Fan <roy.fan.zhang@intel.com>; Kusztal,
> ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Subject: [PATCH v4 1/3] cryptodev: move dh type from xform to dh op
> 
> Operation type (PUBLIC_KEY_GENERATION, SHARED_SECRET) should be free to
> choose for any operation. One xform/session should be enough to perform both
> DH operations, if op_type would be xform member, session would have to be to
> be created twice for the same group. Similar problem would be observed in
> sessionless case.
> Additionally, it will help extend DH to support Elliptic Curves.
> 
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
  

Patch

diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h
index cd24d4b07b..4697a7bc59 100644
--- a/lib/cryptodev/rte_crypto_asym.h
+++ b/lib/cryptodev/rte_crypto_asym.h
@@ -256,8 +256,6 @@  struct rte_crypto_modinv_xform {
  *
  */
 struct rte_crypto_dh_xform {
-	enum rte_crypto_asym_op_type type;
-	/**< Setup xform for key generate or shared secret compute */
 	rte_crypto_uint p;
 	/**< Prime modulus data */
 	rte_crypto_uint g;
@@ -391,27 +389,29 @@  struct rte_crypto_rsa_op_param {
  * @note:
  */
 struct rte_crypto_dh_op_param {
+	enum rte_crypto_asym_op_type op_type;
+	/**< Diffie-Hellman operation type */
 	rte_crypto_uint pub_key;
 	/**<
-	 * Output generated public key when xform type is
+	 * Output generated public key when op_type is
 	 * DH PUB_KEY_GENERATION.
-	 * Input peer public key when xform type is DH
+	 * Input peer public key when op_type is DH
 	 * SHARED_SECRET_COMPUTATION
 	 *
 	 */
 
 	rte_crypto_uint priv_key;
 	/**<
-	 * Output generated private key if xform type is
+	 * Output generated private key if op_type is
 	 * DH PRIVATE_KEY_GENERATION
-	 * Input when xform type is DH SHARED_SECRET_COMPUTATION.
+	 * Input when op_type is DH SHARED_SECRET_COMPUTATION.
 	 *
 	 */
 
 	rte_crypto_uint shared_secret;
 	/**<
 	 * Output with calculated shared secret
-	 * when dh xform set up with op type = SHARED_SECRET_COMPUTATION.
+	 * when dh op_type = SHARED_SECRET_COMPUTATION.
 	 *
 	 */
 };