From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Stephan Müller" <smueller@chronox.de>,
"Eric Biggers" <ebiggers@kernel.org>
Subject: [PATCH 00/14] crypto: Remove the unnecessary crypto_rng API
Date: Sun, 18 Oct 2026 13:46:04 -0700 [thread overview]
Message-ID: <20261018204618.104876-1-ebiggers@kernel.org> (raw)
This series applies to cryptodev/master commit 666d66df25253
The crypto_rng abstraction layer was designed as a generic interface for
random number generators. However, it's now exclusively used to
implement a "NIST approved" RNG and the "jitterentropy" entropy
collector that supports it (for certification reasons).
Previously some hardware RNG drivers supported crypto_rng. However,
that functionality was unused and just caused confusion, as it existed
alongside hw_random which is the interface that is actually used.
Reflecting this reality, this series removes crypto_rng and makes the
drbg and jitterentropy modules provide dedicated APIs directly. This
simplifies the code, improves performance, and ensures that people don't
waste time implementing unused crypto_rng algorithms in drivers.
To make this work, update the users of crypto_rng accordingly:
- drbg.c now calls the jitterentropy API directly.
- __crypto_stdrng_get_bytes() now calls the DRBG API directly.
- algif_rng.c now calls the DRBG and jitterentropy APIs directly.
- The DRBG self-tests are moved from the testmgr to drbg.c itself, and
the DRBG APIs are used directly.
The new implementation should comply with all the same certification
requirements it did before (which is the only reason this stuff exists
in the first place). This includes, for example, running self-tests
before anything is used, and continuing to support CAVP testing via
AF_ALG when af_alg_restrict=0 (though a different UAPI should be defined
for that at some point). If I missed anything, let me know.
Eric Biggers (14):
crypto: drbg - Don't use uninitialized stack data
crypto: rng - Remove unnecessary inclusions of internal/rng.h
crypto: jitterentropy - Move health check to first use
crypto: jitterentropy - Add library API
crypto: drbg - Use jitterentropy library API
crypto: drbg - Add library API
crypto: drbg - Add self-test for library API
crypto: algif_rng - Use DRBG and jitterentropy library APIs
crypto: stdrng - Reimplement "stdrng" using direct DRBG calls
crypto: drbg - Remove crypto_rng support
crypto: jitterentropy - Remove crypto_rng support
crypto: jitterentropy - Remove the kconfig prompt
crypto: rng - Remove the rng algorithm type
crypto: stdrng - Make crypto_stdrng_get_bytes() take size_t
Documentation/crypto/api-rng.rst | 17 --
Documentation/crypto/api-samples.rst | 37 ---
Documentation/crypto/api.rst | 1 -
Documentation/crypto/architecture.rst | 8 -
crypto/Kconfig | 19 +-
crypto/Makefile | 1 -
crypto/algif_rng.c | 109 ++++++---
crypto/crypto_user.c | 2 +-
crypto/drbg-testvecs.h | 228 +++++++++++++++++
crypto/drbg.c | 323 +++++++++++++++++--------
crypto/drbg.h | 20 ++
crypto/geniv.c | 2 +-
crypto/jitterentropy-kcapi.c | 158 ++++++------
crypto/jitterentropy-kcapi.h | 17 ++
crypto/rng.c | 245 -------------------
crypto/testmgr.c | 102 --------
crypto/testmgr.h | 218 -----------------
drivers/crypto/gemini/sl3516-ce-core.c | 1 -
include/crypto/internal/rng.h | 40 ---
include/crypto/rng.h | 194 +--------------
include/linux/crypto.h | 3 +-
include/uapi/linux/cryptouser.h | 3 +-
22 files changed, 661 insertions(+), 1087 deletions(-)
delete mode 100644 Documentation/crypto/api-rng.rst
create mode 100644 crypto/drbg-testvecs.h
create mode 100644 crypto/drbg.h
create mode 100644 crypto/jitterentropy-kcapi.h
delete mode 100644 crypto/rng.c
delete mode 100644 include/crypto/internal/rng.h
base-commit: 666d66df25253070cb297cb920b0bcfcfe5eb871
--
2.56.0
next reply other threads:[~2026-10-18 20:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 20:46 Eric Biggers [this message]
2026-10-18 20:46 ` [PATCH 01/14] crypto: drbg - Don't use uninitialized stack data Eric Biggers
2026-10-18 20:46 ` [PATCH 02/14] crypto: rng - Remove unnecessary inclusions of internal/rng.h Eric Biggers
2026-10-18 20:46 ` [PATCH 03/14] crypto: jitterentropy - Move health check to first use Eric Biggers
2026-10-18 20:46 ` [PATCH 04/14] crypto: jitterentropy - Add library API Eric Biggers
2026-10-18 20:46 ` [PATCH 05/14] crypto: drbg - Use jitterentropy " Eric Biggers
2026-10-18 20:46 ` [PATCH 06/14] crypto: drbg - Add " Eric Biggers
2026-10-18 20:46 ` [PATCH 07/14] crypto: drbg - Add self-test for " Eric Biggers
2026-10-18 20:46 ` [PATCH 08/14] crypto: algif_rng - Use DRBG and jitterentropy library APIs Eric Biggers
2026-10-18 20:46 ` [PATCH 09/14] crypto: stdrng - Reimplement "stdrng" using direct DRBG calls Eric Biggers
2026-10-18 20:46 ` [PATCH 10/14] crypto: drbg - Remove crypto_rng support Eric Biggers
2026-10-18 20:46 ` [PATCH 11/14] crypto: jitterentropy " Eric Biggers
2026-10-18 20:46 ` [PATCH 12/14] crypto: jitterentropy - Remove the kconfig prompt Eric Biggers
2026-10-18 20:46 ` [PATCH 13/14] crypto: rng - Remove the rng algorithm type Eric Biggers
2026-10-18 20:46 ` [PATCH 14/14] crypto: stdrng - Make crypto_stdrng_get_bytes() take size_t Eric Biggers
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=20261018204618.104876-1-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=smueller@chronox.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox