From patchwork Wed Feb 2 06:50:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 106767 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 9FB2DA00C5; Wed, 2 Feb 2022 07:50:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C49541C26; Wed, 2 Feb 2022 07:50:43 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id B97F941C2E for ; Wed, 2 Feb 2022 07:50:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643784641; x=1675320641; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=AUN7YUv0wnqXVH8qawolweFEbpus5OVEjBgimAIiAS8=; b=C1SXinwDjOyUAku9YKjkpoPFrMP/f8sWoeM+ctFJw7Nl5BFq0/maZDKU 1jwq0SdEPIvtywBcilV2cGO7n/qwLVTUD8vi2qs0VlvPxhr4KLfuUTYBp qjUt3uc0O9gbbpcdGSVr4kDoVJ5xFHn5g2ZkekuIi+h3G/sT1FE9hh/zC TeI9GaG1wr75+u60ha1ND6F2zaX26pSNcMNhLzT/rnyMud7P/R+7AoZED i/M0JA8PZPtJYYy9011X23jH9ft1xZwW2n+Z/5Y8aOddi4ugtzA9dktnY eJKmiMoJHekX4AqvP8TM8va/x0yayzZba9Jo4kJ6fBHNQlZCJf3RyoCcd g==; X-IronPort-AV: E=McAfee;i="6200,9189,10245"; a="235257326" X-IronPort-AV: E=Sophos;i="5.88,336,1635231600"; d="scan'208";a="235257326" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2022 22:50:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,336,1635231600"; d="scan'208";a="480007250" Received: from silpixa00400308.ir.intel.com ([10.237.214.95]) by orsmga003.jf.intel.com with ESMTP; 01 Feb 2022 22:50:39 -0800 From: Arek Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, roy.fan.zhang@intel.com, rbalu@marvell.com, Arek Kusztal Subject: [PATCH 2/4] crypto: clarify usage of random numbers in asym Date: Wed, 2 Feb 2022 06:50:28 +0000 Message-Id: <20220202065030.23276-3-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220202065030.23276-1-arkadiuszx.kusztal@intel.com> References: <20220202065030.23276-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 This commit clarifies usage of random numbers in asymmetric crypto API. Signed-off-by: Arek Kusztal Acked-by: Fan Zhang --- lib/cryptodev/rte_crypto_asym.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h index e0def3d9ab..58d47158de 100644 --- a/lib/cryptodev/rte_crypto_asym.h +++ b/lib/cryptodev/rte_crypto_asym.h @@ -33,6 +33,11 @@ extern "C" { * These buffers can be used for both input to PMD and output from PMD. When * used for output from PMD, application has to ensure the buffer is large * enough to hold the target data. + * + * If an operation requires the PMD to generate a random number, + * and the device supports CSRNG, 'data' should be set to NULL. + * The crypto parameter in question will not be used by the PMD, + * as it is internally generated. */ typedef struct rte_crypto_param_t { uint8_t *data; @@ -549,7 +554,9 @@ struct rte_crypto_dsa_op_param { /**< input message to be signed or verified */ rte_crypto_param k; /**< Per-message secret number, which is an integer - * in the interval (1, q-1) + * in the interval (1, q-1). + * If the random number is generated by the PMD, + * the 'rte_crypto_param.data' parameter should be set to NULL. */ rte_crypto_param r; /**< dsa sign component 'r' value @@ -589,7 +596,9 @@ struct rte_crypto_ecdsa_op_param { rte_crypto_param k; /**< The ECDSA per-message secret number, which is an integer - * in the interval (1, n-1) + * in the interval (1, n-1). + * If the random number is generated by the PMD, + * the 'rte_crypto_param.data' parameter should be set to NULL. */ rte_crypto_param r;