Re: [PATCH v2 05/10] random: group crng functions
From: Jason A. Donenfeld
Date: Sun Feb 13 2022 - 08:14:49 EST
Hi Dominik,
On Sun, Feb 13, 2022 at 7:57 AM Dominik Brodowski
<linux@xxxxxxxxxxxxxxxxxxxx> wrote:
> No, it's for crng_init == 0 only.
Right! Nice catch, thanks.
> > + * Batched entropy returns random integers. The quality of the random
> > + * number is good as /dev/urandom. In order to ensure that the randomness
>
> /dev/random
/dev/urandom is the right analogy, actually, since batched entropy won't wait.
> > +size_t __must_check get_random_bytes_arch(void *buf, size_t nbytes)
>
> Sidenote: We should get rid of the sole caller of that function, and then of
> this function. AFAICS, using get_random_bytes() (once rand_initialize() has
> been called) should never be less secure than get_random_bytes_arch() IFF
> arch_get_random_long() exists -- which is what the sole caller seems to be
> interested in.
I agree entirely that we should get rid of this. I think the issue is
vsprintf needs a stable key for siphash that never changes once
initialized, and the earlier they can get something good enough, the
better. If they can't get something good, vsprintf needs to know so it
can defer that to later. So I'm not yet sure the right way to solve
it, but I agree we should find some way to ditch this function.
Jason