random: use hash function for crng_slow_load()
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 8 Feb 2022 18:23:17 +0000 (19:23 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2022 09:46:33 +0000 (11:46 +0200)
commitacbf6f4851e3d3815fa8907afffbbcf9140eb3f4
tree943eba74a2ad1ab9abf1945b5c5dc4beae0c40f6
parent5a595c18329ee6fe9c35c2dfa18346b20ff89d7a
random: use hash function for crng_slow_load()

commit 66e4c2b9541503d721e936cc3898c9f25f4591ff upstream.

Since we have a hash function that's really fast, and the goal of
crng_slow_load() is reportedly to "touch all of the crng's state", we
can just hash the old state together with the new state and call it a
day. This way we dont need to reason about another LFSR or worry about
various attacks there. This code is only ever used at early boot and
then never again.

Cc: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/random.c
include/linux/hw_random.h
include/linux/random.h
include/trace/events/random.h