aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/randomdev
diff options
context:
space:
mode:
authorMark Murray <markm@FreeBSD.org>2000-07-17 12:23:04 +0000
committerMark Murray <markm@FreeBSD.org>2000-07-17 12:23:04 +0000
commit720a3741cf8c06f597bac5a1a216b6018278dc89 (patch)
tree16e98d700cd7410cc205c4fcfe45d099a0233554 /sys/dev/randomdev
parente492a4c41acb5f4f91427d026414de4c36059963 (diff)
Notes
Diffstat (limited to 'sys/dev/randomdev')
-rw-r--r--sys/dev/randomdev/randomdev.c2
-rw-r--r--sys/dev/randomdev/yarrow.c19
2 files changed, 20 insertions, 1 deletions
diff --git a/sys/dev/randomdev/randomdev.c b/sys/dev/randomdev/randomdev.c
index ff5e481d6689c..c84f4bd670305 100644
--- a/sys/dev/randomdev/randomdev.c
+++ b/sys/dev/randomdev/randomdev.c
@@ -117,7 +117,7 @@ random_write(dev_t dev, struct uio *uio, int flag)
error = uiomove(random_buf, c, uio);
if (error)
break;
- /* write_random(random_buf, c); */
+ write_random(random_buf, c);
}
free(random_buf, M_TEMP);
return error;
diff --git a/sys/dev/randomdev/yarrow.c b/sys/dev/randomdev/yarrow.c
index c6ae4481a0ebd..e5174d9cc9b5d 100644
--- a/sys/dev/randomdev/yarrow.c
+++ b/sys/dev/randomdev/yarrow.c
@@ -274,6 +274,25 @@ read_random(char *buf, u_int count)
return retval;
}
+void
+write_random(char *buf, u_int count)
+{
+ u_int i;
+ intrmask_t mask;
+ struct timespec nanotime;
+
+ /* The reseed task must not be jumped on */
+ mask = splsofttq();
+ for (i = 0; i < count/sizeof(u_int64_t); i++) {
+ getnanotime(&nanotime);
+ random_harvest_internal(&nanotime,
+ *(u_int64_t *)&buf[i*sizeof(u_int64_t)],
+ 0, 0, RANDOM_WRITE);
+ }
+ reseed(FAST);
+ splx(mask);
+}
+
static void
generator_gate(void)
{