|
PatchworkOS
19e446b
A non-POSIX operating system.
|
Random Number Generator. More...
Random Number Generator.
The random number generator driver provides functions to generate random numbers for use in the kernel.
Data Structures | |
| struct | rand_cpu_t |
| CPU random number generator context. More... | |
Functions | |
| uint64_t | rand_gen (void *buffer, uint64_t size) |
| Fills a buffer with random bytes. | |
| uint64_t | rdrand_do (uint32_t *value, uint8_t retries) |
| Generates a random 32-bit unsigned integer using the RDRAND instruction. | |
Fills a buffer with random bytes.
If the RDRAND instruction is available and working, it will be used. Otherwise, a fallback time based RNG will be used.
| buffer | A pointer to the buffer to fill. |
| size | The number of bytes to fill. |
0. On failure, ERR and errno is set. Definition at line 64 of file rand.c.
Generates a random 32-bit unsigned integer using the RDRAND instruction.
| value | A pointer to store the generated random value. |
| retries | The number of retries to attempt if RDRAND fails. |
0. On failure, ERR and errno is set.