Re: Changes to make /dev/*random better sooner

Dave Huang <[email protected]> Tue, 8 Apr 2014 21:45:47 -0500
Newsgroups gmane.os.netbsd.devel.crypto,gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
On Apr 8, 2014, at 21:33, Thor Lancelot Simon <[email protected]> wrote:

> On Wed, Apr 09, 2014 at 02:43:23AM +0100, Mindaugas Rasiukevicius wrote:
>> Few fragments which caught my eye while skimming through the diff..
>> 
>>> #if defined(__HAVE_CPU_COUNTER)
>>> -	if (cpu_hascounter())
>>> -		return (cpu_counter32());
>>> +	if (cpu_hascounter() && sizeof(cpu_counter() == sizeof(uint64_t))) {
>>> +		return (cpu_counter());
>>> +	}
>>> #endif
>> 
>> ??
> 
> We provide no MI API for obtaining a counter value of any known size except
> 32 bits, unfortunately.  The instrumentation I added while developing these
> changes revealed that the delta entropy estimator was terribly broken due
> to wraparound; changing it to 64 bits is the fix.

I don't have any knowledge or opinion about that, but maybe the "??" 
has to do with the sizeof? I think the parens are wrong; they're around 
the entire equality comparison.
-- 
Name: Dave Huang         |  Mammal, mammal / their names are called /
INet: [email protected] |  they raise a paw / the bat, the cat /
FurryMUCK: Dahan         |  dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 38 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++