[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YhMRf1tqgB/zSvAs@sol.localdomain>
Date: Sun, 20 Feb 2022 20:13:51 -0800
From: Eric Biggers <ebiggers@...nel.org>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: linux-kernel@...r.kernel.org, Theodore Ts'o <tytso@....edu>,
Dominik Brodowski <linux@...inikbrodowski.net>
Subject: Re: [PATCH v2] random: tie batched entropy generation to base_crng
generation
On Thu, Feb 10, 2022 at 02:13:04PM +0100, Jason A. Donenfeld wrote:
> Now that we have an explicit base_crng generation counter, we don't need
> a separate one for batched entropy. Rather, we can just move the
> generation forward every time we change crng_init state or update the
> base_crng key.
>
> Cc: Theodore Ts'o <tytso@....edu>
> Reviewed-by: Dominik Brodowski <linux@...inikbrodowski.net>
> Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
> ---
> v2 always increments the generation after extraction, as suggested by
> Dominik.
>
> drivers/char/random.c | 29 ++++++++---------------------
> 1 file changed, 8 insertions(+), 21 deletions(-)
Reviewed-by: Eric Biggers <ebiggers@...gle.com>
One comment below:
> @@ -455,7 +453,7 @@ static size_t crng_fast_load(const void *cp, size_t len)
> src++; crng_init_cnt++; len--; ret++;
> }
> if (crng_init_cnt >= CRNG_INIT_CNT_THRESH) {
> - invalidate_batched_entropy();
> + ++base_crng.generation;
> crng_init = 1;
> }
This is an existing issue, but why doesn't crng_slow_load() do this too?
- Eric
Powered by blists - more mailing lists