[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yxg7WQ1UuskDrBVj@gondor.apana.org.au>
Date: Wed, 7 Sep 2022 14:34:01 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Dominik Brodowski <linux@...inikbrodowski.net>
Cc: linux-kernel@...r.kernel.org, Jason@...c4.com,
linux-crypto@...r.kernel.org
Subject: Re: [PATCH] random / hw_random: core: start hwrng kthread also for
untrusted sources
Dominik Brodowski <linux@...inikbrodowski.net> wrote:
>
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index 79d7d4e4e582..b360ed4ece03 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -867,9 +867,9 @@ void add_hwgenerator_randomness(const void *buf, size_t len, size_t entropy)
>
> /*
> * Throttle writing to once every CRNG_RESEED_INTERVAL, unless
> - * we're not yet initialized.
> + * we're not yet initialized or this source isn't trusted.
> */
> - if (!kthread_should_stop() && crng_ready())
> + if (!kthread_should_stop() && (crng_ready() || !entropy))
> schedule_timeout_interruptible(CRNG_RESEED_INTERVAL);
> }
> EXPORT_SYMBOL_GPL(add_hwgenerator_randomness);
Couldn't you split this bit out?
Thanks,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists