From patchwork Thu Apr 7 06:28:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 109404 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 EDDADA050B; Thu, 7 Apr 2022 08:28:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD51E40689; Thu, 7 Apr 2022 08:28:28 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 2EAE54014F for ; Thu, 7 Apr 2022 08:28:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649312907; x=1680848907; h=from:to:cc:subject:date:message-id; bh=MlpjUdd7wqT++9qj6NvFT4Evcgc8KAE88R3dhiP0rN0=; b=UUiQEd8mYz7DoX6c3lvw6S7H/rgs7fw6RiBrKqyRU1IMYoJo1YWkcx8t VAVWzp6HT/iNWZlaTfLwOSa0gqi+K9656uWF/KdMeOve79TXOaiPQvAJE /hG6pV00lmNGhgPP8cmBg4K8rSEQ5CMlLeF1O0nR6bADrV4y+G5DLto7I XQbOwKTMzwDBMsw01ihLqI5gSUtnT0DreBeY3oJfNFMiS5R2Cgi2F20gV 5LO7BMR2yz68rgOZt0hvHLuax7D3K/7Y1U2vz3xbiTZggbzIsmzeTSVAp 0RVGuLfGEPVZvRoTSw3vtZwo6WtRRwpAmJbskKl3e/TiTJy71j04Ky0u4 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="243375667" X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="243375667" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 23:28:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="506028519" Received: from silpixa00400308.ir.intel.com ([10.237.214.95]) by orsmga003.jf.intel.com with ESMTP; 06 Apr 2022 23:28:23 -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 v2 1/2] cryptodev: move dh type from xform to dh op Date: Thu, 7 Apr 2022 07:28:19 +0100 Message-Id: <20220407062820.18136-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 --- v2: - fix applying issue lib/cryptodev/rte_crypto_asym.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h index cd24d4b07b..2f85027fb0 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,6 +389,8 @@ 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 From patchwork Thu Apr 7 06:28:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 109405 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 07353A050B; Thu, 7 Apr 2022 08:28:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA9D7410EF; Thu, 7 Apr 2022 08:28:29 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id C65AE4014F for ; Thu, 7 Apr 2022 08:28:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649312907; x=1680848907; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=VnKWAQQXUAGCruReNU054Euv+iiG8rmThpBfUQk7J4c=; b=S0Rcd+WuAXhsuNNCtS0ffbgpPT/s45SZu4bhVJChCXOHe/PZbgvS1zmt p7UaPTz+HkGpWnb3XyZ25DVTEKiu4UZnzSzTt3tzDwiSlmKRSNXdkFod3 ymGA6dn2txBGH36SOFKWqQvG9z59ukn9I9W3Dp4RiSQO2ZWNl8ssQPoLS AaXsGhl9epWm0o8C1q/GIFsRr+uAHUNV5fRivT8nILaZcelGmZlgEJYeh S3KbX6Xn9DDvgM0DKNk0dkVdJdYAxexXspCI8N0RI33oyYfu/EB+KNV6o 72Dj2iIibpqp4umShrTD7IbKZ+ElUvWQspyxlDRDTjTQajLKMYAOci3tg A==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="243375669" X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="243375669" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 23:28:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="506028523" Received: from silpixa00400308.ir.intel.com ([10.237.214.95]) by orsmga003.jf.intel.com with ESMTP; 06 Apr 2022 23:28:25 -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 v2 2/2] test/crypto: move dh type from xform to dh op Date: Thu, 7 Apr 2022 07:28:20 +0100 Message-Id: <20220407062820.18136-2-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220407062820.18136-1-arkadiuszx.kusztal@intel.com> References: <20220407062820.18136-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 --- v2: - fix applying issue 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;