]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 21 Feb 2022 19:11:35 +0000 (20:11 +0100)
commit290d8f51e8dff054cf2d54a03d4a6da4005bd24c
tree8c6ce996ba1b7ebcdd18a0068a0c341e2ee86c49
parentcd68b711c9cbb730bc6c518d213238a1d5732a9f
random: use hash function for crng_slow_load()

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>
drivers/char/random.c