diff options
author | markm <markm@FreeBSD.org> | 2015-08-17 07:36:12 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2015-08-17 07:36:12 +0000 |
commit | 3f5a6af67aa31b22afbac2e407ff527052cbc720 (patch) | |
tree | 607f453932abecc199a5542abc16308de508677e /sys/sys/random.h | |
parent | 9d08caeba8295dbd7762ac4c959b02bbeeeb8559 (diff) | |
download | FreeBSD-src-3f5a6af67aa31b22afbac2e407ff527052cbc720.zip FreeBSD-src-3f5a6af67aa31b22afbac2e407ff527052cbc720.tar.gz |
Add DEV_RANDOM pseudo-option and use it to "include out" random(4)
if desired.
Retire randomdev_none.c and introduce random_infra.c for resident
infrastructure. Completely stub out random(4) calls in the "without
DEV_RANDOM" case.
Add RANDOM_LOADABLE option to allow loadable Yarrow/Fortuna/LocallyWritten
algorithm. Add a skeleton "other" algorithm framework for folks
to add their own processing code. NIST, anyone?
Retire the RANDOM_DUMMY option.
Build modules for Yarrow, Fortuna and "other".
Use atomics for the live entropy rate-tracking.
Convert ints to bools for the 'seeded' logic.
Move _write() function from the algorithm-specific areas to randomdev.c
Get rid of reseed() function - it is unused.
Tidy up the opt_*.h includes.
Update documentation for random(4) modules.
Fix test program (reviewers, please leave this).
Differential Revision: https://reviews.freebsd.org/D3354
Reviewed by: wblock,delphij,jmg,bjk
Approved by: so (/dev/random blanket)
Diffstat (limited to 'sys/sys/random.h')
-rw-r--r-- | sys/sys/random.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/sys/sys/random.h b/sys/sys/random.h index 78a9955..92eb80f 100644 --- a/sys/sys/random.h +++ b/sys/sys/random.h @@ -33,10 +33,29 @@ #include <sys/types.h> +#include "opt_random.h" + +#if defined(RANDOM_LOADABLE) && defined(RANDOM_YARROW) +#error "Cannot define both RANDOM_LOADABLE and RANDOM_YARROW" +#endif + struct uio; +#if defined(DEV_RANDOM) u_int read_random(void *, u_int); int read_random_uio(struct uio *, bool); +#else +static __inline int +read_random_uio(void *a __unused, u_int b __unused) +{ + return (0); +} +static __inline u_int +read_random(void *a __unused, u_int b __unused) +{ + return (0); +} +#endif /* * Note: if you add or remove members of random_entropy_source, remember to also update the @@ -76,15 +95,15 @@ enum random_entropy_source { #define RANDOM_HARVEST_EVERYTHING_MASK ((1 << (RANDOM_ENVIRONMENTAL_END + 1)) - 1) -#if defined(RANDOM_DUMMY) -#define random_harvest_queue(a, b, c, d) do {} while (0) -#define random_harvest_fast(a, b, c, d) do {} while (0) -#define random_harvest_direct(a, b, c, d) do {} while (0) -#else /* !defined(RANDOM_DUMMY) */ +#if defined(DEV_RANDOM) void random_harvest_queue(const void *, u_int, u_int, enum random_entropy_source); void random_harvest_fast(const void *, u_int, u_int, enum random_entropy_source); void random_harvest_direct(const void *, u_int, u_int, enum random_entropy_source); -#endif /* defined(RANDOM_DUMMY) */ +#else +#define random_harvest_queue(a, b, c, d) do {} while (0) +#define random_harvest_fast(a, b, c, d) do {} while (0) +#define random_harvest_direct(a, b, c, d) do {} while (0) +#endif #endif /* _KERNEL */ |