summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-11-24 16:38:06 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-11-24 16:38:06 +0000
commit18ddb86ce6faf536d3035558a6365f53cddb31c7 (patch)
tree8c1f85376bb727da2add9806e3a626f8848fb8f3
parent91409f6704dd7598bed37bcec7ddf3c3f1efdafa (diff)
queue tc randomness when we get it. the tc_init() ones are (might be)
submitted before randomattach, and thus will perturb the first arc4random() call, which is very good ok art djm
-rw-r--r--sys/kern/kern_tc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 61ef7e42201..ae762d89ecd 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $OpenBSD: kern_tc.c,v 1.11 2008/11/21 17:56:34 robert Exp $
+ * $OpenBSD: kern_tc.c,v 1.12 2008/11/24 16:38:05 deraadt Exp $
* $FreeBSD: src/sys/kern/kern_tc.c,v 1.148 2003/03/18 08:45:23 phk Exp $
*/
@@ -17,6 +17,7 @@
#include <sys/systm.h>
#include <sys/timetc.h>
#include <sys/malloc.h>
+#include <dev/rndvar.h>
#ifdef __HAVE_TIMECOUNTER
/*
@@ -266,7 +267,8 @@ tc_init(struct timecounter *tc)
tc->tc_frequency < timecounter->tc_frequency)
return;
(void)tc->tc_get_timecount(tc);
- (void)tc->tc_get_timecount(tc);
+ add_timer_randomness(tc->tc_get_timecount(tc));
+
timecounter = tc;
}
@@ -295,6 +297,7 @@ tc_setclock(struct timespec *ts)
bintime_add(&bt2, &boottimebin);
boottimebin = bt;
bintime2timeval(&bt, &boottime);
+ add_timer_randomness(ts->tv_sec);
/* XXX fiddle all the little crinkly bits around the fiords... */
tc_windup();