mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-07-27 17:15:26 -04:00
use a consistent style for fixed-size int types
The stdint.h types don't cover 128-bit integers and the underscore makes them ill suited to usage in function suffixes. Instead, use the common naming style in the Linux kernel and elsewhere including the ChaCha8 implementation included here.
This commit is contained in:
parent
92a33182fb
commit
dcd969ae04
6 changed files with 44 additions and 43 deletions
13
random.h
13
random.h
|
@ -1,9 +1,8 @@
|
|||
#ifndef RANDOM_H
|
||||
#define RANDOM_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "chacha.h"
|
||||
#include "util.h"
|
||||
|
||||
#define RANDOM_CACHE_SIZE 256ULL
|
||||
#define RANDOM_RESEED_SIZE 256ULL * 1024
|
||||
|
@ -12,13 +11,13 @@ struct random_state {
|
|||
size_t index;
|
||||
size_t reseed;
|
||||
chacha_ctx ctx;
|
||||
uint8_t cache[RANDOM_CACHE_SIZE];
|
||||
u8 cache[RANDOM_CACHE_SIZE];
|
||||
};
|
||||
|
||||
void random_state_init(struct random_state *state);
|
||||
uint16_t get_random_u16(struct random_state *state);
|
||||
uint16_t get_random_u16_uniform(struct random_state *state, uint16_t bound);
|
||||
uint64_t get_random_u64(struct random_state *state);
|
||||
uint64_t get_random_u64_uniform(struct random_state *state, uint64_t bound);
|
||||
u16 get_random_u16(struct random_state *state);
|
||||
u16 get_random_u16_uniform(struct random_state *state, u16 bound);
|
||||
u64 get_random_u64(struct random_state *state);
|
||||
u64 get_random_u64_uniform(struct random_state *state, u64 bound);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue