[v1,1/3] cryptodev: add EDDSA asymmetric crypto algorithm
Checks
Commit Message
Add support for asymmetric EDDSA in cryptodev, as referenced in RFC:
https://datatracker.ietf.org/doc/html/rfc8032
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
doc/guides/cryptodevs/features/default.ini | 1 +
doc/guides/prog_guide/cryptodev_lib.rst | 2 +-
lib/cryptodev/rte_crypto_asym.h | 51 +++++++++++++++++++++-
3 files changed, 52 insertions(+), 2 deletions(-)
@@ -130,6 +130,7 @@ ECDSA =
ECPM =
ECDH =
SM2 =
+EDDSA =
;
; Supported Operating systems of a default crypto driver.
@@ -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 EdDSA Signature generation and verification.
Session and Session Management
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -65,9 +65,22 @@ enum rte_crypto_curve_id {
RTE_CRYPTO_EC_GROUP_SECP256R1 = 23,
RTE_CRYPTO_EC_GROUP_SECP384R1 = 24,
RTE_CRYPTO_EC_GROUP_SECP521R1 = 25,
+ RTE_CRYPTO_EC_GROUP_ED25519 = 29,
+ RTE_CRYPTO_EC_GROUP_ED448 = 30,
RTE_CRYPTO_EC_GROUP_SM2 = 41,
};
+/**
+ * List of Edwards curve instances as per RFC 8032 (Section 5).
+ */
+enum rte_crypto_edward_instance {
+ RTE_CRYPTO_EDCURVE_25519,
+ RTE_CRYPTO_EDCURVE_25519CTX,
+ RTE_CRYPTO_EDCURVE_25519PH,
+ RTE_CRYPTO_EDCURVE_448,
+ RTE_CRYPTO_EDCURVE_448PH
+};
+
/**
* Asymmetric crypto transformation types.
* Each xform type maps to one asymmetric algorithm
@@ -108,6 +121,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,
@@ -376,7 +393,13 @@ struct rte_crypto_ec_xform {
rte_crypto_uint pkey;
/**< Private key */
- struct rte_crypto_ec_point q;
+ union {
+ struct rte_crypto_ec_point q;
+ /**< Elliptic curve point */
+
+ rte_crypto_uint qcomp;
+ /**< Elliptic curve point compressed */
+ };
/**< Public key */
};
@@ -585,6 +608,31 @@ 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_param message;
+ /**< Input message digest to be signed or verified */
+
+ rte_crypto_param context;
+ /**< Context value for the sign op.
+ * Must not be empty for Ed25519ctx instance.
+ */
+
+ enum rte_crypto_edward_instance instance;
+ /**< Type of Edwards curve. */
+
+ rte_crypto_uint sign;
+ /**< Edward curve signature
+ * output : for signature generation
+ * input : for signature verification
+ */
+};
+
/**
* Structure for EC point multiplication operation param
*/
@@ -718,6 +766,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;
struct rte_crypto_sm2_op_param sm2;
};