From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23644C433EF for ; Mon, 7 Feb 2022 11:36:20 +0000 (UTC) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3AC541143; Mon, 7 Feb 2022 12:36:13 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 95C8A41140 for ; Mon, 7 Feb 2022 12:36:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644233771; x=1675769771; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=w95f12la12BZ2fPCOoCMk1fuQp9LHJsKax6mXQ3rCrA=; b=VENSyxsg+H/wx3TyUWMO/mZSjihyqeEIcfTU9lJ4kMeD0nWdKKgcqzaj gqEJ06zn9CvHpkAv+EugekMgCXVbQLxvJFBszEZ2OUX6cCaDUljxfc8BL md9EHsH8T42G4epQC17cdX1tR2pqGjDEMOf7/W6DLzFi+b5nku2DqmrXd saYohx7PdNT9t+nfROqWoWVA5GZL+aZ38/Q80XlY8dMuu+J1TN0xkHCwo cbsrFhUX5wfxqCIxsyNTa0efeHBhRh2cmVLkSrvUsG7p3aS0sFztXMhWK XZhhzwzhKucmnZlSy3r2UXipVksGowd+GrGQnuI/kLtdlcLLNMlSOH68j g==; X-IronPort-AV: E=McAfee;i="6200,9189,10250"; a="248647176" X-IronPort-AV: E=Sophos;i="5.88,349,1635231600"; d="scan'208";a="248647176" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2022 03:36:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,349,1635231600"; d="scan'208";a="677731305" Received: from silpixa00400308.ir.intel.com ([10.237.214.95]) by fmsmga001.fm.intel.com with ESMTP; 07 Feb 2022 03:36:10 -0800 From: Arek Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, roy.fan.zhang@intel.com, rbalu@marvell.com, Arek Kusztal Subject: [PATCH v2 2/4] crypto: clarify usage of random numbers in asym Date: Mon, 7 Feb 2022 11:35:53 +0000 Message-Id: <20220207113555.8431-3-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220207113555.8431-1-arkadiuszx.kusztal@intel.com> References: <20220207113555.8431-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. User is now allowed to provide information to the PMD if random number should be generated or should be read from user input. If PMD does not support random number generation user should always provide it, if PMD does not support user random, rte_crypto_param.data accordingly should be set to NULL. Signed-off-by: Arek Kusztal --- 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; -- 2.13.6