|
iPXE
|
EFI random number generator protocol entropy source. More...
#include <errno.h>#include <ipxe/entropy.h>#include <ipxe/crc32.h>#include <ipxe/efi/efi.h>#include <ipxe/efi/Protocol/Rng.h>Go to the source code of this file.
Macros | |
| #define | EFIRNG_LEN 32 |
| Minimum number of bytes to request from RNG. More... | |
| #define | EFIRNG_MAX_RETRY 16 |
| Maximum number of times to attempting requesting data from RNG. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| struct entropy_source efirng_entropy | __entropy_source (ENTROPY_NORMAL) |
| EFI random number generator protocol entropy source. More... | |
| EFI_REQUEST_PROTOCOL (EFI_RNG_PROTOCOL, &efirng) | |
| static int | efirng_enable (void) |
| Enable entropy gathering. More... | |
| static int | efirng_get_noise (noise_sample_t *noise) |
| Get noise sample from RNG protocol. More... | |
Variables | |
| static EFI_RNG_PROTOCOL * | efirng |
| Random number generator protocol. More... | |
EFI random number generator protocol entropy source.
Definition in file efi_rng.c.
| #define EFIRNG_LEN 32 |
Minimum number of bytes to request from RNG.
The UEFI spec states (for no apparently good reason) that "When a Deterministic Random Bit Generator (DRBG) is used on the output of a (raw) entropy source, its security level must be at least 256 bits." The EDK2 codebase (mis)interprets this to mean that the call to GetRNG() should fail if given a buffer less than 32 bytes.
Incidentally, nothing in the EFI RNG protocol provides any way to report the actual amount of entropy returned by GetRNG().
| #define EFIRNG_MAX_RETRY 16 |
Maximum number of times to attempting requesting data from RNG.
The UEFI spec allows GetRNG() to return EFI_NOT_READY, which is not a particularly helpful error status since there is nothing that can sensibly be done except to retry immediately. We retry failed calls to GetRNG() (for any reason) up to this number of times.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| struct entropy_source rtc_entropy __entropy_source | ( | ENTROPY_NORMAL | ) |
EFI random number generator protocol entropy source.
RTC entropy source.
| EFI_REQUEST_PROTOCOL | ( | EFI_RNG_PROTOCOL | , |
| & | efirng | ||
| ) |
|
static |
Enable entropy gathering.
| rc | Return status code |
Definition at line 71 of file efi_rng.c.
References DBGC, efirng, ENOTSUP, entropy_init(), and MIN_ENTROPY.
|
static |
Get noise sample from RNG protocol.
| noise | Noise sample |
| rc | Return status code |
Definition at line 95 of file efi_rng.c.
References assert(), crc32_le(), DBGC, EEFI, efirng, EFIRNG_LEN, EFIRNG_MAX_RETRY, _EFI_RNG_INTERFACE::GetRNG, NULL, rc, and strerror().
|
static |
Random number generator protocol.
Definition at line 41 of file efi_rng.c.
Referenced by efirng_enable(), and efirng_get_noise().
1.8.15