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 11/14] crypto: jitterentropy - Remove crypto_rng support
Date: Sun, 18 Oct 2026 13:46:15 -0700 [thread overview]
Message-ID: <20261018204618.104876-12-ebiggers@kernel.org> (raw)
In-Reply-To: <20261018204618.104876-1-ebiggers@kernel.org>
Now that jitterentropy is used only via its library API instead of
crypto_rng, remove its obsolete crypto_rng support.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
crypto/Kconfig | 1 -
crypto/jitterentropy-kcapi.c | 106 +----------------------------------
crypto/testmgr.c | 4 --
3 files changed, 1 insertion(+), 110 deletions(-)
diff --git a/crypto/Kconfig b/crypto/Kconfig
index ed8612dcc5212..c9d842706b9ff 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -1117,7 +1117,6 @@ config CRYPTO_DRBG
config CRYPTO_JITTERENTROPY
tristate "CPU Jitter Non-Deterministic RNG (Random Number Generator)"
select CRYPTO_LIB_SHA3
- select CRYPTO_RNG
help
CPU Jitter RNG (Random Number Generator) from the Jitterentropy library
diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c
index 2786303195950..1311df9882228 100644
--- a/crypto/jitterentropy-kcapi.c
+++ b/crypto/jitterentropy-kcapi.c
@@ -44,7 +44,6 @@
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/time.h>
-#include <crypto/internal/rng.h>
#include "jitterentropy.h"
#include "jitterentropy-kcapi.h"
@@ -302,117 +301,15 @@ void crypto_jent_free(struct jitterentropy *rng)
}
EXPORT_SYMBOL_NS_GPL(crypto_jent_free, "CRYPTO_INTERNAL");
-static void jent_kcapi_cleanup(struct crypto_tfm *tfm)
-{
- struct jitterentropy *rng = crypto_tfm_ctx(tfm);
-
- mutex_lock(&rng->jent_lock);
-
- memzero_explicit(&rng->hash_state, sizeof(rng->hash_state));
-
- if (rng->entropy_collector)
- jent_entropy_collector_free(rng->entropy_collector);
- rng->entropy_collector = NULL;
- mutex_unlock(&rng->jent_lock);
-}
-
-static int jent_kcapi_init(struct crypto_tfm *tfm)
-{
- struct jitterentropy *rng = crypto_tfm_ctx(tfm);
- int ret;
-
- ret = jent_init();
- if (ret)
- return ret;
-
- mutex_init(&rng->jent_lock);
-
- /* Use SHA3-256 as conditioner */
- sha3_256_init(&rng->hash_state);
-
- rng->entropy_collector = jent_entropy_collector_alloc(
- CONFIG_CRYPTO_JITTERENTROPY_OSR, 0, &rng->hash_state);
- if (!rng->entropy_collector) {
- ret = -ENOMEM;
- goto err;
- }
-
- return 0;
-
-err:
- jent_kcapi_cleanup(tfm);
- return ret;
-}
-
-static int jent_kcapi_random(struct crypto_rng *tfm,
- const u8 *src, unsigned int slen,
- u8 *rdata, unsigned int dlen)
-{
- struct jitterentropy *rng = crypto_rng_ctx(tfm);
- int ret = 0;
-
- mutex_lock(&rng->jent_lock);
-
- ret = jent_read_entropy(rng->entropy_collector, rdata, dlen);
-
- if (ret == -3) {
- /* Handle permanent health test error */
- /*
- * If the kernel was booted with fips=1, it implies that
- * the entire kernel acts as a FIPS 140 module. In this case
- * an SP800-90B permanent health test error is treated as
- * a FIPS module error.
- */
- if (fips_enabled)
- panic("Jitter RNG permanent health test failure\n");
-
- pr_err("Jitter RNG permanent health test failure\n");
- ret = -EFAULT;
- } else if (ret == -2) {
- /* Handle intermittent health test error */
- pr_warn_ratelimited("Reset Jitter RNG due to intermittent health test failure\n");
- ret = -EAGAIN;
- } else if (ret == -1) {
- /* Handle other errors */
- ret = -EINVAL;
- }
-
- mutex_unlock(&rng->jent_lock);
-
- return ret;
-}
-
-static int jent_kcapi_reset(struct crypto_rng *tfm,
- const u8 *seed, unsigned int slen)
-{
- return 0;
-}
-
-static struct rng_alg jent_alg = {
- .generate = jent_kcapi_random,
- .seed = jent_kcapi_reset,
- .seedsize = 0,
- .base = {
- .cra_name = "jitterentropy_rng",
- .cra_driver_name = "jitterentropy_rng",
- .cra_priority = 100,
- .cra_ctxsize = sizeof(struct jitterentropy),
- .cra_module = THIS_MODULE,
- .cra_init = jent_kcapi_init,
- .cra_exit = jent_kcapi_cleanup,
- }
-};
-
static int __init jent_mod_init(void)
{
jent_testing_init();
- return crypto_register_rng(&jent_alg);
+ return 0;
}
static void __exit jent_mod_exit(void)
{
jent_testing_exit();
- crypto_unregister_rng(&jent_alg);
}
module_init(jent_mod_init);
@@ -421,4 +318,3 @@ module_exit(jent_mod_exit);
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Stephan Mueller <smueller@chronox.de>");
MODULE_DESCRIPTION("Non-physical True Random Number Generator based on CPU Jitter");
-MODULE_ALIAS_CRYPTO("jitterentropy_rng");
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 4abb18bc2fa79..0e60702ab6a4c 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -4923,10 +4923,6 @@ static const struct alg_test_desc alg_test_descs[] = {
.suite = {
.hash = __VECS(hmac_streebog512_tv_template)
}
- }, {
- .alg = "jitterentropy_rng",
- .fips_allowed = 1,
- .test = alg_test_null,
}, {
.alg = "krb5enc(cmac(camellia),cts(cbc(camellia)))",
.test = alg_test_aead,
--
2.56.0
next prev parent 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 [PATCH 00/14] crypto: Remove the unnecessary crypto_rng API Eric Biggers
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 ` Eric Biggers [this message]
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-12-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 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.