Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/random.h
Show All 37 Lines | |||||
static inline void | static inline void | ||||
get_random_bytes(void *buf, int nbytes) | get_random_bytes(void *buf, int nbytes) | ||||
{ | { | ||||
if (read_random(buf, nbytes) == 0) | if (read_random(buf, nbytes) == 0) | ||||
arc4rand(buf, nbytes, 0); | arc4rand(buf, nbytes, 0); | ||||
} | } | ||||
static inline uint32_t | |||||
get_random_u32(void) | |||||
{ | |||||
uint32_t val; | |||||
get_random_bytes(&val, sizeof(val)); | |||||
bwidawsk: get_random_int already does this. Maybe just
```
#define get_random_u32 get_random_int
```
? | |||||
return (val); | |||||
} | |||||
static inline u_int | static inline u_int | ||||
get_random_int(void) | get_random_int(void) | ||||
{ | { | ||||
u_int val; | u_int val; | ||||
get_random_bytes(&val, sizeof(val)); | get_random_bytes(&val, sizeof(val)); | ||||
return (val); | return (val); | ||||
} | } | ||||
Show All 11 Lines |
get_random_int already does this. Maybe just
?