summaryrefslogtreecommitdiff
path: root/sys/dev/rnd.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-01-19 00:24:02 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-01-19 00:24:02 +0000
commitfa6392474683287c5316c868222f36584b36af54 (patch)
treeb720152b3f82c97a58f26aafe9c4960dd19457ec /sys/dev/rnd.c
parenta7223a3f63651e63c62951e53ad1978231f55945 (diff)
In random_start() we can assume the msg buffer is mapped, all systems do
it at startup, or in cpu_startup(). Improve comments to explain what is happening here. ok kettenis jsing
Diffstat (limited to 'sys/dev/rnd.c')
-rw-r--r--sys/dev/rnd.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c
index 76e792f8f71..3995f3967dd 100644
--- a/sys/dev/rnd.c
+++ b/sys/dev/rnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rnd.c,v 1.150 2013/12/28 02:58:17 deraadt Exp $ */
+/* $OpenBSD: rnd.c,v 1.151 2014/01/19 00:24:01 deraadt Exp $ */
/*
* Copyright (c) 2011 Theo de Raadt.
@@ -760,16 +760,18 @@ random_init(void)
_rs_seed((u_int8_t *)version + off, KEYSZ + IVSZ);
}
+/*
+ * Start periodic services inside the random subsystem, which pull
+ * entropy forward, hash it, and re-seed the random stream as needed.
+ */
void
random_start(void)
{
/*
- * On a cold start the message buffer does not contain any
- * unique information yet, just the copyright message and the
- * kernel version string. Unique information like MAC adresses
- * will be added during autoconf.
+ * At this point, the message buffer is mapped, and may contain
+ * some historical information still.
*/
- if (msgbufp && msgbufp->msg_magic == MSG_MAGIC)
+ if (msgbufp->msg_magic == MSG_MAGIC)
add_entropy_words((u_int32_t *)msgbufp->msg_bufc,
msgbufp->msg_bufs / sizeof(u_int32_t));