All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Theil <theil.markus@gmail.com>
To: linux-crypto@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	akpm@linux-foundation.org, Jason@zx2c4.com,
	Markus Theil <theil.markus@gmail.com>
Subject: [PATCH 0/2] prandom: add crypto warnings and switch to new PRNG
Date: Fri, 14 Feb 2025 09:18:38 +0100	[thread overview]
Message-ID: <20250214081840.47229-1-theil.markus@gmail.com> (raw)

This series builds on top of the series:
	"prandom: remove next_pseudo_random32."

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 (2):
  prandom: add usage comments for cryptography
  prandom/random32: switch to Xoshiro256++

 include/linux/prandom.h |  30 +---
 lib/random32.c          | 351 ++++++++++++++++++++--------------------
 2 files changed, 180 insertions(+), 201 deletions(-)

-- 
2.47.2


             reply	other threads:[~2025-02-14  8:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14  8:18 Markus Theil [this message]
2025-02-14  8:18 ` [PATCH 1/2] prandom: add usage comments for cryptography Markus Theil
2025-02-14  8:18 ` [PATCH 2/2] prandom/random32: switch to Xoshiro256++ Markus Theil
2025-02-17 11:18   ` Simon Horman
2025-03-22 18:24     ` Markus Theil
2025-03-24 17:32       ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250214081840.47229-1-theil.markus@gmail.com \
    --to=theil.markus@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-crypto@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.