[LTP] [PATCH] getrandom02: relax check for returned data
Jan Stancek
jstancek@redhat.com
Tue Feb 7 17:15:28 CET 2017
----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Tuesday, 7 February, 2017 4:33:52 PM
> Subject: Re: [LTP] [PATCH] getrandom02: relax check for returned data
>
> Hi!
> > + } else {
> > tst_resm(TPASS, "getrandom returned %ld",
> > TEST_RETURN);
> > + tmp = 0;
> > + for (j = 0; j < TEST_RETURN; j++)
> > + tmp |= buf[j];
> > + if (tmp == 0)
> > + tst_resm(TWARN, "all bytes from random"
> > + " buffer are zero?");
>
> This wouldn't for instance when the random output is filled with
> non-zero constant bytes...
>
> What about just fixing the max value to something as:
>
> max = 3 + nb * 0.2;
>
> The constat part should handle cases with small buffer and a few
> repeating characters while for larger buffer it's neglectible.
In that case we may as well skip the check for small buffers.
What size would make reasonably large sample? 64?
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
More information about the ltp
mailing list