Re: [PATCH v2] random: tie batched entropy generation to base_crng generation

From: Jason A. Donenfeld
Date: Mon Feb 21 2022 - 09:36:10 EST


On Mon, Feb 21, 2022 at 5:13 AM Eric Biggers <ebiggers@xxxxxxxxxx> wrote:
> > @@ -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?

Because it's called by add_device_randomness(), which is mostly
ingesting static bytes, akin to what you get by running `dmidecode`
and such. The idea is that this is something that's good to mix, but
bad to credit. I think there was a CVE a few years back about this,
precipitating the change.

Jason