From patchwork Fri Feb 11 16:02:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Kusztal X-Patchwork-Id: 107377 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 065DEA0032; Fri, 11 Feb 2022 18:09:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D659541155; Fri, 11 Feb 2022 18:09:17 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id E6DE640042 for ; Fri, 11 Feb 2022 18:09:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644599356; x=1676135356; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=RCvSh6Vh0ID0fjkpISwpV4iNudlFIy/XIzXM4kpZuME=; b=MCtSrS74kNC2fNdQnIvQYzY4ufvPfoZ17WFtUIz/dTzpXiMq87JCRaHH Xaz38MU2ph5VjvkagDPTfGAasbbrHmQolOjRek8Un4yQtfpPJvitnBfm7 aOWcR6Em/GSUPbbILp9yb7bCy+80hRYq60CnzU61wZHM+GslSgQRDzdbT LIr2hVcGrfELLEQ5KZbfimvLg7Mm0N87E107spkvKPCWba53LnlCdjO7R aJZg+O7YGeD/oPj5ci5g7OgmtwQod2zUNkcfOOO500uFXtqwpaGJKwzSO Vy19iebyyDaPDScko9H/mgaL3ynRIh10RjLiOBM3sGrT2E/BxVko/u2XX g==; X-IronPort-AV: E=McAfee;i="6200,9189,10255"; a="247360854" X-IronPort-AV: E=Sophos;i="5.88,361,1635231600"; d="scan'208";a="247360854" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2022 09:07:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,361,1635231600"; d="scan'208";a="488241803" Received: from silpixa00399302.ir.intel.com ([10.237.214.136]) by orsmga006.jf.intel.com with ESMTP; 11 Feb 2022 09:07:52 -0800 From: Arek Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, roy.fan.zhang@intel.com, Arek Kusztal Subject: [PATCH v3 2/4] crypto: clarify usage of random numbers in asym Date: Fri, 11 Feb 2022 16:02:36 +0000 Message-Id: <20220211160238.90065-3-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20220211160238.90065-1-arkadiuszx.kusztal@intel.com> References: <20220211160238.90065-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. The 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;