random: do not xor RDRAND when writing into /dev/random
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 8 Feb 2022 12:00:11 +0000 (13:00 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sun, 13 Feb 2022 23:46:08 +0000 (00:46 +0100)
commite8d4b479251df452d0b9dd3356385b32c8f9294e
treea4757e6b1bcaeec9d0cb5a1115522265aa38f6a5
parent75b8fd96f4dcedab125ad45058bd7018111488fc
random: do not xor RDRAND when writing into /dev/random

Continuing the reasoning of "random: ensure early RDSEED goes through
mixer on init", we don't want RDRAND interacting with anything without
going through the mixer function, as a backdoored CPU could presumably
cancel out data during an xor, which it'd have a harder time doing when
being forced through a cryptographic hash function. There's actually no
need at all to be calling RDRAND in write_pool(), because before we
extract from the pool, we always do so with 32 bytes of RDSEED hashed in
at that stage. Xoring at this stage is needless and introduces a minor
liability.

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