|
TianoCore EDK2 master
|
#include <Base.h>#include <Uefi.h>#include <Library/BaseLib.h>#include <Library/BaseMemoryLib.h>#include <Library/DebugLib.h>#include <Library/TimerLib.h>#include <Guid/RngAlgorithm.h>Go to the source code of this file.
Macros | |
| #define | DEFAULT_DELAY_TIME_IN_MICROSECONDS 10 |
Functions | |
| STATIC UINT32 | CalculateMinimumDecentDelayInMicroseconds (VOID) |
| BOOLEAN EFIAPI | GetRandomNumber16 (OUT UINT16 *Rand) |
| BOOLEAN EFIAPI | GetRandomNumber32 (OUT UINT32 *Rand) |
| BOOLEAN EFIAPI | GetRandomNumber64 (OUT UINT64 *Rand) |
| BOOLEAN EFIAPI | GetRandomNumber128 (OUT UINT64 *Rand) |
| EFI_STATUS EFIAPI | GetRngGuid (GUID *RngGuid) |
BaseRng Library that uses the TimerLib to provide reasonably random numbers. Do not use this on a production system.
Copyright (c) 2023, Arm Limited. All rights reserved. Copyright (c) Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file RngLibTimer.c.
| #define DEFAULT_DELAY_TIME_IN_MICROSECONDS 10 |
Definition at line 18 of file RngLibTimer.c.
Using the TimerLib GetPerformanceCounterProperties() we delay for enough time for the PerformanceCounter to increment.
If the return value from GetPerformanceCounterProperties (TimerLib) is zero, this function will return 10 and attempt to assert.
Definition at line 29 of file RngLibTimer.c.
| BOOLEAN EFIAPI GetRandomNumber128 | ( | OUT UINT64 * | Rand | ) |
Generates a 128-bit random number.
if Rand is NULL, then ASSERT().
| [out] | Rand | Buffer pointer to store the 128-bit random value. |
| TRUE | Random number generated successfully. |
| FALSE | Failed to generate the random number. |
Definition at line 182 of file RngLibTimer.c.
| BOOLEAN EFIAPI GetRandomNumber16 | ( | OUT UINT16 * | Rand | ) |
Generates a 16-bit random number.
if Rand is NULL, then ASSERT().
| [out] | Rand | Buffer pointer to store the 16-bit random value. |
| TRUE | Random number generated successfully. |
| FALSE | Failed to generate the random number. |
Definition at line 62 of file RngLibTimer.c.
| BOOLEAN EFIAPI GetRandomNumber32 | ( | OUT UINT32 * | Rand | ) |
Generates a 32-bit random number.
if Rand is NULL, then ASSERT().
| [out] | Rand | Buffer pointer to store the 32-bit random value. |
| TRUE | Random number generated successfully. |
| FALSE | Failed to generate the random number. |
Definition at line 102 of file RngLibTimer.c.
| BOOLEAN EFIAPI GetRandomNumber64 | ( | OUT UINT64 * | Rand | ) |
Generates a 64-bit random number.
if Rand is NULL, then ASSERT().
| [out] | Rand | Buffer pointer to store the 64-bit random value. |
| TRUE | Random number generated successfully. |
| FALSE | Failed to generate the random number. |
Definition at line 142 of file RngLibTimer.c.
| EFI_STATUS EFIAPI GetRngGuid | ( | GUID * | RngGuid | ) |
Get a GUID identifying the RNG algorithm implementation.
| [out] | RngGuid | If success, contains the GUID identifying the RNG algorithm implementation. |
| EFI_SUCCESS | Success. |
| EFI_UNSUPPORTED | Not supported. |
| EFI_INVALID_PARAMETER | Invalid parameter. |
Definition at line 210 of file RngLibTimer.c.