From owner-freebsd-security@FreeBSD.ORG Thu Sep 27 14:34:24 2012 Return-Path: Delivered-To: freebsd-security@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 888A0106566C for ; Thu, 27 Sep 2012 14:34:24 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 47C908FC15 for ; Thu, 27 Sep 2012 14:34:24 +0000 (UTC) Received: from ds4.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 81A0D6977; Thu, 27 Sep 2012 16:34:23 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id 591F48408; Thu, 27 Sep 2012 16:34:23 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: RW References: <20120918211422.GA1400@garage.freebsd.pl> <20120919192836.3a60cdfd@gumby.homeunix.com> <863923pzgi.fsf@ds4.des.no> <20120927125956.0594fa73@gumby.homeunix.com> Date: Thu, 27 Sep 2012 16:34:23 +0200 In-Reply-To: <20120927125956.0594fa73@gumby.homeunix.com> (RW's message of "Thu, 27 Sep 2012 12:59:56 +0100") Message-ID: <86pq57o7ps.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-security@freebsd.org Subject: Re: Collecting entropy from device_attach() times. X-BeenThere: freebsd-security@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Security issues \[members-only posting\]" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 14:34:24 -0000 RW writes: > static __inline uint64_t > get_cyclecount(void) > { > struct bintime bt; > > binuptime(&bt); > return (bt.frac ^ bt.sec); >=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > } Why the heck does it xor the integer and fractional parts together? That makes no sense at all. I would have used ((uint64_t)bt.sec << 32 | bt.frac >> 32). It wraps around after 136 years' uptime, but hey, you can't win them all. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no