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 E569945A97; Thu, 3 Oct 2024 20:21:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AC2A64066C; Thu, 3 Oct 2024 20:21:28 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 6F19240663 for ; Thu, 3 Oct 2024 20:21:26 +0200 (CEST) Received: from pps.filterd (m0431383.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 493HwCru016556; Thu, 3 Oct 2024 11:21:23 -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=M dss0WcurW9MlIiV8L0iyu95VEi7LiTYKiZ4CMFIAeQ=; b=laVJwnxXtZrKpkwju mDkqTnbx194gjkUTvkzASOr07xbPUY2oxbDV0CVJ0jw6y6oEaqib3kCQwlDXpkEh 8E0sg6Cd4Z2DCFHREA6BMr16UTrzEilxUzVFlsFslPbYWIk3iY6FAT8DrYYkB4Uw /exn49uqMC8KfMFLK/xR9lrpw99/cN8/SHbq8Jzu5+CnvgFERr6pQXfKbD/loOnA eI/Eii/lauF1WpCEVlJyXpPSb7wOVz36Y9KvUYbX5fC9wskt7TjJuEzfObPfpHds v6ysdsB/vRiEzrfc9IaWDsBM2uk3H+l8MPN77hmVw5u/WFw4BYEmt0yFp6mWvjRi Nt/Ig== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 42204t01r8-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Oct 2024 11:21:22 -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; Thu, 3 Oct 2024 11:21:18 -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; Thu, 3 Oct 2024 11:21:18 -0700 Received: from BG-LT91401.marvell.com (unknown [10.28.168.34]) by maili.marvell.com (Postfix) with ESMTP id C85F55E69DB; Thu, 3 Oct 2024 10:56:28 -0700 (PDT) From: Gowrishankar Muthukrishnan To: , Akhil Goyal , Fan Zhang CC: Anoob Joseph , , , , , , , , , , , , , Gowrishankar Muthukrishnan Subject: [PATCH v4 1/6] cryptodev: add EDDSA asymmetric crypto algorithm Date: Thu, 3 Oct 2024 23:26:17 +0530 Message-ID: <20241003175625.135-1-gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20240920130950.1297-1-gmuthukrishn@marvell.com> References: <20240920130950.1297-1-gmuthukrishn@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: xVko8qlLJWEpYaP9M6q-XhZZhNa_Tma8 X-Proofpoint-ORIG-GUID: xVko8qlLJWEpYaP9M6q-XhZZhNa_Tma8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.687,Hydra:6.0.235,FMLib:17.0.607.475 definitions=2020-10-13_15,2020-10-13_02,2020-04-07_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..fe4194c184 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