[LTP] [PATCH] syscalls/getrandom02: lower bufsize if low on entropy

Li Wang liwang@redhat.com
Thu Feb 6 08:01:08 CET 2020


On Wed, Feb 5, 2020 at 10:32 PM Jan Stancek <jstancek@redhat.com> wrote:

>
>
> ----- Original Message -----
> > >
> > > @@ -37,11 +39,17 @@ static int check_content(unsigned char *buf, int
> nb)
> > >  static void verify_getrandom(unsigned int n)
> > >  {
> > >         unsigned char buf[256];
> > > +       int bufsize = 64, entropy_avail;
> > >
> >
> > I'm not sure why here initialize bufsize as 64? can you explain more?
>
> That would be the default, unless we know we have enough entropy.
>
> I picked 64 as it matches 'random_read_wakeup_bits'. Assuming we can get
> 1bit/s entropy, then potentially worst case of waiting 4x for 64bit,
> it should still fit within default 300 seconds.
>

That sounds reasonable. Thanks for the analysis.

Reviewed-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200206/521ada62/attachment.htm>


More information about the ltp mailing list