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 A1F39A0503; Fri, 20 May 2022 09:06:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33AFA42BA9; Fri, 20 May 2022 09:04:06 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 2F4CD42B70 for ; Fri, 20 May 2022 09:04:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653030244; x=1684566244; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=grHnIZT0QKPcFltwOhGDZOc6O9zietHCaS6/TfyAb5I=; b=e5kH0VGunz9CNoFfk7f4hz+NqGmB2Q7bbuuNYv1/AFla6od8743PgzBn 54EbWgBZLMMjYlMvFKcmQWnyLsoggt5DCT97p8/MCPPIjK90oiWeI0TZm PT4zedhu81dSWeyEuH6krByQQyfUhBhfrcKF6u12B/XY1Fh0ELfEfX8zT K12RLS/af9rYxVjtG+araabrACY0NacA5oCGwqbhVUQUWxecsO91Oa0Ef hNxwMLQEHrQgSDoAHxc6DxUUBIXRMPYk07haAM0wmgKbGxMaFyUTbFey6 ebCOwJYqACYr7iC3MpPFBJ6GP/pYUDYK6Vx0OhJSArl5yBTd4aLmmJsUV g==; X-IronPort-AV: E=McAfee;i="6400,9594,10352"; a="333140513" X-IronPort-AV: E=Sophos;i="5.91,238,1647327600"; d="scan'208";a="333140513" 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:04:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,238,1647327600"; d="scan'208";a="599058661" Received: from silpixa00399302.ir.intel.com ([10.237.214.136]) by orsmga008.jf.intel.com with ESMTP; 20 May 2022 00:04:02 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, anoobj@marvell.com, roy.fan.zhang@intel.com, Arek Kusztal Subject: [PATCH 37/40] cryptodev: add asym op flags Date: Fri, 20 May 2022 06:54:42 +0100 Message-Id: <20220520055445.40063-38-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 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 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h index 37dd3b9d86..01b1fdd074 100644 --- a/lib/cryptodev/rte_crypto_asym.h +++ b/lib/cryptodev/rte_crypto_asym.h @@ -41,6 +41,26 @@ rte_crypto_asym_ke_strings[]; extern const char * rte_crypto_asym_op_strings[]; +#define RTE_CRYPTO_ASYM_FLAG_PUB_KEY_NO_PADDING 0 +/**< + * If set to 1 - public key will be returned + * without leading zero bytes, otherwise it will be + * padded to the left with zero bytes (default) + */ +#define RTE_CRYPTO_ASYM_FLAG_SHARED_KEY_NO_PADDING 1 +/**< + * If set to 1 - shared key will be returned + * without leading zero bytes, otherwise it will be + * padded to the left with zero bytes (default) + */ + +#define RTE_CRYPTO_ASYM_FLAG_SET(op, flag) \ + (op->flags |= (1ULL << flag)) +#define RTE_CRYPTO_ASYM_FLAG_UNSET(op, flag) \ + (op->flags &= (~(1ULL << flag))) +#define RTE_CRYPTO_ASYM_FLAG_GET(op, flag) \ + (!!(op->flags &= (1ULL << flag))) + /** * List of elliptic curves. This enum aligns with * TLS "Supported Groups" registry (previously known as @@ -607,6 +627,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 flags, every flag starts with + * RTE_CRYPTO_ASYM_FLAG_*. Flags are set/unset with + * RTE_CRYPTO_ASYM_SET_FLAGS, RTE_CRYPTO_ASYM_GET_FLAGS + */ }; #ifdef __cplusplus -- 2.13.6