random32: add a selftest for the prandom32 code
authorWilly Tarreau <w@1wt.eu>
Sat, 24 Oct 2020 16:36:27 +0000 (18:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 24 Oct 2020 18:21:57 +0000 (20:21 +0200)
commitc6e169bc146a76d5ccbf4d3825f705414352bd03
tree9974f18c3bbc38837e4dd0517bea1f3ae712e05a
parent3744741adab6d9195551ce30e65e726c7a408421
random32: add a selftest for the prandom32 code

Given that this code is new, let's add a selftest for it as well.
It doesn't rely on fixed sets, instead it picks 1024 numbers and
verifies that they're not more correlated than desired.

Link: https://lore.kernel.org/netdev/20200808152628.GA27941@SDF.ORG/
Cc: George Spelvin <lkml@sdf.org>
Cc: Amit Klein <aksecurity@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: tytso@mit.edu
Cc: Florian Westphal <fw@strlen.de>
Cc: Marc Plumb <lkml.mplumb@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
lib/random32.c