random: ensure early RDSEED goes through mixer on init
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 8 Feb 2022 11:44:28 +0000 (12:44 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sun, 13 Feb 2022 23:46:08 +0000 (00:46 +0100)
commit75b8fd96f4dcedab125ad45058bd7018111488fc
tree2eaa08cb3cb31df6f818f42850bd3bd92b8cc7fe
parent4823f059d0ac2642b6df8941542b29ad97c208d6
random: ensure early RDSEED goes through mixer on init

Continuing the reasoning of "random: use RDSEED instead of RDRAND in
entropy extraction" from this series, at init time we also don't want to
be xoring RDSEED directly into the crng. Instead it's safer to put it
into our entropy collector and then re-extract it, so that it goes
through a hash function with preimage resistance. As a matter of hygiene,
we also order these now so that the RDSEED byte are hashed in first,
followed by the bytes that are likely more predictable (e.g. utsname()).

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