11 #include <sys/cdefs.h>
14 #include <sys/types.h>
15 #include <sys/param.h>
16 #include <sys/kernel.h>
17 #include <sys/random.h>
18 #include <sys/libkern.h>
20 #include <sys/mutex.h>
23 #define ARC4_RESEED_BYTES 65536
24 #define ARC4_RESEED_SECONDS 300
25 #define ARC4_KEYBYTES (256 / 8)
55 struct timeval tv_now;
62 getmicrouptime(&tv_now);
66 for (n = r; n <
sizeof(key); n++)
70 for (n = 0; n < 256; n++) {
85 for (n = 0; n < 256*4; n++)
98 mtx_init(&
arc4_mtx,
"arc4_mtx", NULL, MTX_DEF);
100 for (n = 0; n < 256; n++)
136 ARC4_ENTR_SEED) || reseed ||
SYSINIT(arc4_init, SI_SUB_LOCK, SI_ORDER_ANY, arc4_init, NULL)
uint32_t arc4random(void)
static u_int8_t arc4_sbox[256]
static void arc4_randomstir(void)
int arc4rand_iniseed_state
static u_int8_t arc4_randbyte(void)
#define ARC4_RESEED_BYTES
void arc4rand(void *ptr, u_int len, int reseed)
static __inline void arc4_swap(u_int8_t *a, u_int8_t *b)
#define ARC4_RESEED_SECONDS
static struct mtx arc4_mtx
static void arc4_init(void)
static time_t arc4_t_reseed