[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250704125233.2653779-1-theil.markus@gmail.com>
Date: Fri, 4 Jul 2025 14:52:29 +0200
From: Markus Theil <theil.markus@...il.com>
To: netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: davem@...emloft.net,
akpm@...ux-foundation.org,
Jason@...c4.com,
Markus Theil <theil.markus@...il.com>
Subject: [PATCH v2 0/4] add usage hints to prandom and switch to Xoshiro
This series builds on top of the crng/master repository, as other
prandom commits are already queued there.
v2:
- fix indentation
- add better checks against invalid state
- rebase
With the current cryptographically safe PRNG in drivers/char/random.c
fast enough for most purposes, make annoyingly clear, that no one should
use the prandom PRNG for cryptographic purposes without known about
this.
While looking at the prandom/random32 code, I informed myself about
PRNGs and saw that currently fast PRNGs with better statistical
properties than LFSR113, which is currently used, are available.
Recent alternatives to consider are in my opinion:
* PCG: https://www.pcg-random.org
* Xoshiro: https://prng.di.unimi.it
While both seem to have good statistical properties, I recommend
to chose Xoshiro256++ here, because it seems to be even faster than
RNGs from the PCG series.
Furthermore, the authors of Xoshiro provide a small RNG named SplitMix64
for generating high quality seeds for the Xoshiro RNG. By using this in
the default way, no further seed checks or state warmup are necessary.
This simplifies the PRNG code IMHO.
Markus Theil (4):
prandom: add usage comments for cryptography
prandom/random32: switch to Xoshiro256++
prandom/random32: add checks against invalid state
test_hash.c: replace custom PRNG by prandom
include/linux/prandom.h | 30 +---
lib/random32.c | 378 +++++++++++++++++++++-------------------
lib/tests/test_hash.c | 40 ++---
3 files changed, 220 insertions(+), 228 deletions(-)
--
2.49.0
Powered by blists - more mailing lists