summaryrefslogtreecommitdiffstats
path: root/sys/dev/random
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/random')
-rw-r--r--sys/dev/random/random_adaptors.c14
-rw-r--r--sys/dev/random/randomdev_soft.c5
-rw-r--r--sys/dev/random/yarrow.c14
3 files changed, 33 insertions, 0 deletions
diff --git a/sys/dev/random/random_adaptors.c b/sys/dev/random/random_adaptors.c
index 3d58214..8cbebbc 100644
--- a/sys/dev/random/random_adaptors.c
+++ b/sys/dev/random/random_adaptors.c
@@ -227,3 +227,17 @@ SYSINIT(random_adaptors, SI_SUB_DRIVERS, SI_ORDER_FIRST, random_adaptors_init,
NULL);
SYSUNINIT(random_adaptors, SI_SUB_DRIVERS, SI_ORDER_FIRST,
random_adaptors_deinit, NULL);
+
+static void
+random_adaptors_reseed(void *unused)
+{
+
+ (void)unused;
+ if (random_adaptor != NULL) {
+ (*random_adaptor->reseed)();
+ random_adaptor->seeded = 1;
+ }
+ arc4rand(NULL, 0, 1);
+}
+SYSINIT(random_reseed, SI_SUB_INTRINSIC_POST, SI_ORDER_SECOND,
+ random_adaptors_reseed, NULL);
diff --git a/sys/dev/random/randomdev_soft.c b/sys/dev/random/randomdev_soft.c
index 352d0ae..9c3aa53 100644
--- a/sys/dev/random/randomdev_soft.c
+++ b/sys/dev/random/randomdev_soft.c
@@ -26,11 +26,16 @@
*
*/
+#include "opt_random.h"
+
#if !defined(YARROW_RNG) && !defined(FORTUNA_RNG)
#define YARROW_RNG
#elif defined(YARROW_RNG) && defined(FORTUNA_RNG)
#error "Must define either YARROW_RNG or FORTUNA_RNG"
#endif
+#if defined(FORTUNA_RNG)
+#error "Fortuna is not yet implemented"
+#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/sys/dev/random/yarrow.c b/sys/dev/random/yarrow.c
index 6d2ea3b..1cfa373 100644
--- a/sys/dev/random/yarrow.c
+++ b/sys/dev/random/yarrow.c
@@ -28,6 +28,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_random.h"
+
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/lock.h>
@@ -398,5 +400,17 @@ generator_gate(void)
void
random_yarrow_reseed(void)
{
+#ifdef RANDOM_DEBUG
+ int i;
+
+ printf("%s(): fast:", __func__);
+ for (i = RANDOM_START; i < ENTROPYSOURCE; ++i)
+ printf(" %d", random_state.pool[FAST].source[i].bits);
+ printf("\n");
+ printf("%s(): slow:", __func__);
+ for (i = RANDOM_START; i < ENTROPYSOURCE; ++i)
+ printf(" %d", random_state.pool[SLOW].source[i].bits);
+ printf("\n");
+#endif
reseed(SLOW);
}
OpenPOWER on IntegriCloud