Skip to contentSkip to conversation

cryptodev: support EDDSA

PATCH In review Sachin Yaligar 2 participants 2 messages Mar 28, 2023 – May 16, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cryptodev: support EDDSA

Asymmetric crypto library is extended to add EDDSA. Edwards curve operation params are introduced.

Change-Id I939d7646f95723113fa9f3bdbc01c0aeb4620e74
---
 .mailmap                                   |  1 +
 doc/guides/cryptodevs/features/default.ini |  1 +
 doc/guides/prog_guide/cryptodev_lib.rst    |  2 +-
 lib/cryptodev/rte_crypto_asym.h            | 39 +++++++++++++++++++++-
 4 files changed, 41 insertions(+), 2 deletions(-)
.mailmap +1 -0
index cac02a6f48..6d92b56560 100644
@@ -1169,6 +1169,7 @@ Rushil Gupta <[email protected]>
 Ryan E Hall <[email protected]>
 Sabyasachi Sengupta <[email protected]>
 Sachin Saxena <[email protected]> <[email protected]>
+Sachin Yaligar <[email protected]>
 Sagar Abhang <[email protected]>
 Sagi Grimberg <[email protected]>
 Saikrishna Edupuganti <[email protected]>
doc/guides/cryptodevs/features/default.ini +1 -0
index 523da0cfa8..247a56be6e 100644
@@ -125,6 +125,7 @@ Diffie-hellman          =
 ECDSA                   =
 ECPM                    =
 ECDH                    =
+EDDSA			=
 
 ;
 ; Supported Operating systems of a default crypto driver.
doc/guides/prog_guide/cryptodev_lib.rst +1 -1
index 2b513bbf82..358dbbc768 100644
@@ -927,7 +927,7 @@ Asymmetric Cryptography
 The cryptodev library currently provides support for the following asymmetric
 Crypto operations; RSA, Modular exponentiation and inversion, Diffie-Hellman and
 Elliptic Curve Diffie-Hellman public and/or private key generation and shared
-secret compute, DSA Signature generation and verification.
+secret compute, DSA and Edward's curve DSA Signature generation and verification.
 
 Session and Session Management
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/cryptodev/rte_crypto_asym.h +38 -1
index 989f38323f..fc7172b070 100644
@@ -69,7 +69,9 @@ enum rte_crypto_curve_id {
 	RTE_CRYPTO_EC_GROUP_SECP224R1 = 21,
 	RTE_CRYPTO_EC_GROUP_SECP256R1 = 23,
 	RTE_CRYPTO_EC_GROUP_SECP384R1 = 24,
-	RTE_CRYPTO_EC_GROUP_SECP521R1 = 25
+	RTE_CRYPTO_EC_GROUP_SECP521R1 = 25,
+	RTE_CRYPTO_EC_GROUP_ED25519 = 29,
+	RTE_CRYPTO_EC_GROUP_ED448 = 30
 };
 
 /**
@@ -113,6 +115,10 @@ enum rte_crypto_asym_xform_type {
 	/**< Elliptic Curve Digital Signature Algorithm
 	 * Perform Signature Generation and Verification.
 	 */
+	RTE_CRYPTO_ASYM_XFORM_EDDSA,
+	/**< Edwards Curve Digital Signature Algorithm
+	 * Perform Signature Generation and Verification.
+	 */
 	RTE_CRYPTO_ASYM_XFORM_ECDH,
 	/**< Elliptic Curve Diffie Hellman */
 	RTE_CRYPTO_ASYM_XFORM_ECPM,
@@ -591,6 +597,36 @@ struct rte_crypto_ecdsa_op_param {
 	 */
 };
 
+/**
+ * EDDSA operation params
+ */
+struct rte_crypto_eddsa_op_param {
+	enum rte_crypto_asym_op_type op_type;
+	/**< Signature generation or verification */
+
+	rte_crypto_uint pkey;
+	/**< Private key of the signer for signature generation */
+
+	struct rte_crypto_ec_point q;
+	/**< Public key of the signer derived from private key
+	 *	h = hash(pkey), q = (h[0-31] * B)
+	 */
+
+	rte_crypto_param message;
+	/**< Input message digest to be signed or verified */
+
+	rte_crypto_uint r;
+	/**< r component of edward curve signature
+	 *     output : for signature generation
+	 *     input  : for signature verification
+	 */
+	rte_crypto_uint s;
+	/**< s component of edward curve signature
+	 *     output : for signature generation
+	 *     input  : for signature verification
+	 */
+};
+
 /**
  * Structure for EC point multiplication operation param
  */
@@ -664,6 +700,7 @@ struct rte_crypto_asym_op {
 		struct rte_crypto_ecdh_op_param ecdh;
 		struct rte_crypto_dsa_op_param dsa;
 		struct rte_crypto_ecdsa_op_param ecdsa;
+		struct rte_crypto_eddsa_op_param eddsa;
 		struct rte_crypto_ecpm_op_param ecpm;
 	};
 	uint16_t flags;
Signature · 1 line
2.40.0
#1 lore raw

Hi Sachin,

Quoted 4 lines

Subject: [PATCH v1 1/1] cryptodev: support EDDSA

Asymmetric crypto library is extended to add EDDSA. Edwards curve operation params are introduced.

EDDSA -> EdDSA in patch title and description

Quoted 3 lines
Change-Id I939d7646f95723113fa9f3bdbc01c0aeb4620e74

Remove change-id

Quoted 7 lines
---
 .mailmap                                   |  1 +
 doc/guides/cryptodevs/features/default.ini |  1 +
 doc/guides/prog_guide/cryptodev_lib.rst    |  2 +-
 lib/cryptodev/rte_crypto_asym.h            | 39 +++++++++++++++++++++-
 4 files changed, 41 insertions(+), 2 deletions(-)

Please also add release notes for adding the new algorithm.

Quoted 68 lines
.mailmap +1 -0
index cac02a6f48..6d92b56560 100644
@@ -1169,6 +1169,7 @@ Rushil Gupta <[email protected]>
 Ryan E Hall <[email protected]>
 Sabyasachi Sengupta <[email protected]>
 Sachin Saxena <[email protected]> <[email protected]>
+Sachin Yaligar <[email protected]>
 Sagar Abhang <[email protected]>
 Sagi Grimberg <[email protected]>
 Saikrishna Edupuganti <[email protected]>
doc/guides/cryptodevs/features/default.ini +1 -0
index 523da0cfa8..247a56be6e 100644
@@ -125,6 +125,7 @@ Diffie-hellman          =
 ECDSA                   =
 ECPM                    =
 ECDH                    =
+EDDSA			=
 
 ;
 ; Supported Operating systems of a default crypto driver.
doc/guides/prog_guide/cryptodev_lib.rst +0 -0
index 2b513bbf82..358dbbc768 100644
@@ -927,7 +927,7 @@ Asymmetric Cryptography
 The cryptodev library currently provides support for the following asymmetric
 Crypto operations; RSA, Modular exponentiation and inversion, Diffie-Hellman

and
Elliptic Curve Diffie-Hellman public and/or private key generation and shared

doc/guides/prog_guide/cryptodev_lib.rst +1 -1
-secret compute, DSA Signature generation and verification.
+secret compute, DSA and Edward's curve DSA Signature generation and

verification.

Session and Session Management
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/cryptodev/rte_crypto_asym.h +7 -1
index 989f38323f..fc7172b070 100644
@@ -69,7 +69,9 @@ enum rte_crypto_curve_id {
 	RTE_CRYPTO_EC_GROUP_SECP224R1 = 21,
 	RTE_CRYPTO_EC_GROUP_SECP256R1 = 23,
 	RTE_CRYPTO_EC_GROUP_SECP384R1 = 24,
-	RTE_CRYPTO_EC_GROUP_SECP521R1 = 25
+	RTE_CRYPTO_EC_GROUP_SECP521R1 = 25,
+	RTE_CRYPTO_EC_GROUP_ED25519 = 29,
+	RTE_CRYPTO_EC_GROUP_ED448 = 30
 };
 
 /**
@@ -113,6 +115,10 @@ enum rte_crypto_asym_xform_type {
 	/**< Elliptic Curve Digital Signature Algorithm
 	 * Perform Signature Generation and Verification.
 	 */
+	RTE_CRYPTO_ASYM_XFORM_EDDSA,
+	/**< Edwards Curve Digital Signature Algorithm
+	 * Perform Signature Generation and Verification.
+	 */
 	RTE_CRYPTO_ASYM_XFORM_ECDH,
 	/**< Elliptic Curve Diffie Hellman */
 	RTE_CRYPTO_ASYM_XFORM_ECPM,

lib/cryptodev/rte_crypto_asym.h struct rte_crypto_ecdsa_op_param { · line 605

Quoted 9 lines
lib/cryptodev/rte_crypto_asym.h +6 -0
@@ -591,6 +597,36 @@ struct rte_crypto_ecdsa_op_param {
 	 */
 };
 
+/**
+ * EDDSA operation params
+ */
+struct rte_crypto_eddsa_op_param {
+	enum rte_crypto_asym_op_type op_type;
+	/**< Signature generation or verification */

Please add '.' at end of sentences.

Quoted 4 lines
lib/cryptodev/rte_crypto_asym.h +4 -0
+
+	rte_crypto_uint pkey;
+	/**< Private key of the signer for signature generation */
+

lib/cryptodev/rte_crypto_asym.h struct rte_crypto_ecdsa_op_param { · line 619

Quoted 10 lines
lib/cryptodev/rte_crypto_asym.h +10 -0
+	struct rte_crypto_ec_point q;
+	/**< Public key of the signer derived from private key
+	 *	h = hash(pkey), q = (h[0-31] * B)
+	 */
+
+	rte_crypto_param message;
+	/**< Input message digest to be signed or verified */
+
+	rte_crypto_uint r;
+	/**< r component of edward curve signature

edward -> Edward

Quoted 14 lines
lib/cryptodev/rte_crypto_asym.h +10 -0
+	 *     output : for signature generation
+	 *     input  : for signature verification
+	 */
+	rte_crypto_uint s;
+	/**< s component of edward curve signature
+	 *     output : for signature generation
+	 *     input  : for signature verification
+	 */
+};
+
 /**
  * Structure for EC point multiplication operation param
  */

lib/cryptodev/rte_crypto_asym.h struct rte_crypto_asym_op { · line 706

Quoted 7 lines
lib/cryptodev/rte_crypto_asym.h +1 -0
@@ -664,6 +700,7 @@ struct rte_crypto_asym_op {
 		struct rte_crypto_ecdh_op_param ecdh;
 		struct rte_crypto_dsa_op_param dsa;
 		struct rte_crypto_ecdsa_op_param ecdsa;
+		struct rte_crypto_eddsa_op_param eddsa;
 		struct rte_crypto_ecpm_op_param ecpm;
 	};
 	uint16_t flags;

I see that the changes in rte_crypto_asym_xform are missing for EdDSA.

Also please send the corresponding patches for the driver and test app.