From patchwork Fri May 20 05:54:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 111513 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 9F54FA0503; Fri, 20 May 2022 09:05:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8471E42BED; Fri, 20 May 2022 09:03:45 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 3E33E42BCB for ; Fri, 20 May 2022 09:03:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653030224; x=1684566224; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=+lT0nu0aIQ2yxAErba7mneN45xIktNUWZx4h5osAkto=; b=ZXGbafhP/Ok5U3WofJlUG8A0D7R/ZdgtcJOuGSTZr2XaBufGKXMS2lhH ZvKF+VqBpza3sNMEchiROQFU5nHJunBu4nezybtMIGU9lcsBghv6rnu2n 3WaXntNaINElFiWT19ntKBZy6m6Dxhflh4nfeXtlc9IQ7GOg5ElnMClns uT5igH+6Fk+FSX2+/qEnvRJPJwV6iXZtOvIm4OgbJYg/2sE5gINnng9B9 /J93Fq3nPjOA5KjJcahwbFluk2xG+v3vBMdS2dQFtac3SdFTMWjDOJHs5 RB/0SvQRq/CBIJ3kBRdxuICWCZK95w3KUTWlPCI1RFKhBujj4upg+EsKv w==; X-IronPort-AV: E=McAfee;i="6400,9594,10352"; a="333140439" X-IronPort-AV: E=Sophos;i="5.91,238,1647327600"; d="scan'208";a="333140439" 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:03:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,238,1647327600"; d="scan'208";a="599058516" Received: from silpixa00399302.ir.intel.com ([10.237.214.136]) by orsmga008.jf.intel.com with ESMTP; 20 May 2022 00:03:42 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, anoobj@marvell.com, roy.fan.zhang@intel.com, Arek Kusztal Subject: [PATCH 29/40] cryptodev: add salt length and optional label Date: Fri, 20 May 2022 06:54:34 +0100 Message-Id: <20220520055445.40063-30-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 salt length and optional label. Common parameters to PSS and OAEP padding for RSA. - Fixed hash API in RSA padding. Now it is specified how hash should be used with particular RSA padding modes. Signed-off-by: Arek Kusztal --- lib/cryptodev/rte_crypto_asym.h | 44 +++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h index 97c3fbee38..c864b8a115 100644 --- a/lib/cryptodev/rte_crypto_asym.h +++ b/lib/cryptodev/rte_crypto_asym.h @@ -205,12 +205,29 @@ struct rte_crypto_rsa_priv_key_qt { */ struct rte_crypto_rsa_padding { enum rte_crypto_rsa_padding_type type; - /**< RSA padding scheme to be used for transform */ - enum rte_crypto_auth_algorithm md; - /**< Hash algorithm to be used for data hash if padding - * scheme is either OAEP or PSS. Valid hash algorithms - * are: - * MD5, SHA1, SHA224, SHA256, SHA384, SHA512 + /**< Type of RSA padding */ + enum rte_crypto_auth_algorithm hash; + /**< + * RSA padding hash function + * + * When a specific padding type is selected, the following rule apply: + * - RTE_CRYPTO_RSA_PADDING_NONE: + * This field is ignored by the PMD + * + * - RTE_CRYPTO_RSA_PADDING_PKCS1_5: + * When signing operation this field is used to determine value + * of the DigestInfo structure, therefore specifying which algorithm + * was used to create the message digest. + * When doing encryption/decryption this field is ignored for this + * padding type. + * + * - RTE_CRYPTO_RSA_PADDING_OAEP + * This field shall be set with the hash algorithm used + * in the padding scheme + * + * - RTE_CRYPTO_RSA_PADDING_PSS + * This field shall be set with the hash algorithm used + * in the padding scheme (and to create the input message digest) */ enum rte_crypto_auth_algorithm mgf1md; /**< @@ -220,6 +237,21 @@ struct rte_crypto_rsa_padding { * for mask generation. Valid hash algorithms are: * MD5, SHA1, SHA224, SHA256, SHA384, SHA512 */ + uint16_t saltlen; + /**< + * RSA PSS padding salt length + * + * Used only when RTE_CRYPTO_RSA_PADDING_PSS padding is selected, + * otherwise ignored. + */ + rte_crypto_param label; + /**< + * RSA OAEP padding optional label + * + * Used only when RTE_CRYPTO_RSA_PADDING_OAEP padding is selected, + * otherwise ignored. If label.data == NULL, a default + * label (empty string) is used. + */ }; /**