SecurityPkg/RngDxe: Documentation/include/parameter cleanup

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>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
Pierre Gondois 2022-10-28 17:32:53 +02:00 committed by mergify[bot]
parent 922bf317f1
commit 199031b2b0
3 changed files with 3 additions and 5 deletions

View File

@ -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;
}

View File

@ -59,7 +59,7 @@ RngGetRNG (
{
EFI_STATUS Status;
if ((RNGValueLength == 0) || (RNGValue == NULL)) {
if ((This == NULL) || (RNGValueLength == 0) || (RNGValue == NULL)) {
return EFI_INVALID_PARAMETER;
}

View File

@ -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.