Re: /dev/random entropy calculations broken?

From: Andreas Dilger (adilger@turbolabs.com)
Date: Tue Oct 02 2001 - 17:28:44 EST


On Oct 02, 2001 16:29 -0500, Oliver Xymoron wrote:
> Cool. Not sure if I like the introduction of poolbits. My personal
> preference would be to s/poolwords/words/ and just use ->words*32, since
> foo->foomember is a throwback to pre-ANSI compilers with a flat namespace
> for structure members. Note that we don't bother prefixing tap*.

I added poolbits because we were doing poolwords * 32 all the time in the
commonly called functions credit_entropy_store() and batch_entropy_process()).
I don't really care either way, except that it makes the code easier to read.

We could always do the following (hackish, but makes code more readable):

#define POOLBITS poolwords*32
#define POOLBYTES poolwords*4

> If not, at least put poolbits in the structure first...
>
> > static struct poolinfo {
> > int poolwords;
> > + int poolbits; /* poolwords * 32 */
> > int tap1, tap2, tap3, tap4, tap5;
> > } poolinfo_table[] = {
> > /* x^2048 + x^1638 + x^1231 + x^819 + x^411 + x + 1 -- 115 */
> > - { 2048, 1638, 1231, 819, 411, 1 },
> > + { 2048, 65536, 1638, 1231, 819, 411, 1 },
> ^^^^^
> ...because it's not as confusing comparing the polynomial in the comment
> to the initializer.

Sorry, I didn't notice that the poolwords was also part of the polynomial.
I'll wait a while before reposting in case of more comments (Ted has been
silent thus far).

Cheers, Andreas

--
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Oct 07 2001 - 21:00:24 EST