public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "PierreGondois" <pierre.gondois@arm.com>
To: devel@edk2.groups.io
Cc: Sami Mujawar <sami.mujawar@arm.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Rebecca Cran <rebecca@bsdio.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>,
	Pierre Gondois <pierre.gondois@arm.com>
Subject: [PATCH v4 15/21] SecurityPkg/RngDxe: Documentation/include/parameter cleanup
Date: Fri, 22 Jul 2022 16:31:47 +0200	[thread overview]
Message-ID: <20220722143153.913585-16-Pierre.Gondois@arm.com> (raw)
In-Reply-To: <20220722143153.913585-1-Pierre.Gondois@arm.com>

From: Pierre Gondois <Pierre.Gondois@arm.com>

This patch:
-Update RngGetBytes() documentation to align the function
 definition and declaration.
-Improve input parameter checking. Even though 'This'
 it is not used, the parameter should always point to the
 current EFI_RNG_PROTOCOL.
-Removes TimerLib inclusion as unused.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---
 SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/RngDxe.c | 3 +--
 SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c    | 2 +-
 SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c         | 3 +--
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/RngDxe.c b/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/RngDxe.c
index 6d989f7ea376..f9c740d761ff 100644
--- a/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/RngDxe.c
+++ b/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/RngDxe.c
@@ -23,7 +23,6 @@
 #include <Library/BaseLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/UefiBootServicesTableLib.h>
-#include <Library/TimerLib.h>
 #include <Protocol/Rng.h>
 
 #include "RngDxeInternals.h"
@@ -61,7 +60,7 @@ RngGetRNG (
 {
   EFI_STATUS  Status;
 
-  if ((RNGValueLength == 0) || (RNGValue == NULL)) {
+  if ((This == NULL) || (RNGValueLength == 0) || (RNGValue == NULL)) {
     return EFI_INVALID_PARAMETER;
   }
 
diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c b/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c
index b2d2236380fd..8f5d8e740f5e 100644
--- a/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c
+++ b/SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c
@@ -59,7 +59,7 @@ RngGetRNG (
 {
   EFI_STATUS  Status;
 
-  if ((RNGValueLength == 0) || (RNGValue == NULL)) {
+  if ((This == NULL) || (RNGValueLength == 0) || (RNGValue == NULL)) {
     return EFI_INVALID_PARAMETER;
   }
 
diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c b/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c
index 6608ca8804a5..d7905a7f4d72 100644
--- a/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c
+++ b/SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c
@@ -23,7 +23,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/BaseMemoryLib.h>
 #include <Library/UefiBootServicesTableLib.h>
 #include <Library/RngLib.h>
-#include <Library/TimerLib.h>
 #include <Protocol/Rng.h>
 
 #include "RngDxeInternals.h"
@@ -72,7 +71,7 @@ RngDriverEntry (
 }
 
 /**
-  Calls RDRAND to fill a buffer of arbitrary size with random bytes.
+  Runs CPU RNG instruction to fill a buffer of arbitrary size with random bytes.
 
   @param[in]   Length        Size of the buffer, in bytes,  to fill with.
   @param[out]  RandBuffer    Pointer to the buffer to store the random result.
-- 
2.25.1


  parent reply	other threads:[~2022-07-22 14:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 14:31 [PATCH v4 00/21] Add Raw algorithm support using Arm FW-TRNG interface PierreGondois
2022-07-22 14:31 ` [PATCH v4 01/21] ArmPkg: PCD to select conduit for monitor calls PierreGondois
2022-07-22 14:31 ` [PATCH v4 02/21] ArmPkg/ArmMonitorLib: Definition for ArmMonitorLib library class PierreGondois
2022-07-22 14:31 ` [PATCH v4 03/21] ArmPkg/ArmMonitorLib: Add ArmMonitorLib PierreGondois
2022-07-22 14:31 ` [PATCH v4 04/21] ArmPkg/ArmHvcNullLib: Add NULL instance of ArmHvcLib PierreGondois
2022-07-22 14:31 ` [PATCH v4 05/21] MdePkg/TrngLib: Definition for TRNG library class interface PierreGondois
2022-07-26  1:11   ` [edk2-devel] " Yao, Jiewen
2022-07-26  9:52     ` PierreGondois
2022-07-22 14:31 ` [PATCH v4 06/21] MdePkg/TrngLib: Add NULL instance of TRNG Library PierreGondois
2022-07-22 14:31 ` [PATCH v4 07/21] ArmPkg: Add FID definitions for Firmware TRNG PierreGondois
2022-07-22 14:31 ` [PATCH v4 08/21] ArmPkg/TrngLib: Add Arm Firmware TRNG library PierreGondois
2022-07-22 14:31 ` [PATCH v4 09/21] MdePkg/BaseRngLib: Rename ArmReadIdIsar0() to ArmGetFeatRng() PierreGondois
2022-07-22 14:31 ` [PATCH v4 10/21] ArmPkg/ArmLib: Add ArmReadIdIsar0() helper PierreGondois
2022-07-22 14:31 ` [PATCH v4 11/21] ArmPkg/ArmLib: Add ArmHasRngExt() PierreGondois
2022-07-22 14:31 ` [PATCH v4 12/21] SecurityPkg/RngDxe: Rename RdRandGenerateEntropy to generic name PierreGondois
2022-07-22 14:31 ` [PATCH v4 13/21] SecurityPkg/RngDxe: Replace Pcd with Sp80090Ctr256Guid PierreGondois
2022-07-22 14:31 ` [PATCH v4 14/21] SecurityPkg/RngDxe: Remove ArchGetSupportedRngAlgorithms() PierreGondois
2022-07-22 14:31 ` PierreGondois [this message]
2022-07-22 14:31 ` [PATCH v4 16/21] SecurityPkg/RngDxe: Check before advertising Cpu Rng algo PierreGondois
2022-07-22 14:31 ` [PATCH v4 17/21] SecurityPkg/RngDxe: Add AArch64 RawAlgorithm support through TrngLib PierreGondois
2022-07-22 14:31 ` [PATCH v4 18/21] SecurityPkg/RngDxe: Add debug warning for NULL PcdCpuRngSupportedAlgorithm PierreGondois
2022-07-22 14:31 ` [PATCH v4 19/21] SecurityPkg/RngDxe: Rename AArch64/RngDxe.c PierreGondois
2022-07-22 14:31 ` [PATCH v4 20/21] SecurityPkg/RngDxe: Add Arm support of RngDxe PierreGondois
2022-07-22 14:31 ` [PATCH v4 21/21] ArmVirtPkg: Kvmtool: Add RNG support using FW-TRNG interface PierreGondois
2022-07-25  4:30 ` 回复: [PATCH v4 00/21] Add Raw algorithm support using Arm " gaoliming
2022-08-22 12:41   ` PierreGondois

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220722143153.913585-16-Pierre.Gondois@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox