mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-07-30 02:18:52 -04:00
implement a cache for the CSPRNG
This commit is contained in:
parent
70d61b6662
commit
daa44905ee
2 changed files with 26 additions and 5 deletions
7
random.h
7
random.h
|
@ -1,8 +1,13 @@
|
|||
#ifndef RANDOM_H
|
||||
#define RANDOM_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define RANDOM_CACHE_SIZE 4096
|
||||
|
||||
struct random_state {
|
||||
char unused;
|
||||
size_t index;
|
||||
uint8_t cache[RANDOM_CACHE_SIZE];
|
||||
};
|
||||
|
||||
void get_random_seed(void *buf, size_t size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue