[PATCH 07/38] crypto: drbg - Remove broken commented-out code
From: Eric Biggers
Date: Mon Apr 20 2026 - 02:40:48 EST
This commented-out code doesn't compile. Even if it did, it wouldn't
actually do what it was apparently intended to do, seeing as the "test"
for "drbg_pr_hmac_sha512" and "drbg_pr_ctr_aes256" is alg_test_null().
Just delete it to avoid keeping broken code around, and so that there
isn't any perceived need to try to update it as the DRBG code is
refactored.
Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
---
crypto/drbg.c | 29 -----------------------------
1 file changed, 29 deletions(-)
diff --git a/crypto/drbg.c b/crypto/drbg.c
index f6bff275c31b..bb8ddc090307 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1217,40 +1217,11 @@ static int drbg_generate(struct drbg_state *drbg,
* were successfully and the following are not. If the initial would
* pass and the following would not, the kernel integrity is violated.
* In this case, the entire kernel operation is questionable and it
* is unlikely that the integrity violation only affects the
* correct operation of the DRBG.
- *
- * Albeit the following code is commented out, it is provided in
- * case somebody has a need to implement the test of 11.3.3.
*/
-#if 0
- if (drbg->reseed_ctr && !(drbg->reseed_ctr % 4096)) {
- int err = 0;
- pr_devel("DRBG: start to perform self test\n");
- if (drbg->core->flags & DRBG_HMAC)
- err = alg_test("drbg_pr_hmac_sha512",
- "drbg_pr_hmac_sha512", 0, 0);
- else if (drbg->core->flags & DRBG_CTR)
- err = alg_test("drbg_pr_ctr_aes256",
- "drbg_pr_ctr_aes256", 0, 0);
- else
- err = alg_test("drbg_pr_sha256",
- "drbg_pr_sha256", 0, 0);
- if (err) {
- pr_err("DRBG: periodical self test failed\n");
- /*
- * uninstantiate implies that from now on, only errors
- * are returned when reusing this DRBG cipher handle
- */
- drbg_uninstantiate(drbg);
- return 0;
- } else {
- pr_devel("DRBG: self test successful\n");
- }
- }
-#endif
/*
* All operations were successful, return 0 as mandated by
* the kernel crypto API interface.
*/
--
2.53.0