54 #define EFI_ENTROPY_RNG_LEN 32 64 #define EFI_ENTROPY_TRIGGER_TIME 10 79 DBGC ( &
tick,
"ENTROPY %s RNG protocol\n",
80 (
efirng ?
"has" :
"has no" ) );
89 DBGC ( &
tick,
"ENTROPY could not create event: %s\n",
127 DBGC ( &
tick,
"ENTROPY could not set timer: %s\n",
133 DBGC ( &
tick,
"ENTROPY could not wait for timer tick: %s\n",
139 low = profile_timestamp();
170 *noise = ( after - before );
195 DBGC ( &
tick,
"ENTROPY could not read from RNG: %s\n",
203 if (
memcmp ( buf, prev,
sizeof ( buf ) ) == 0 ) {
204 DBGC ( &
tick,
"ENTROPY detected broken EFI RNG:\n" );
209 memcpy ( prev, buf,
sizeof ( prev ) );
216 *noise =
crc32_le ( 0, buf,
sizeof ( buf ) );
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
EFI_RNG_PROTOCOL as defined in UEFI 2.4.
struct arbelprm_rc_send_wqe rc
static int efi_entropy_tick(void)
Wait for a timer tick.
EFI_REQUEST_PROTOCOL(EFI_RNG_PROTOCOL, &efirng)
uint32_t low
Low 16 bits of address.
void entropy_disable(void)
Disable entropy gathering.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
An event is to be signaled once at a specified interval from the current time.
static EFI_EVENT tick
Event used to wait for timer tick.
static EFI_RNG_PROTOCOL * efirng
Random number generator protocol.
VOID * EFI_EVENT
Handle to an event structure.
static int efi_get_noise(noise_sample_t *noise)
Get noise sample.
min_entropy_t min_entropy_per_sample(void)
min-entropy per sample
int get_noise(noise_sample_t *noise)
Get noise sample.
#define EFI_ENTROPY_RNG_LEN
Minimum number of bytes to request from RNG.
EFI_CLOSE_EVENT CloseEvent
The Random Number Generator (RNG) protocol provides random bits for use in applications,...
#define EFI_ENTROPY_TRIGGER_TIME
Time (in 100ns units) to delay waiting for timer tick.
static void efi_entropy_disable(void)
Disable entropy gathering.
EFI_TPL efi_internal_tpl
Internal task priority level.
#define ENOTSUP
Operation not supported.
u32 crc32_le(u32 seed, const void *data, size_t len)
Calculate 32-bit little-endian CRC checksum.
static int efi_entropy_enable(void)
Enable entropy gathering.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
PROVIDE_ENTROPY(efi, entropy_enable, efi_entropy_enable)
PROVIDE_ENTROPY_INLINE(efi, min_entropy_per_sample)
static int efi_get_noise_rng(noise_sample_t *noise)
Get noise sample from RNG protocol.
EFI_CREATE_EVENT CreateEvent
char * strerror(int errno)
Retrieve string representation of error number.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
int entropy_enable(void)
Enable entropy gathering.
UINT64 UINTN
Unsigned value of native width.
EFI_WAIT_FOR_EVENT WaitForEvent
static int efi_get_noise_ticks(noise_sample_t *noise)
Get noise sample from timer ticks.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
#define EIO
Input/output error.
uint8_t noise_sample_t
A noise sample.
EFI_SYSTEM_TABLE * efi_systab
uint64_t index
Index of the first segment within the content.
EFI_RESTORE_TPL RestoreTPL
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
#define NULL
NULL pointer (VOID *)
EFI_TPL efi_external_tpl
External task priority level.