]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
random: Fix fast_mix() function
authorGeorge Spelvin <linux@horizon.com>
Sat, 7 Feb 2015 05:32:06 +0000 (00:32 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Mar 2015 22:57:15 +0000 (14:57 -0800)
commit8a3f71b3e173ef8be1200d29b8691b2d8ddd5681
treeabbb7adc4af2dc522492cf55ca3753cc14ac73f7
parentb302d582cff6f508a688556ccffa8ff0fcf4c1f6
random: Fix fast_mix() function

commit 19acc77a36970958a4a0e4daeb2c8cb2aab0ffd4 upstream.

There was a bad typo in commit 43759d4f429c ("random: use an improved
fast_mix() function") and I didn't notice because it "looked right", so
I saw what I expected to see when I reviewed it.

Only months later did I look and notice it's not the Threefish-inspired
mix function that I had designed and optimized.

Mea Culpa.  Each input bit still has a chance to affect each output bit,
and the fast pool is spilled *long* before it fills, so it's not a total
disaster, but it's definitely not the intended great improvement.

I'm still working on finding better rotation constants.  These are good
enough, but since it's unrolled twice, it's possible to get better
mixing for free by using eight different constants rather than repeating
the same four.

Signed-off-by: George Spelvin <linux@horizon.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/random.c