Re: [PATCH v1 5/7] random: do not xor RDRAND when writing into /dev/random

From: Eric Biggers
Date: Tue Feb 08 2022 - 18:12:11 EST


On Tue, Feb 08, 2022 at 04:53:33PM +0100, Jason A. Donenfeld wrote:
> 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@xxxxxxx>
> Cc: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
> ---
> drivers/char/random.c | 14 ++------------
> 1 file changed, 2 insertions(+), 12 deletions(-)

Looks good,

Reviewed-by: Eric Biggers <ebiggers@xxxxxxxxxx>

- Eric