From patchwork Thu Apr 7 07:18:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 109407 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 9627FA050B; Thu, 7 Apr 2022 09:18:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4DE1240DF6; Thu, 7 Apr 2022 09:18:35 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id DDA8A4014F for ; Thu, 7 Apr 2022 09:18:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649315914; x=1680851914; h=from:to:cc:subject:date:message-id; bh=aHMoT8dKrRyWZcXtnP1zPVQCL0pmsBO13jn2wVsThFg=; b=l5gFShjhDLXiYou3BXIqXt8VHVwsV96cHx87dOpLvmwVSW2Md85UkR4K hp+nHDRLryJ4tTU/M/V4oU1ZOJr++P6R3yS2i6dWmjxnw5nG+NwmmWGgE WrFxIsHeUpK/dmcKMM5n7WKJwXoPRXmAxethsLVqm2YLd45CrKQJNIbkG qrzS/jxpNCPjKQo2IYLigHEvfPFD7pz2sWPaRzFi7HyNzcrv7s70uQtpY q8+KR+kxTmgHZK56OEHJiLPpj71zfTIYXkpss25cUnXppsWE686X8HZre t/GA29VmfzhlrajM4RajGPjo/n65JRLqecL0K9KBTGBhfYgZbWpHnv/5m A==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="241842009" X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="241842009" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2022 00:18:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="642374531" Received: from silpixa00400308.ir.intel.com ([10.237.214.95]) by FMSMGA003.fm.intel.com with ESMTP; 07 Apr 2022 00:18:08 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, roy.fan.zhang@intel.com, kai.ji@intel.com, Arek Kusztal Subject: [PATCH v3 1/2] cryptodev: move dh type from xform to dh op Date: Thu, 7 Apr 2022 08:18:02 +0100 Message-Id: <20220407071803.18383-1-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.17.1 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 Operation type (PUBLIC_KEY_GENERATION, SHARED_SECRET) should be free to choose for any operation. One xform/session should be enough to perform both DH operations, if this is xform member, session needs to be created twice for the same group, similar problem would be observed in sessionless case. Additionally it will help extending DH to support Elliptic Curves. Signed-off-by: Arek Kusztal --- v3: - changed op_type comments in dh lib/cryptodev/rte_crypto_asym.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h index cd24d4b07b..40c1d90604 100644 --- a/lib/cryptodev/rte_crypto_asym.h +++ b/lib/cryptodev/rte_crypto_asym.h @@ -256,8 +256,6 @@ struct rte_crypto_modinv_xform { * */ struct rte_crypto_dh_xform { - enum rte_crypto_asym_op_type type; - /**< Setup xform for key generate or shared secret compute */ rte_crypto_uint p; /**< Prime modulus data */ rte_crypto_uint g; @@ -391,27 +389,29 @@ struct rte_crypto_rsa_op_param { * @note: */ struct rte_crypto_dh_op_param { + enum rte_crypto_asym_op_type op_type; + /**< Diffie-Hellman operation phase */ rte_crypto_uint pub_key; /**< - * Output generated public key when xform type is + * Output generated public key when op_type is * DH PUB_KEY_GENERATION. - * Input peer public key when xform type is DH + * Input peer public key when op_type is DH * SHARED_SECRET_COMPUTATION * */ rte_crypto_uint priv_key; /**< - * Output generated private key if xform type is + * Output generated private key if op_type is * DH PRIVATE_KEY_GENERATION - * Input when xform type is DH SHARED_SECRET_COMPUTATION. + * Input when op_type is DH SHARED_SECRET_COMPUTATION. * */ rte_crypto_uint shared_secret; /**< * Output with calculated shared secret - * when dh xform set up with op type = SHARED_SECRET_COMPUTATION. + * when dh op_type = SHARED_SECRET_COMPUTATION. * */ }; From patchwork Thu Apr 7 07:18:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 109408 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 A5E35A050B; Thu, 7 Apr 2022 09:18:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 37A78410E3; Thu, 7 Apr 2022 09:18:36 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id B824C4014F for ; Thu, 7 Apr 2022 09:18:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649315915; x=1680851915; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=uSgTdMTXjt3nHAqcJn9wCkAJje5qpb/Sdx/l3EWYI30=; b=TkEWOrWHg/GPZQyzx8b8Jmk8eWgAqI6gwkhXjXxiJgpb65bZyy+k5rdI vsGkYiKXk3MTSeMWBWK50ScNY2P8uy0SEo0rPM5YqaDLzavIc3SGuhgqn U0LyWbVEyOiHaETx7MmNySGXbK2ZvKa9PRDcwKahwRz3AuLN8GMB/Oh2h EFjWLrRsq3ghfqw5j/3unbwdKP9Q2N6uqQQ1RZkASCYoVramyjDV1jcgy lN1/Rs6pLVgey7P2n3FFu8qMvRbmvdevmdZYBCyciN4/OCf4Zpadu/s8U 6n5PBkyo2HBGHj+KioW3AxuAv6LvN0lKI8iTaSUHjMCnR+oOyvYUTf08E w==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="241842021" X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="241842021" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2022 00:18:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="642374539" Received: from silpixa00400308.ir.intel.com ([10.237.214.95]) by FMSMGA003.fm.intel.com with ESMTP; 07 Apr 2022 00:18:10 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, roy.fan.zhang@intel.com, kai.ji@intel.com, Arek Kusztal Subject: [PATCH v3 2/2] test/crypto: move dh type from xform to dh op Date: Thu, 7 Apr 2022 08:18:03 +0100 Message-Id: <20220407071803.18383-2-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220407071803.18383-1-arkadiuszx.kusztal@intel.com> References: <20220407071803.18383-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 This commit reflects API changes in Diffie-Hellman, now for setting crypto operation type asym_op no xform is responsible. Signed-off-by: Arek Kusztal --- v3: - changed op_type comments in dh app/test/test_cryptodev_asym.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c index 573af2a537..a5e385f4bd 100644 --- a/app/test/test_cryptodev_asym.c +++ b/app/test/test_cryptodev_asym.c @@ -1064,8 +1064,8 @@ test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm) asym_op = op->asym; /* Setup a xform and op to generate private key only */ - xform.dh.type = RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; xform.next = NULL; + asym_op->dh.op_type = RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; asym_op->dh.priv_key.data = dh_test_params.priv_key.data; asym_op->dh.priv_key.length = dh_test_params.priv_key.length; asym_op->dh.pub_key.data = (uint8_t *)peer; @@ -1146,7 +1146,7 @@ test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm) asym_op = op->asym; /* Setup a xform and op to generate private key only */ - xform.dh.type = RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE; + asym_op->dh.op_type = RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE; xform.next = NULL; asym_op->dh.priv_key.data = output; asym_op->dh.priv_key.length = sizeof(output); @@ -1229,7 +1229,7 @@ test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm) * using test private key * */ - xform.dh.type = RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE; + asym_op->dh.op_type = RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE; xform.next = NULL; asym_op->dh.pub_key.data = output; @@ -1319,9 +1319,10 @@ test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm) /* Setup a xform chain to generate * private key first followed by * public key - */xform.dh.type = RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE; + */ + asym_op->dh.op_type = RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE; pub_key_xform.xform_type = RTE_CRYPTO_ASYM_XFORM_DH; - pub_key_xform.dh.type = RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE; + asym_op->dh.op_type = RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE; xform.next = &pub_key_xform; asym_op->dh.pub_key.data = out_pub_key;