Use rnd_getmore as intended. No more essay needed here.
Workaround for buffering got pushed into rnd_getmore, closer to the actual cause of the problem.
This commit is contained in:
parent
77ebf39786
commit
b93e5db80e
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: kern_rndsink.c,v 1.16 2015/04/21 04:24:16 riastradh Exp $ */
|
/* $NetBSD: kern_rndsink.c,v 1.17 2016/05/21 15:33:40 riastradh Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: kern_rndsink.c,v 1.16 2015/04/21 04:24:16 riastradh Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: kern_rndsink.c,v 1.17 2016/05/21 15:33:40 riastradh Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -142,21 +142,10 @@ rndsinks_enqueue(struct rndsink *rndsink)
|
|||||||
|
|
||||||
KASSERT(mutex_owned(&rndsinks.lock));
|
KASSERT(mutex_owned(&rndsinks.lock));
|
||||||
|
|
||||||
/*
|
/* Kick on-demand entropy sources. */
|
||||||
* XXX This should request only rndsink->rs_bytes bytes of
|
rnd_getmore(rndsink->rsink_bytes);
|
||||||
* entropy, but that might get buffered up indefinitely because
|
|
||||||
* kern_rndq has no bound on the duration before it will
|
|
||||||
* process queued entropy samples. To work around this, we are
|
|
||||||
* a little too incestuous with kern_rndq: we avoid marking polled
|
|
||||||
* sources "fast" there, and know here that for non-fast sources,
|
|
||||||
* that code will buffer two ints worth of data per source.
|
|
||||||
* Later, we ought to (a) bound the duration before
|
|
||||||
* queued entropy samples get processed, and (b) add a target
|
|
||||||
* or something -- as soon as we get that much from the entropy
|
|
||||||
* sources, distribute it.
|
|
||||||
*/
|
|
||||||
rnd_getmore(MAX(rndsink->rsink_bytes, 2 * sizeof(uint32_t)));
|
|
||||||
|
|
||||||
|
/* Ensure this rndsink is on the queue. */
|
||||||
switch (rndsink->rsink_state) {
|
switch (rndsink->rsink_state) {
|
||||||
case RNDSINK_IDLE:
|
case RNDSINK_IDLE:
|
||||||
/* Not on the queue and nobody is handling it. */
|
/* Not on the queue and nobody is handling it. */
|
||||||
|
Loading…
Reference in New Issue
Block a user