On Oct 28, 2001 20:57 -0300, Horst von Brand wrote:
> I have now seen various bits and pieces about this flying around. To get it
> right will be hard, as over/under estimates will show up only under unusual
> circumstances; and as you _can't_ really know how much "entropy" there
> should be, testing this is very hard. So the only way to get it right is
> make it "obviously" right.
********** LATE BREAKING NEWS ***********
Is add_entropy_words() broken for multi-word input??? That would be very bad.
In one most cases we are only dealing with two word inputs, but is really bad
where it counts - transferring values to the secondary pool, which is where
we really get data from for /dev/random.
It appears that we repeatedly add the first word to the entropy pool, no
matter how many words are passed!!! I checked the kernel CVS repository,
and it has been like this since a big change in 2.3.16. Ugh!!!
Is there something I'm missing? Even in the 2.3.16 version, we never
change "in" from its initial value, so we only use the first input word.
The older (2.2, 2.3.15-) code had it correct, in that it explicitly worked
on both of the input words.
A quick patch to fix this is below.
Cheers, Andreas
PS: what's up with new_rotate? Why not just do it like:
r->input_rotate = (r->input_rotate + (i ? 7 : 14)) & 31;
===========================================================================
--- linux/drivers/char/random.c.old Sun Oct 28 22:26:31 2001
+++ linux/drivers/char/random.c Sun Oct 28 22:25:11 2001
@@ -564,7 +564,7 @@
__u32 w;
while (nwords--) {
- w = rotate_left(r->input_rotate, *in);
+ w = rotate_left(r->input_rotate, *in++);
i = r->add_ptr = (r->add_ptr - 1) & wordmask;
/*
* Normally, we add 7 bits of rotation to the pool.
Cheers, Andreas
-- Andreas Dilger http://sourceforge.net/projects/ext2resize/ http://www-mddsp.enel.ucalgary.ca/People/adilger/- 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 : Wed Oct 31 2001 - 21:00:36 EST