random: credit architectural init the exact amount
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 12 May 2022 13:32:26 +0000 (15:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 May 2022 07:29:16 +0000 (09:29 +0200)
commit4e5e6754a4b6b7c6af8b2c87ed62ec0c5a5eb313
tree06cdf5afc9d3e64abd4468fa979d5c74c9c75608
parent11cce5040c29485f0891e4c2278c5a9d3e65a80e
random: credit architectural init the exact amount

commit 12e45a2a6308105469968951e6d563e8f4fea187 upstream.

RDRAND and RDSEED can fail sometimes, which is fine. We currently
initialize the RNG with 512 bits of RDRAND/RDSEED. We only need 256 bits
of those to succeed in order to initialize the RNG. Instead of the
current "all or nothing" approach, actually credit these contributions
the amount that is actually contributed.

Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/random.c