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 56A4EA0503; Fri, 20 May 2022 09:04:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E1F7C42B9D; Fri, 20 May 2022 09:03:22 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 48B3B42BC1 for ; Fri, 20 May 2022 09:03:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653030201; x=1684566201; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=8Pj9SQ/hEuzr45FJnI9fizaq0gRgzEA2GuJDy42G5ag=; b=jvIu9PKs5gibjtUt8czMVnFPW5UjPoA24a3D2KLV1mxzqMTvYf5HmWQi qfphaBn4ahmAiUX709gvuIHfMsTG59/X95kh1kJkGQ2DusLsNlgkWC5ru A8vEPrFkvoyW7ROpKzTkEizBFwubzhIYJD2haUZE1fpTiXkVd+QZ6YnRV wQuu90uOqWr5CrA6aMJxoIBfVHbKS7698f3vVLf8A6sN4DgBBBknh9CJ0 TmVofqOwTQGiDXNDiQv8HcwcIFSMgkelGarGn4cGwzX1r9PtsPho6BPWV 1IF+VN04K6gS7qzJRs5qBckU+EGMvcukhiGpso+UPpB1nLxA2e/Ad2YHF Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10352"; a="333140388" X-IronPort-AV: E=Sophos;i="5.91,238,1647327600"; d="scan'208";a="333140388" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2022 00:03:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,238,1647327600"; d="scan'208";a="599058376" Received: from silpixa00399302.ir.intel.com ([10.237.214.136]) by orsmga008.jf.intel.com with ESMTP; 20 May 2022 00:03:19 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, anoobj@marvell.com, roy.fan.zhang@intel.com, Arek Kusztal Subject: [PATCH 20/40] cryptodev: add elliptic curve diffie hellman Date: Fri, 20 May 2022 06:54:25 +0100 Message-Id: <20220520055445.40063-21-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20220520055445.40063-1-arkadiuszx.kusztal@intel.com> References: <20220520055445.40063-1-arkadiuszx.kusztal@intel.com> 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 - added elliptic curve Diffie-Hellman parameters. Point multiplication allows the user to process every phase of ECDH, but for phase 1, user should not really care about the generator. The user does not even need to know what the generator looks like, therefore setting ec xform would make this work. Signed-off-by: Arek Kusztal --- lib/cryptodev/rte_crypto_asym.h | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h index 52cb1c5c80..09edf2ac3d 100644 --- a/lib/cryptodev/rte_crypto_asym.h +++ b/lib/cryptodev/rte_crypto_asym.h @@ -82,8 +82,10 @@ enum rte_crypto_asym_xform_type { /**< Modular Exponentiation */ RTE_CRYPTO_ASYM_XFORM_ECDSA, /**< Elliptic Curve Digital Signature Algorithm */ - RTE_CRYPTO_ASYM_XFORM_ECPM + RTE_CRYPTO_ASYM_XFORM_ECPM, /**< Elliptic Curve Point Multiplication */ + RTE_CRYPTO_ASYM_XFORM_ECDH + /**< Elliptic Curve Diffie Hellman */ }; /** @@ -383,22 +385,28 @@ struct rte_crypto_dh_op_param { /**< * Output generated private key when op_type is * DH PRIVATE_KEY_GENERATION - * Input when op_type is DH SHARED_SECRET_COMPUTATION. - * + * Input for RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE */ - rte_crypto_uint pub_key; + union { + rte_crypto_uint pub_key; + struct rte_crypto_ec_point pub_point; + }; /**< - * Output generated public key when op_type is - * DH PUB_KEY_GENERATION. - * Input peer public key when op_type is DH - * SHARED_SECRET_COMPUTATION - * + * Diffie-Hellman public part + * For DH it is big-endian unsigned integer. + * For ECDH it is a point on the curve. + * Output for RTE_CRYPTO_ASYM_KE_PUBLIC_KEY_GENERATE + * Input for RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE */ - rte_crypto_uint shared_secret; + union { + rte_crypto_uint shared_secret; + struct rte_crypto_ec_point shared_point; + }; /**< - * Output with calculated shared secret - * when op type is SHARED_SECRET_COMPUTATION. - * + * Diffie-Hellman shared secret + * For DH it is big-endian unsigned integer. + * For ECDH it is a point on the curve. + * Output for RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE */ }; -- 2.13.6