]> xenbits.xensource.com Git - people/aperard/linux.git/commitdiff
crypto: testmgr - Add support for lskcipher algorithms
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 14 Sep 2023 08:28:26 +0000 (16:28 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 20 Sep 2023 05:15:29 +0000 (13:15 +0800)
Test lskcipher algorithms using the same logic as cipher algorithms.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/testmgr.c

index 216878c8bc3d62f8abd6e708acffffae7d09e5df..aed4a6bf47ad3dd30eca58d0e19d2866f441172e 100644 (file)
@@ -5945,6 +5945,25 @@ test_done:
        return rc;
 
 notest:
+       if ((type & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_LSKCIPHER) {
+               char nalg[CRYPTO_MAX_ALG_NAME];
+
+               if (snprintf(nalg, sizeof(nalg), "ecb(%s)", alg) >=
+                   sizeof(nalg))
+                       goto notest2;
+
+               i = alg_find_test(nalg);
+               if (i < 0)
+                       goto notest2;
+
+               if (fips_enabled && !alg_test_descs[i].fips_allowed)
+                       goto non_fips_alg;
+
+               rc = alg_test_skcipher(alg_test_descs + i, driver, type, mask);
+               goto test_done;
+       }
+
+notest2:
        printk(KERN_INFO "alg: No test for %s (%s)\n", alg, driver);
 
        if (type & CRYPTO_ALG_FIPS_INTERNAL)