Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Sep 2012 16:34:23 +0200
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To:        RW <rwmaillists@googlemail.com>
Cc:        freebsd-security@freebsd.org
Subject:   Re: Collecting entropy from device_attach() times.
Message-ID:  <86pq57o7ps.fsf@ds4.des.no>
In-Reply-To: <20120927125956.0594fa73@gumby.homeunix.com> (RW's message of "Thu, 27 Sep 2012 12:59:56 %2B0100")
References:  <20120918211422.GA1400@garage.freebsd.pl> <20120919192836.3a60cdfd@gumby.homeunix.com> <863923pzgi.fsf@ds4.des.no> <CAG5KPzwhq4UzPxbx74vX5KKtqC4tWkTsKAHjGDsdD8MqJVVkRg@mail.gmail.com> <20120927125956.0594fa73@gumby.homeunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
RW <rwmaillists@googlemail.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86pq57o7ps.fsf>