TianoCore EDK2 master
|
#include <Uefi.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/RngLib.h>
#include <Protocol/Rng.h>
Go to the source code of this file.
Data Structures | |
struct | SECURE_RNG_ALGO_ARRAY |
Functions | |
EFI_STATUS EFIAPI | DxeRngLibConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
STATIC EFI_STATUS | GenerateRandomNumberViaNist800Algorithm (OUT UINT8 *Buffer, IN UINTN BufferSize) |
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) |
Variables | |
STATIC EFI_RNG_PROTOCOL * | mRngProtocol |
STATIC UINTN | mFirstAlgo = MAX_UINTN |
Provides an implementation of the library class RngLib that uses the Rng protocol.
Copyright (c) 2023 - 2024, Arm Limited. All rights reserved. Copyright (c) Microsoft Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file DxeRngLib.c.
EFI_STATUS EFIAPI DxeRngLibConstructor | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Constructor routine to probe the available secure Rng algorithms.
ImageHandle | The firmware allocated handle for the EFI image. |
SystemTable | A pointer to the EFI System Table. |
EFI_SUCCESS | Success. |
EFI_NOT_FOUND | Not found. |
EFI_INVALID_PARAMETER | Invalid parameter. |
Definition at line 77 of file DxeRngLib.c.
STATIC EFI_STATUS GenerateRandomNumberViaNist800Algorithm | ( | OUT UINT8 * | Buffer, |
IN UINTN | BufferSize | ||
) |
Routine Description:
Generates a random number via the NIST 800-9A algorithm. Refer to http://csrc.nist.gov/groups/STM/cavp/documents/drbg/DRBGVS.pdf for more information.
[out] | Buffer | Buffer to receive the random number. |
[in] | BufferSize | Number of bytes in Buffer. |
EFI_SUCCESS | or underlying failure code. |
Definition at line 149 of file DxeRngLib.c.
BOOLEAN EFIAPI GetRandomNumber128 | ( | OUT UINT64 * | Rand | ) |
Generates a 128-bit random number.
if Rand is NULL, return FALSE.
[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 328 of file DxeRngLib.c.
BOOLEAN EFIAPI GetRandomNumber16 | ( | OUT UINT16 * | Rand | ) |
Generates a 16-bit random number.
if Rand is NULL, return FALSE.
[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 235 of file DxeRngLib.c.
BOOLEAN EFIAPI GetRandomNumber32 | ( | OUT UINT32 * | Rand | ) |
Generates a 32-bit random number.
if Rand is NULL, return FALSE.
[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 266 of file DxeRngLib.c.
BOOLEAN EFIAPI GetRandomNumber64 | ( | OUT UINT64 * | Rand | ) |
Generates a 64-bit random number.
if Rand is NULL, return FALSE.
[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 297 of file DxeRngLib.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 358 of file DxeRngLib.c.
Definition at line 18 of file DxeRngLib.c.
STATIC EFI_RNG_PROTOCOL* mRngProtocol |
Definition at line 17 of file DxeRngLib.c.