diff mbox series

crypto: tcrypt - remove mode=1000

Message ID 20220815042915.44547-1-elliott@hpe.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: tcrypt - remove mode=1000 | expand

Commit Message

Elliott, Robert (Servers) Aug. 15, 2022, 4:29 a.m. UTC
The lists of algothms checked for existence by
    modprobe tcrypt mode=1000
generates three bogus errors:
    modprobe tcrypt mode=1000

    console log:
    tcrypt: alg rot13 not found
    tcrypt: alg cts not found
    tcrypt: alg arc4 not found

rot13 is not an algorithm in the crypto API or tested.

cts is a wrapper, not a base algorithm.

arc4 is named ecb(arc4), not arc4.

Also, the list is missing numerous algorithms that are tested by
other test modes:
    blake2b-512
    blake2s-256
    crct10dif
    xxhash64
    ghash
    cast5
    sm4
    ansi_prng

Several of the algorithms are only available if
CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE is enabled:
    arc4
    khazad
    seed
    tea, xtea, xeta

Rather that fix that list, remove test mode=1000 entirely.
It seems to have limited utility, and a web search shows no
discussion of anybody using it.

Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Robert Elliott <elliott@hpe.com>
---
 crypto/tcrypt.c | 28 ----------------------------
 1 file changed, 28 deletions(-)

Comments

Ard Biesheuvel Aug. 15, 2022, 9:42 a.m. UTC | #1
On Mon, 15 Aug 2022 at 06:30, Robert Elliott <elliott@hpe.com> wrote:
>
> The lists of algothms checked for existence by
>     modprobe tcrypt mode=1000
> generates three bogus errors:
>     modprobe tcrypt mode=1000
>
>     console log:
>     tcrypt: alg rot13 not found
>     tcrypt: alg cts not found
>     tcrypt: alg arc4 not found
>
> rot13 is not an algorithm in the crypto API or tested.
>
> cts is a wrapper, not a base algorithm.
>
> arc4 is named ecb(arc4), not arc4.
>
> Also, the list is missing numerous algorithms that are tested by
> other test modes:
>     blake2b-512
>     blake2s-256
>     crct10dif
>     xxhash64
>     ghash
>     cast5
>     sm4
>     ansi_prng
>
> Several of the algorithms are only available if
> CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE is enabled:
>     arc4
>     khazad
>     seed
>     tea, xtea, xeta
>
> Rather that fix that list, remove test mode=1000 entirely.
> It seems to have limited utility, and a web search shows no
> discussion of anybody using it.
>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Robert Elliott <elliott@hpe.com>

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>

> ---
>  crypto/tcrypt.c | 28 ----------------------------
>  1 file changed, 28 deletions(-)
>
> diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
> index 2bacf8384f59..35d70382ee54 100644
> --- a/crypto/tcrypt.c
> +++ b/crypto/tcrypt.c
> @@ -65,18 +65,6 @@ static int mode;
>  static u32 num_mb = 8;
>  static unsigned int klen;
>  static char *tvmem[TVMEMSIZE];
> -
> -static const char *check[] = {
> -       "des", "md5", "des3_ede", "rot13", "sha1", "sha224", "sha256", "sm3",
> -       "blowfish", "twofish", "serpent", "sha384", "sha512", "md4", "aes",
> -       "cast6", "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea",
> -       "khazad", "wp512", "wp384", "wp256", "xeta",  "fcrypt",
> -       "camellia", "seed", "rmd160",
> -       "lzo", "lzo-rle", "cts", "sha3-224", "sha3-256", "sha3-384",
> -       "sha3-512", "streebog256", "streebog512",
> -       NULL
> -};
> -
>  static const int block_sizes[] = { 16, 64, 128, 256, 1024, 1420, 4096, 0 };
>  static const int aead_sizes[] = { 16, 64, 256, 512, 1024, 1420, 4096, 8192, 0 };
>
> @@ -1454,18 +1442,6 @@ static void test_cipher_speed(const char *algo, int enc, unsigned int secs,
>                                    false);
>  }
>
> -static void test_available(void)
> -{
> -       const char **name = check;
> -
> -       while (*name) {
> -               printk("alg %s ", *name);
> -               printk(crypto_has_alg(*name, 0, 0) ?
> -                      "found\n" : "not found\n");
> -               name++;
> -       }
> -}
> -
>  static inline int tcrypt_test(const char *alg)
>  {
>         int ret;
> @@ -2825,10 +2801,6 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
>                 test_mb_skcipher_speed("ctr(blowfish)", DECRYPT, sec, NULL, 0,
>                                        speed_template_8_32, num_mb);
>                 break;
> -
> -       case 1000:
> -               test_available();
> -               break;
>         }
>
>         return ret;
> --
> 2.37.1
>
Herbert Xu Aug. 16, 2022, 5:56 a.m. UTC | #2
On Sun, Aug 14, 2022 at 11:29:15PM -0500, Robert Elliott wrote:
> The lists of algothms checked for existence by
>     modprobe tcrypt mode=1000
> generates three bogus errors:
>     modprobe tcrypt mode=1000
> 
>     console log:
>     tcrypt: alg rot13 not found
>     tcrypt: alg cts not found
>     tcrypt: alg arc4 not found
> 
> rot13 is not an algorithm in the crypto API or tested.
> 
> cts is a wrapper, not a base algorithm.
> 
> arc4 is named ecb(arc4), not arc4.
> 
> Also, the list is missing numerous algorithms that are tested by
> other test modes:
>     blake2b-512
>     blake2s-256
>     crct10dif
>     xxhash64
>     ghash
>     cast5
>     sm4
>     ansi_prng
> 
> Several of the algorithms are only available if
> CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE is enabled:
>     arc4
>     khazad
>     seed
>     tea, xtea, xeta
> 
> Rather that fix that list, remove test mode=1000 entirely.
> It seems to have limited utility, and a web search shows no
> discussion of anybody using it.
> 
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Robert Elliott <elliott@hpe.com>
> ---
>  crypto/tcrypt.c | 28 ----------------------------
>  1 file changed, 28 deletions(-)

I think it would be better to use alg_test_descs as the source
list of get rid of check.  But I never use this so unless someone
else complains I'm fine with removing it.

Thanks,
Herbert Xu Aug. 26, 2022, 11:03 a.m. UTC | #3
On Sun, Aug 14, 2022 at 11:29:15PM -0500, Robert Elliott wrote:
> The lists of algothms checked for existence by
>     modprobe tcrypt mode=1000
> generates three bogus errors:
>     modprobe tcrypt mode=1000
> 
>     console log:
>     tcrypt: alg rot13 not found
>     tcrypt: alg cts not found
>     tcrypt: alg arc4 not found
> 
> rot13 is not an algorithm in the crypto API or tested.
> 
> cts is a wrapper, not a base algorithm.
> 
> arc4 is named ecb(arc4), not arc4.
> 
> Also, the list is missing numerous algorithms that are tested by
> other test modes:
>     blake2b-512
>     blake2s-256
>     crct10dif
>     xxhash64
>     ghash
>     cast5
>     sm4
>     ansi_prng
> 
> Several of the algorithms are only available if
> CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE is enabled:
>     arc4
>     khazad
>     seed
>     tea, xtea, xeta
> 
> Rather that fix that list, remove test mode=1000 entirely.
> It seems to have limited utility, and a web search shows no
> discussion of anybody using it.
> 
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Robert Elliott <elliott@hpe.com>
> ---
>  crypto/tcrypt.c | 28 ----------------------------
>  1 file changed, 28 deletions(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 2bacf8384f59..35d70382ee54 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -65,18 +65,6 @@  static int mode;
 static u32 num_mb = 8;
 static unsigned int klen;
 static char *tvmem[TVMEMSIZE];
-
-static const char *check[] = {
-	"des", "md5", "des3_ede", "rot13", "sha1", "sha224", "sha256", "sm3",
-	"blowfish", "twofish", "serpent", "sha384", "sha512", "md4", "aes",
-	"cast6", "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea",
-	"khazad", "wp512", "wp384", "wp256", "xeta",  "fcrypt",
-	"camellia", "seed", "rmd160",
-	"lzo", "lzo-rle", "cts", "sha3-224", "sha3-256", "sha3-384",
-	"sha3-512", "streebog256", "streebog512",
-	NULL
-};
-
 static const int block_sizes[] = { 16, 64, 128, 256, 1024, 1420, 4096, 0 };
 static const int aead_sizes[] = { 16, 64, 256, 512, 1024, 1420, 4096, 8192, 0 };
 
@@ -1454,18 +1442,6 @@  static void test_cipher_speed(const char *algo, int enc, unsigned int secs,
 				   false);
 }
 
-static void test_available(void)
-{
-	const char **name = check;
-
-	while (*name) {
-		printk("alg %s ", *name);
-		printk(crypto_has_alg(*name, 0, 0) ?
-		       "found\n" : "not found\n");
-		name++;
-	}
-}
-
 static inline int tcrypt_test(const char *alg)
 {
 	int ret;
@@ -2825,10 +2801,6 @@  static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
 		test_mb_skcipher_speed("ctr(blowfish)", DECRYPT, sec, NULL, 0,
 				       speed_template_8_32, num_mb);
 		break;
-
-	case 1000:
-		test_available();
-		break;
 	}
 
 	return ret;