From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4399E4599D; Fri, 20 Sep 2024 15:10:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 035C3433A0; Fri, 20 Sep 2024 15:10:12 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 97ED2427C9 for ; Fri, 20 Sep 2024 15:10:10 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48KCprDD025726; Fri, 20 Sep 2024 06:10:06 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=2 P3+ZO5cR4blZxMjB62fZXsMKeg32UgZfr1CIsnTsVg=; b=YdBtQprBLLSmsEACb ROwMi1AzIQ+RaMrPOaOWxAko/v1SRLdF7BE36Z1VzS/+ax9BFRjgYWzqqew+URQC e6WTLUDkOD7fOfMLPEwfUC9LsfzxddMMX4DA1Q7JPIg44gNpAgxfardnUkY+hGcr 5jQyKB05Dtic6Pf7AnuuZRorzFCf3v8SlzaXxGbYiwJl5dECLlSD38nIL8OhAmOA tf1Uk2LckBtVDMVC0s4qimjQauEjE4FM8WpQm94gfLPib9Z3DLxEUVaHiyC1HQAa cs9kGNRpW+oKxSiFjly0k/ZOUc5e4rZmYTXHfG+jvuAQKQR0koTVsCQ/mCRxszKd yST3A== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 41qdwgpnvs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2024 06:10:05 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 20 Sep 2024 06:10:04 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 20 Sep 2024 06:10:04 -0700 Received: from BG-LT91401.marvell.com (BG-LT91401.marvell.com [10.193.65.223]) by maili.marvell.com (Postfix) with ESMTP id 20C5F5B6923; Fri, 20 Sep 2024 06:09:58 -0700 (PDT) From: Gowrishankar Muthukrishnan To: , Akhil Goyal , Fan Zhang CC: Anoob Joseph , , , , , , , , , , , , , Gowrishankar Muthukrishnan Subject: [PATCH v3 1/6] cryptodev: add EDDSA asymmetric crypto algorithm Date: Fri, 20 Sep 2024 18:39:43 +0530 Message-ID: <20240920130950.1297-1-gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20240905133933.741-3-gmuthukrishn@marvell.com> References: <20240905133933.741-3-gmuthukrishn@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: BjLuJ_glrBeZJP_FUbzKb-_4pR6xRwsz X-Proofpoint-ORIG-GUID: BjLuJ_glrBeZJP_FUbzKb-_4pR6xRwsz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add support for asymmetric EDDSA in cryptodev, as referenced in RFC: https://datatracker.ietf.org/doc/html/rfc8032 Signed-off-by: Gowrishankar Muthukrishnan --- doc/guides/cryptodevs/features/default.ini | 1 + doc/guides/prog_guide/cryptodev_lib.rst | 2 +- lib/cryptodev/rte_crypto_asym.h | 47 ++++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/doc/guides/cryptodevs/features/default.ini b/doc/guides/cryptodevs/features/default.ini index f411d4bab7..3073753911 100644 --- a/doc/guides/cryptodevs/features/default.ini +++ b/doc/guides/cryptodevs/features/default.ini @@ -130,6 +130,7 @@ ECDSA = ECPM = ECDH = SM2 = +EDDSA = ; ; Supported Operating systems of a default crypto driver. diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst index 2b513bbf82..dd636ba5ef 100644 --- a/doc/guides/prog_guide/cryptodev_lib.rst +++ b/doc/guides/prog_guide/cryptodev_lib.rst @@ -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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h index 39d3da3952..11bb885d64 100644 --- a/lib/cryptodev/rte_crypto_asym.h +++ b/lib/cryptodev/rte_crypto_asym.h @@ -49,6 +49,10 @@ rte_crypto_asym_op_strings[]; * and if the flag is not set, shared secret will be padded to the left with * zeros to the size of the underlying algorithm (default) */ +#define RTE_CRYPTO_ASYM_FLAG_PUB_KEY_COMPRESSED RTE_BIT32(2) +/**< + * Flag to denote public key will be returned in compressed form + */ /** * List of elliptic curves. This enum aligns with @@ -65,9 +69,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 @@ -119,6 +136,10 @@ enum rte_crypto_asym_xform_type { * Performs Encrypt, Decrypt, Sign and Verify. * Refer to rte_crypto_asym_op_type. */ + RTE_CRYPTO_ASYM_XFORM_EDDSA, + /**< Edwards Curve Digital Signature Algorithm + * Perform Signature Generation and Verification. + */ RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END /**< End of list */ }; @@ -585,6 +606,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 */ @@ -720,6 +766,7 @@ struct rte_crypto_asym_op { struct rte_crypto_ecdsa_op_param ecdsa; struct rte_crypto_ecpm_op_param ecpm; struct rte_crypto_sm2_op_param sm2; + struct rte_crypto_eddsa_op_param eddsa; }; uint16_t flags; /**< -- 2.21.0