lkml.org 
[lkml]   [2022]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] random: Don't reset crng_init_cnt on urandom_read()
On Mon, Jan 3, 2022 at 5:39 PM Theodore Ts'o <tytso@mit.edu> wrote:
>
> On Mon, Jan 03, 2022 at 05:03:57PM +0100, Jason A. Donenfeld wrote:
> > On Mon, Jan 3, 2022 at 4:59 PM Jann Horn <jannh@google.com> wrote:
> > > This code was inconsistent, and it probably made things worse - just get
> > > rid of it.
> >
> > Rather than adding crng_init_cnt=0 if crng_init<1 to extract_crng_user
> > and get_random_bytes, getting rid of it like this seems probably okay
> > and makes the model simpler. I'll apply this. Thank you.
>
> Ack. It does mean that we're making a choice that an attacker who is
> carrying out a incremental state tracking attack on the CRNG will make
> /dev/urandom (and getrandom) to make the crng emit "less secure" in
> the period when crng_init is > 0 and < 2. On the other hand, this
> allows us to get to the state of crng_init=2 faster, where as before,
> the attacker could delay getting us to the state crng_init=1 forever,
> where reads from /dev/urandom would be hence be insecure forever (and
> getrandom() would block forever).

Right. I had a few early drafts of this commit where I was trying to
protect the 0->1 transition from being bruteforced with a trickle of
entropy, and Jann's offline comment was something along the lines of,
"why do we actually care about crng_init==1? it's not secure anyway,"
which seems compelling. Plus, as you point out, letting anything reset
crng_init_cnt (like /dev/urandom reads) means unprivileged userspace
can delay crng_init==2, which seems like a bigger deal.

Jason

\
 
 \ /
  Last update: 2022-01-03 17:43    [W:0.294 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site