From patchwork Wed May 25 15:53: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: 111834 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 1D8F0A0555; Wed, 25 May 2022 19:04:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 290724280B; Wed, 25 May 2022 19:04:31 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 2169142B8C for ; Wed, 25 May 2022 19:04:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653498269; x=1685034269; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Am5cbHZp/SPLr8fG/XtcskTmKvyvzBkhypk5392INIk=; b=TjcvSBidXVGn4d8fC6WKO8FGp+DR3QPZAI8TfTyfS4im7wtGRIm6YdJ7 mlvi2PMSfOtk9LiRr0peRcx8/21cesn2xYk+Pom/S+V3dx7CHbd2B/mJM XApxSvjIfVrbvf2vSKoOAuLSIXIUodl8vIlhe7fgQ9CHw8Z7m/Mr5viOB pV5a0+ibPi/zxmHYNXLB20jjUh3v1DRGjnQCOafA+TH4IYo3jdVkEg1Zx 2JTryZCkp5SJPQSeoLwbRO9bkF1ZzfW/lXCE+mtpAlP0RculGxDAAad3X sR7LUbBtuATf1AzM/6p2vuFUpnBjRzuIeKkOXfqUvSr8zy4ADsz+cH7Gh A==; X-IronPort-AV: E=McAfee;i="6400,9594,10358"; a="273596483" X-IronPort-AV: E=Sophos;i="5.91,250,1647327600"; d="scan'208";a="273596483" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2022 10:01:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,250,1647327600"; d="scan'208";a="664502403" Received: from silpixa00399302.ir.intel.com ([10.237.214.136]) by FMSMGA003.fm.intel.com with ESMTP; 25 May 2022 10:01:25 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, roy.fan.zhang@intel.com, Arek Kusztal Subject: [PATCH v2 10/14] cryptodev: clarify usage of rsa padding hash Date: Wed, 25 May 2022 16:53:20 +0100 Message-Id: <20220525155324.9288-11-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20220525155324.9288-1-arkadiuszx.kusztal@intel.com> References: <20220525155324.9288-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 - Clarified usage of RSA padding hash. It was not specified how to use hash for PKCS1_5 padding. This could lead to incorrect implementation. Signed-off-by: Arek Kusztal --- lib/cryptodev/rte_crypto_asym.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h index 1a57c0c532..1758aaa875 100644 --- a/lib/cryptodev/rte_crypto_asym.h +++ b/lib/cryptodev/rte_crypto_asym.h @@ -371,10 +371,27 @@ struct rte_crypto_rsa_op_param { /**< 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 + /**< + * 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;