summaryrefslogtreecommitdiffstats
path: root/sys/dev/random/randomdev.h
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2003-11-17 23:02:21 +0000
committermarkm <markm@FreeBSD.org>2003-11-17 23:02:21 +0000
commitf9c943515638ad456438656dd3d79e6896d4089d (patch)
tree3d031ff4aa808b1f35307d1c7c1e8da496ee119c /sys/dev/random/randomdev.h
parentcc012e083576d0a4a3c5362245a17f627fbe19c4 (diff)
downloadFreeBSD-src-f9c943515638ad456438656dd3d79e6896d4089d.zip
FreeBSD-src-f9c943515638ad456438656dd3d79e6896d4089d.tar.gz
Overhaul the entropy device:
o Each source gets its own queue, which is a FIFO, not a ring buffer. The FIFOs are implemented with the sys/queue.h macros. The separation is so that a low entropy/high rate source can't swamp the harvester with low-grade entropy and destroy the reseeds. o Each FIFO is limited to 256 (set as a macro, so adjustable) events queueable. Full FIFOs are ignored by the harvester. This is to prevent memory wastage, and helps to keep the kernel thread CPU usage within reasonable limits. o There is no need to break up the event harvesting into ${burst} sized chunks, so retire that feature. o Break the device away from its roots with the memory device, and allow it to get its major number automagically.
Diffstat (limited to 'sys/dev/random/randomdev.h')
-rw-r--r--sys/dev/random/randomdev.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/random/randomdev.h b/sys/dev/random/randomdev.h
index 359dc26..aa23fc8 100644
--- a/sys/dev/random/randomdev.h
+++ b/sys/dev/random/randomdev.h
@@ -46,14 +46,17 @@
SYSCTL_DECL(_kern_random);
+MALLOC_DECLARE(M_ENTROPY);
+
/* These are used to queue harvested packets of entropy. The entropy
* buffer size is pretty arbitrary.
*/
struct harvest {
- u_int64_t somecounter; /* fast counter for clock jitter */
+ uintmax_t somecounter; /* fast counter for clock jitter */
u_char entropy[HARVESTSIZE]; /* the harvested entropy */
u_int size, bits, frac; /* stats about the entropy */
enum esource source; /* stats about the entropy */
+ STAILQ_ENTRY(harvest) next; /* next item on the list */
};
void random_init(void);
OpenPOWER on IntegriCloud