diff options
author | markm <markm@FreeBSD.org> | 2000-10-14 10:59:56 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2000-10-14 10:59:56 +0000 |
commit | a8d2363750f62cf99c9e91b3edb208a5862543e9 (patch) | |
tree | 9b8a3e92ad99aac2e9f68f5d325968f510b05f7e /sys/dev/random/yarrow.h | |
parent | 4dcc092204f26668eab762bae3b04da3bc9007b5 (diff) | |
download | FreeBSD-src-a8d2363750f62cf99c9e91b3edb208a5862543e9.zip FreeBSD-src-a8d2363750f62cf99c9e91b3edb208a5862543e9.tar.gz |
After some complaints about the dir names, the random device is
now in dirs called sys/*/random/ instead of sys/*/randomdev/*.
Introduce blocking, but only at startup; the random device will
block until the first reseed happens to prevent clients from
using untrustworthy output.
Provide a read_random() call for the rest of the kernel so that
the entropy device does not need to be present. This means that
things like IPX no longer need to have "device random" hardcoded
into thir kernel config. The downside is that read_random() will
provide very poor output until the entropy device is loaded and
reseeded. It is recommended that developers do NOT use the
read_random() call; instead, they should use arc4random() which
internally uses read_random().
Clean up the mutex and locking code a bit; this makes it possible
to unload the module again.
Diffstat (limited to 'sys/dev/random/yarrow.h')
-rw-r--r-- | sys/dev/random/yarrow.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/dev/random/yarrow.h b/sys/dev/random/yarrow.h index a81fa1f..4bf97fd 100644 --- a/sys/dev/random/yarrow.h +++ b/sys/dev/random/yarrow.h @@ -36,16 +36,18 @@ #define ENTROPYBIN 256 /* buckets to harvest entropy events */ #define TIMEBIN 16 /* max value for Pt/t */ +#define HARVESTSIZE 16 /* max size of each harvested entropy unit */ + #define FAST 0 #define SLOW 1 int random_init(void); void random_deinit(void); -void random_init_harvester(void (*)(struct timespec *, void *, u_int, u_int, u_int, enum esource)); +void random_init_harvester(void (*)(struct timespec *, void *, u_int, u_int, u_int, enum esource), u_int (*)(void *, u_int)); void random_deinit_harvester(void); -void random_set_wakeup(int *, int); -void random_set_wakeup_exit(int *, int, int); +void random_set_wakeup_exit(void *); +u_int read_random_real(void *, u_int); void write_random(void *, u_int); /* This is the beastie that needs protecting. It contains all of the @@ -70,6 +72,8 @@ struct random_state { struct yarrowhash hash; /* accumulated entropy */ } pool[2]; /* pool[0] is fast, pool[1] is slow */ int which; /* toggle - shows the current insertion pool */ + int seeded; /* 0 until first reseed, then 1 */ + struct selinfo rsel; /* For poll(2) */ }; extern struct random_state random_state; |