From 18ddb86ce6faf536d3035558a6365f53cddb31c7 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Mon, 24 Nov 2008 16:38:06 +0000 Subject: 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 --- sys/kern/kern_tc.c | 7 +++++-- 1 file 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 #include #include +#include #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(); -- cgit v1.2.3