From patchwork Wed Jun 1 09:02:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 112218 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 2253EA0548; Wed, 1 Jun 2022 12:11:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A821F42B94; Wed, 1 Jun 2022 12:10:57 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id D08B442B7C for ; Wed, 1 Jun 2022 12:10:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654078253; x=1685614253; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=s6Z55Oov7MkDCpLtla02KZYtUOgUtrgwJfmfICUKi44=; b=WC7sdVnSTkFo5VPjknw9H+lHwgU2gq5xNqg5nGLomDckNuwmbUWBWl0u WJoTTR0/0mySnwrPFLpoQlwQRLqUjH0305j5h3K0kDkQoBL/tGkMXqlxA B0SL2Vfg6iWNtbfframYiRNVg3RXQWrB/FJDLHWBlgwCyvm2NZbK4Hffo SYjCabdgNPfd12C8nHOcNRXK3EGZqy2kWIeQ9Aa0jbwPAzZ6Pky82HWOT EnpeGeceUURASdVjXsJ/0hwCS1LKO3eZsr9l8uw9I3SFbo4YMrAERlKlM u+DZOlGkV7tRRtsNh1ujdjbNJvv5UlfE/CLG3Bww53UYD2C3Yy4cJb3Fh g==; X-IronPort-AV: E=McAfee;i="6400,9594,10364"; a="275616448" X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="275616448" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2022 03:10:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="606185987" Received: from silpixa00399302.ir.intel.com ([10.237.214.136]) by orsmga008.jf.intel.com with ESMTP; 01 Jun 2022 03:10:44 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, roy.fan.zhang@intel.com, Arek Kusztal Subject: [PATCH v5 08/12] cryptodev: add asym op flags Date: Wed, 1 Jun 2022 10:02:45 +0100 Message-Id: <20220601090249.86865-9-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20220601090249.86865-1-arkadiuszx.kusztal@intel.com> References: <20220601090249.86865-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 flags to rte_crypto_asym_op struct. It may be shared between different algorithms. - Added Diffie-Hellman padding flags. Diffie-Hellman padding is used in certain protocols, in others, leading zero bytes need to be stripped. Even same protocol may use a different approach - most glaring example is TLS1.2 - TLS1.3. For ease of use, and to avoid additional copy on certain occasions, driver should be able to return both. Signed-off-by: Arek Kusztal --- lib/cryptodev/rte_crypto_asym.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h index ae3ca31a89..3e4d50c69b 100644 --- a/lib/cryptodev/rte_crypto_asym.h +++ b/lib/cryptodev/rte_crypto_asym.h @@ -41,6 +41,19 @@ rte_crypto_asym_ke_strings[]; extern const char * rte_crypto_asym_op_strings[]; +#define RTE_CRYPTO_ASYM_FLAG_PUB_KEY_NO_PADDING RTE_BIT32(0) +/**< + * Flag to denote public key will be returned without leading zero bytes + * and if the flag is not set, public key will be padded to the left with + * zeros to the size of the underlying algorithm (default) + */ +#define RTE_CRYPTO_ASYM_FLAG_SHARED_KEY_NO_PADDING RTE_BIT32(1) +/**< + * Flag to denote shared secret will be returned without leading zero bytes + * and if the flag is not set, shared secret will be padded to the left with + * zeros to the size of the underlying algorithm (default) + */ + /** * List of elliptic curves. This enum aligns with * TLS "Supported Groups" registry (previously known as @@ -613,6 +626,11 @@ struct rte_crypto_asym_op { struct rte_crypto_ecdsa_op_param ecdsa; struct rte_crypto_ecpm_op_param ecpm; }; + uint16_t flags; + /**< + * Asymmetric crypto operation flags. + * Please refer to the RTE_CRYPTO_ASYM_FLAG_*. + */ }; #ifdef __cplusplus