From patchwork Wed Jun 1 09:02:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 112219 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 0DAFAA0548; Wed, 1 Jun 2022 12:11:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E18EC42B9F; Wed, 1 Jun 2022 12:10:58 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id DD79142B71 for ; Wed, 1 Jun 2022 12:10:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654078255; x=1685614255; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=GJNxSgBIhrHhO5ukXj/bdrqqNFTEpy3WO5qk6V+gSeQ=; b=dOu/u5SKTCZ3uO1Iz4EXFF57ogEJk58mp/dULcEk5UhVp03UYBNU6jmp 51OiGWMYwPuZpneoDXy3lRvmzxRxwGlahJFxJnyybPxcpSEfYgGHt313d 0FVtYdiVtf9uN9CMrfOWnt/x0CQbPjZt/AqQ2ARRe3/ybC6ud0NJfdZIY P/BuNvaTFu4cDYK0rt7HLAxRGgOAeWRNf33mIvOSm8cApWKNvPTszwSo6 iYXuMPbKjaP0OI29ExGFAW23XyyAj4qqhTU9K9T1a0ZeD9FhOLzSvaB9R 7efByyBEfbu77fRPrkpwNifhQnBWzBnbYgVqUGQuEwaxQEaWnNfRDxmzJ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10364"; a="275616470" X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="275616470" 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:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="606186003" Received: from silpixa00399302.ir.intel.com ([10.237.214.136]) by orsmga008.jf.intel.com with ESMTP; 01 Jun 2022 03:10:46 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, roy.fan.zhang@intel.com, Arek Kusztal Subject: [PATCH v5 09/12] cryptodev: clarify usage of rsa padding hash Date: Wed, 1 Jun 2022 10:02:46 +0100 Message-Id: <20220601090249.86865-10-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 - 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, 22 insertions(+), 3 deletions(-) diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h index 3e4d50c69b..5f6bf41e68 100644 --- a/lib/cryptodev/rte_crypto_asym.h +++ b/lib/cryptodev/rte_crypto_asym.h @@ -395,10 +395,29 @@ 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: + /**< + * RSA padding hash algorithm + * Valid hash algorithms are: * MD5, SHA1, SHA224, SHA256, SHA384, SHA512 + * + * 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: + * For sign operation, this field is used to determine value + * of the DigestInfo structure, therefore specifying which algorithm + * was used to create the message digest. + * For 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;