From patchwork Wed May 25 15:53:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 111831 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 95E04A0555; Wed, 25 May 2022 19:04:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0BDAE40151; Wed, 25 May 2022 19:04:05 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id A6E2D40143 for ; Wed, 25 May 2022 19:04:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653498243; x=1685034243; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=KTBPe5IfrIpntqSCc+CcQf/Sy8bTH/+qrtcnxf3NYEE=; b=Fnf2szM43KQgwSZPN+9bTM8Zbf7kcdiB4hWi5eer5vcRBAdTi6s3xp9x O2l5CFJ2rxuNtd37Y6hko8ygWCGyrK7taDbKxhoPnOaWJf123bFpXeoaG Ia9Jolcw3wZ3+/WelJNezSTZt1EYnOGKgiAVjqMCYvd/os0Jr0x+lIiW8 3/j31ZeYV3aIPaBtyrFG9C6Ypr6LmKyxvykYa5EQVQ4LkM4GEfJwGo/bC +WSuVpqTX4EdjbiJxtlUL/Z6b9hcARRToszAwN5AzrCxae7IMKGKh8RLk z75dOfpTtGjxuxaZxfY/LxsEDOuwKPQsk5/YQJJFlAXvhgvHz2tNSBAiu Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10358"; a="273596347" X-IronPort-AV: E=Sophos;i="5.91,250,1647327600"; d="scan'208";a="273596347" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2022 10:01:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,250,1647327600"; d="scan'208";a="664502358" Received: from silpixa00399302.ir.intel.com ([10.237.214.136]) by FMSMGA003.fm.intel.com with ESMTP; 25 May 2022 10:01:19 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, roy.fan.zhang@intel.com, Arek Kusztal Subject: [PATCH v2 07/14] cryptodev: add elliptic curve diffie hellman Date: Wed, 25 May 2022 16:53:17 +0100 Message-Id: <20220525155324.9288-8-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20220525155324.9288-1-arkadiuszx.kusztal@intel.com> References: <20220525155324.9288-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 | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h index ffb0e8ed17..0dab7c0593 100644 --- a/lib/cryptodev/rte_crypto_asym.h +++ b/lib/cryptodev/rte_crypto_asym.h @@ -112,6 +112,8 @@ enum rte_crypto_asym_xform_type { /**< Elliptic Curve Digital Signature Algorithm */ RTE_CRYPTO_ASYM_XFORM_ECPM, /**< Elliptic Curve Point Multiplication */ + RTE_CRYPTO_ASYM_XFORM_ECDH, + /**< Elliptic Curve Diffie Hellman */ RTE_CRYPTO_ASYM_XFORM_TYPE_LIST_END /**< End of list */ }; @@ -407,6 +409,42 @@ struct rte_crypto_dh_op_param { }; /** + * Elliptic Curve Diffie-Hellman Operations params. + * @note: + */ +struct rte_crypto_ecdh_op_param { + enum rte_crypto_asym_ke_type op_type; + /**< Key exchange operation type */ + rte_crypto_uint priv_key; + /**< + * Output - generated private key, when xform type is + * RTE_CRYPTO_ASYM_KE_PRIVATE_KEY_GENERATE. + * + * Input - private key, when xform type is one of: + * RTE_CRYPTO_ASYM_KE_PUBLIC_KEY_GENERATE, + * RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE. + * + * In case priv_key.length is 0 and xform type is set with + * RTE_CRYPTO_ASYM_KE_PUBLIC_KEY_GENERATE, CSRNG capable + * device will generate private key and use it for public + * key generation. + */ + struct rte_crypto_ec_point pub_key; + /**< + * Output - generated public key, when xform type is + * RTE_CRYPTO_ASYM_KE_PUBLIC_KEY_GENERATE. + * + * Input - peer's public key, when xform type is + * RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE. + */ + struct rte_crypto_ec_point shared_secret; + /**< + * Output - calculated shared secret when xform type is + * RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE. + */ +}; + +/** * DSA Operations params * */