From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 002CDA04F2; Thu, 5 Dec 2019 12:44:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 20C981BF89; Thu, 5 Dec 2019 12:44:43 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 18F211BF88 for ; Thu, 5 Dec 2019 12:44:42 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xB5Bg0MQ020922; Thu, 5 Dec 2019 03:44:41 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=Z4SOkpa8d8dEcsVNBBThwG12U/wZUwVUV+N3+htWwYM=; b=B7WWsawCtNps+iq+XyL/+cKO6wQV8ove4Y5surbXIai5PkxkOcq8+t8y8ciz0pTMLrEK xdLYakUrj9Nax5b845CfDKXHVRICgdCnykDLGrAWWR4vKRf+uhUO0Qlu4YTNStAcbJnm 4XZzVzOfXqw2kmxuJgOjIRqrYkWrydpOOuHESSqXPPaOSsOb7nebOLZpvSeKdZjpdqxa 3mOsVw/guinQtCQJDMCHZ6TU9+d51S3uTrxT8aHFGBSo6I02j12BMgVuXwX0XkwSHOdp 5gY6uGqZlmhwfH41gvNmoc9oavDhu1XQPWX2+fJdaMWYDt3qNwfghlSYpbl+3NC7SoPc qA== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2wpybwgd51-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Dec 2019 03:44:41 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 03:44:39 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 5 Dec 2019 03:44:39 -0800 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.60]) by maili.marvell.com (Postfix) with ESMTP id 05A5D3F703F; Thu, 5 Dec 2019 03:44:34 -0800 (PST) From: Anoob Joseph To: Akhil Goyal , Declan Doherty , Pablo de Lara CC: Ayuj Verma , Fiona Trahe , Arek Kusztal , Jerin Jacob , Narayana Prasad , Shally Verma , Ankur Dwivedi , Sunila Sahu , , Anoob Joseph Date: Thu, 5 Dec 2019 17:13:23 +0530 Message-ID: <1575546206-2478-2-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1575546206-2478-1-git-send-email-anoobj@marvell.com> References: <1575546206-2478-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-05_03:2019-12-04,2019-12-05 signatures=0 Subject: [dpdk-dev] [PATCH 1/4] lib/crypto: add support for ECDSA X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Ayuj Verma Elliptic curve xform and ECDSA op params are added. Signed-off-by: Anoob Joseph Signed-off-by: Ayuj Verma Signed-off-by: Sunila Sahu --- doc/guides/cryptodevs/features/default.ini | 11 ++-- lib/librte_cryptodev/rte_crypto_asym.h | 83 ++++++++++++++++++++++++++++++ lib/librte_cryptodev/rte_cryptodev.c | 1 + 3 files changed, 90 insertions(+), 5 deletions(-) diff --git a/doc/guides/cryptodevs/features/default.ini b/doc/guides/cryptodevs/features/default.ini index b7f9a0a..2f6c785 100644 --- a/doc/guides/cryptodevs/features/default.ini +++ b/doc/guides/cryptodevs/features/default.ini @@ -103,8 +103,9 @@ AES CCM (256) = ; Supported Asymmetric algorithms of a default crypto driver. ; [Asymmetric] -RSA = -DSA = -Modular Exponentiation = -Modular Inversion = -Diffie-hellman = \ No newline at end of file +RSA = +DSA = +Modular Exponentiation = +Modular Inversion = +Diffie-hellman = +ECDSA = diff --git a/lib/librte_cryptodev/rte_crypto_asym.h b/lib/librte_cryptodev/rte_crypto_asym.h index 0d34ce8..dd5e6e3 100644 --- a/lib/librte_cryptodev/rte_crypto_asym.h +++ b/lib/librte_cryptodev/rte_crypto_asym.h @@ -81,6 +81,10 @@ enum rte_crypto_asym_xform_type { /**< Modular Exponentiation * Perform Modular Exponentiation b^e mod n */ + RTE_CRYPTO_ASYM_XFORM_ECDSA, + /**< Elliptic Curve Digital Signature Algorithm + * Perform Signature Generation and Verification. + */ RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END /**< End of list */ }; @@ -319,6 +323,46 @@ struct rte_crypto_dsa_xform { }; /** + * TLS named curves + * https://www.iana.org/assignments/tls-parameters/ + * tls-parameters.xhtml#tls-parameters-8 + * secp192r1 = 19, + * secp224r1 = 21, + * secp256r1 = 23, + * secp384r1 = 24, + * secp521r1 = 25, + */ +enum rte_crypto_ec_group { + RTE_CRYPTO_EC_GROUP_UNKNOWN = 0, + RTE_CRYPTO_EC_GROUP_NISTP192 = 19, + RTE_CRYPTO_EC_GROUP_NISTP224 = 21, + RTE_CRYPTO_EC_GROUP_NISTP256 = 23, + RTE_CRYPTO_EC_GROUP_NISTP384 = 24, + RTE_CRYPTO_EC_GROUP_NISTP521 = 25, +}; + +/** + * Structure for elliptic curve point + */ +struct rte_crypto_ec_point { + rte_crypto_param x; + /**< X coordinate */ + rte_crypto_param y; + /**< Y coordinate */ +}; + +/** + * Asymmetric elliptic curve transform data + * + * Structure describing all EC based xform params + * + */ +struct rte_crypto_ec_xform { + enum rte_crypto_ec_group curve_id; + /**< Pre-defined ec groups */ +}; + +/** * Operations params for modular operations: * exponentiation and multiplicative inverse * @@ -372,6 +416,11 @@ struct rte_crypto_asym_xform { struct rte_crypto_dsa_xform dsa; /**< DSA xform parameters */ + + struct rte_crypto_ec_xform ec; + /**< EC xform parameters, used by elliptic curve based + * operations. + */ }; }; @@ -516,6 +565,39 @@ struct rte_crypto_dsa_op_param { }; /** + * ECDSA operation params + */ +struct rte_crypto_ecdsa_op_param { + enum rte_crypto_asym_op_type op_type; + /**< Signature generation or verification */ + + rte_crypto_param pkey; + /**< Private key of the signer for signature generation */ + + struct rte_crypto_ec_point q; + /**< Public key of the signer for verification */ + + rte_crypto_param message; + /**< Input message to be signed or verified */ + + rte_crypto_param k; + /**< The ECDSA per-message secret number, which is an integer + * in the interval (1, n-1) + */ + + rte_crypto_param r; + /**< r component of elliptic curve signature + * output : for signature generation + * input : for signature verification + */ + rte_crypto_param s; + /**< s component of elliptic curve signature + * output : for signature generation + * input : for signature verification + */ +}; + +/** * Asymmetric Cryptographic Operation. * * Structure describing asymmetric crypto operation params. @@ -537,6 +619,7 @@ struct rte_crypto_asym_op { struct rte_crypto_mod_op_param modinv; struct rte_crypto_dh_op_param dh; struct rte_crypto_dsa_op_param dsa; + struct rte_crypto_ecdsa_op_param ecdsa; }; }; diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 89aa2ed..0d6babb 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -173,6 +173,7 @@ const char *rte_crypto_asym_xform_strings[] = { [RTE_CRYPTO_ASYM_XFORM_MODINV] = "modinv", [RTE_CRYPTO_ASYM_XFORM_DH] = "dh", [RTE_CRYPTO_ASYM_XFORM_DSA] = "dsa", + [RTE_CRYPTO_ASYM_XFORM_ECDSA] = "ecdsa", }; /** -- 2.7.4