PatchworkOS
Loading...
Searching...
No Matches
rand.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdbool.h>
4#include <stdint.h>
5
22typedef struct
23{
26
31
42uint64_t rand_gen(void* buffer, uint64_t size);
43
51extern uint64_t rdrand_do(uint32_t* value, uint8_t retries);
52
uint64_t rdrand_do(uint32_t *value, uint8_t retries)
Generates a random 32-bit unsigned integer using the RDRAND instruction.
void rand_cpu_init(rand_cpu_ctx_t *ctx)
Initializes the random number generator.
Definition rand.c:28
uint64_t rand_gen(void *buffer, uint64_t size)
Fills a buffer with random bytes.
Definition rand.c:61
EFI_PHYSICAL_ADDRESS buffer
Definition mem.c:15
__UINT32_TYPE__ uint32_t
Definition stdint.h:15
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
__UINT8_TYPE__ uint8_t
Definition stdint.h:11
CPU random number generator context.
Definition rand.h:23
bool rdrandAvail
If set, the RDRAND instruction is avilable and working.
Definition rand.h:24