]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: drbg - Remove broken commented-out code
authorEric Biggers <ebiggers@kernel.org>
Mon, 20 Apr 2026 06:33:51 +0000 (23:33 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 7 May 2026 08:09:59 +0000 (16:09 +0800)
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@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/drbg.c

index f6bff275c31bb0c6c9ee6df5a59861a78ea78853..bb8ddc090307a315b63febe7218b50d96df5c601 100644 (file)
@@ -1219,36 +1219,7 @@ static int drbg_generate(struct drbg_state *drbg,
         * 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