TianoCore EDK2 master
Loading...
Searching...
No Matches
Rndr.c File Reference
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/RngLib.h>
#include "ArmRng.h"
#include "BaseRngLibInternals.h"

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI BaseRngLibConstructor (VOID)
 
BOOLEAN EFIAPI ArchGetRandomNumber16 (OUT UINT16 *Rand)
 
BOOLEAN EFIAPI ArchGetRandomNumber32 (OUT UINT32 *Rand)
 
BOOLEAN EFIAPI ArchGetRandomNumber64 (OUT UINT64 *Rand)
 
BOOLEAN EFIAPI ArchIsRngSupported (VOID)
 
EFI_STATUS EFIAPI GetRngGuid (GUID *RngGuid)
 

Variables

STATIC BOOLEAN mRndrSupported
 

Detailed Description

Random number generator service that uses the RNDR instruction to provide pseudorandom numbers.

Copyright (c) 2023, Arm Limited. All rights reserved.
Copyright (c) 2021, NUVIA Inc. All rights reserved.
Copyright (c) 2015, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Rndr.c.

Function Documentation

◆ ArchGetRandomNumber16()

BOOLEAN EFIAPI ArchGetRandomNumber16 ( OUT UINT16 *  Rand)

Generates a 16-bit random number.

Parameters
[out]RandBuffer pointer to store the 16-bit random value.
Return values
TRUERandom number generated successfully.
FALSEFailed to generate the random number.

Definition at line 64 of file Rndr.c.

◆ ArchGetRandomNumber32()

BOOLEAN EFIAPI ArchGetRandomNumber32 ( OUT UINT32 *  Rand)

Generates a 32-bit random number.

Parameters
[out]RandBuffer pointer to store the 32-bit random value.
Return values
TRUERandom number generated successfully.
FALSEFailed to generate the random number.

Definition at line 89 of file Rndr.c.

◆ ArchGetRandomNumber64()

BOOLEAN EFIAPI ArchGetRandomNumber64 ( OUT UINT64 *  Rand)

Generates a 64-bit random number.

Parameters
[out]RandBuffer pointer to store the 64-bit random value.
Return values
TRUERandom number generated successfully.
FALSEFailed to generate the random number.

Definition at line 114 of file Rndr.c.

◆ ArchIsRngSupported()

BOOLEAN EFIAPI ArchIsRngSupported ( VOID  )

Checks whether RNDR is supported.

Return values
TRUERNDR is supported.
FALSERNDR is not supported.

Definition at line 130 of file Rndr.c.

◆ BaseRngLibConstructor()

EFI_STATUS EFIAPI BaseRngLibConstructor ( VOID  )

The constructor function checks whether or not RNDR instruction is supported by the host hardware.

The constructor function checks whether or not RNDR instruction is supported. It will ASSERT() if RNDR instruction is not supported. It will always return EFI_SUCCESS.

Return values
EFI_SUCCESSThe constructor always returns EFI_SUCCESS.

Definition at line 37 of file Rndr.c.

◆ GetRngGuid()

EFI_STATUS EFIAPI GetRngGuid ( GUID RngGuid)

Get a GUID identifying the RNG algorithm implementation.

Parameters
[out]RngGuidIf success, contains the GUID identifying the RNG algorithm implementation.
Return values
EFI_SUCCESSSuccess.
EFI_UNSUPPORTEDNot supported.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 149 of file Rndr.c.

Variable Documentation

◆ mRndrSupported

STATIC BOOLEAN mRndrSupported

Definition at line 22 of file Rndr.c.