TianoCore EDK2 master
Loading...
Searching...
No Matches
BaseRng.c File Reference

Go to the source code of this file.

Macros

#define GETRANDOM_RETRY_LIMIT   10
 

Functions

BOOLEAN EFIAPI GetRandomNumber16 (OUT UINT16 *Rand)
 
BOOLEAN EFIAPI GetRandomNumber32 (OUT UINT32 *Rand)
 
BOOLEAN EFIAPI GetRandomNumber64 (OUT UINT64 *Rand)
 
BOOLEAN EFIAPI GetRandomNumber128 (OUT UINT64 *Rand)
 

Detailed Description

Random number generator services that uses CPU RNG instructions to provide random numbers.

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 BaseRng.c.

Macro Definition Documentation

◆ GETRANDOM_RETRY_LIMIT

#define GETRANDOM_RETRY_LIMIT   10

Definition at line 22 of file BaseRng.c.

Function Documentation

◆ GetRandomNumber128()

BOOLEAN EFIAPI GetRandomNumber128 ( OUT UINT64 *  Rand)

Generates a 128-bit random number.

if Rand is NULL, then ASSERT().

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

Definition at line 160 of file BaseRng.c.

◆ GetRandomNumber16()

BOOLEAN EFIAPI GetRandomNumber16 ( OUT UINT16 *  Rand)

Generates a 16-bit random number.

if Rand is NULL, then ASSERT().

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 37 of file BaseRng.c.

◆ GetRandomNumber32()

BOOLEAN EFIAPI GetRandomNumber32 ( OUT UINT32 *  Rand)

Generates a 32-bit random number.

if Rand is NULL, then ASSERT().

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 78 of file BaseRng.c.

◆ GetRandomNumber64()

BOOLEAN EFIAPI GetRandomNumber64 ( OUT UINT64 *  Rand)

Generates a 64-bit random number.

if Rand is NULL, then ASSERT().

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 119 of file BaseRng.c.