linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: x86/aesni - remove unused internal cipher algorithm
@ 2019-06-03  5:44 Eric Biggers
  2019-06-03  6:50 ` Ard Biesheuvel
  2019-06-13  6:55 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Biggers @ 2019-06-03  5:44 UTC (permalink / raw)
  To: linux-crypto

From: Eric Biggers <ebiggers@google.com>

Since commit 944585a64f5e ("crypto: x86/aes-ni - remove special handling
of AES in PCBC mode"), the "__aes-aesni" internal cipher algorithm is no
longer used.  So remove it too.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 arch/x86/crypto/aesni-intel_glue.c | 45 +++++-------------------------
 1 file changed, 7 insertions(+), 38 deletions(-)

diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
index 21c246799aa58..c95bd397dc076 100644
--- a/arch/x86/crypto/aesni-intel_glue.c
+++ b/arch/x86/crypto/aesni-intel_glue.c
@@ -375,20 +375,6 @@ static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
 	}
 }
 
-static void __aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
-{
-	struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm));
-
-	aesni_enc(ctx, dst, src);
-}
-
-static void __aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
-{
-	struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm));
-
-	aesni_dec(ctx, dst, src);
-}
-
 static int aesni_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
 			         unsigned int len)
 {
@@ -924,7 +910,7 @@ static int helper_rfc4106_decrypt(struct aead_request *req)
 }
 #endif
 
-static struct crypto_alg aesni_algs[] = { {
+static struct crypto_alg aesni_cipher_alg = {
 	.cra_name		= "aes",
 	.cra_driver_name	= "aes-aesni",
 	.cra_priority		= 300,
@@ -941,24 +927,7 @@ static struct crypto_alg aesni_algs[] = { {
 			.cia_decrypt		= aes_decrypt
 		}
 	}
-}, {
-	.cra_name		= "__aes",
-	.cra_driver_name	= "__aes-aesni",
-	.cra_priority		= 300,
-	.cra_flags		= CRYPTO_ALG_TYPE_CIPHER | CRYPTO_ALG_INTERNAL,
-	.cra_blocksize		= AES_BLOCK_SIZE,
-	.cra_ctxsize		= CRYPTO_AES_CTX_SIZE,
-	.cra_module		= THIS_MODULE,
-	.cra_u	= {
-		.cipher	= {
-			.cia_min_keysize	= AES_MIN_KEY_SIZE,
-			.cia_max_keysize	= AES_MAX_KEY_SIZE,
-			.cia_setkey		= aes_set_key,
-			.cia_encrypt		= __aes_encrypt,
-			.cia_decrypt		= __aes_decrypt
-		}
-	}
-} };
+};
 
 static struct skcipher_alg aesni_skciphers[] = {
 	{
@@ -1154,7 +1123,7 @@ static int __init aesni_init(void)
 #endif
 #endif
 
-	err = crypto_register_algs(aesni_algs, ARRAY_SIZE(aesni_algs));
+	err = crypto_register_alg(&aesni_cipher_alg);
 	if (err)
 		return err;
 
@@ -1162,7 +1131,7 @@ static int __init aesni_init(void)
 					     ARRAY_SIZE(aesni_skciphers),
 					     aesni_simd_skciphers);
 	if (err)
-		goto unregister_algs;
+		goto unregister_cipher;
 
 	err = simd_register_aeads_compat(aesni_aeads, ARRAY_SIZE(aesni_aeads),
 					 aesni_simd_aeads);
@@ -1174,8 +1143,8 @@ static int __init aesni_init(void)
 unregister_skciphers:
 	simd_unregister_skciphers(aesni_skciphers, ARRAY_SIZE(aesni_skciphers),
 				  aesni_simd_skciphers);
-unregister_algs:
-	crypto_unregister_algs(aesni_algs, ARRAY_SIZE(aesni_algs));
+unregister_cipher:
+	crypto_unregister_alg(&aesni_cipher_alg);
 	return err;
 }
 
@@ -1185,7 +1154,7 @@ static void __exit aesni_exit(void)
 			      aesni_simd_aeads);
 	simd_unregister_skciphers(aesni_skciphers, ARRAY_SIZE(aesni_skciphers),
 				  aesni_simd_skciphers);
-	crypto_unregister_algs(aesni_algs, ARRAY_SIZE(aesni_algs));
+	crypto_unregister_alg(&aesni_cipher_alg);
 }
 
 late_initcall(aesni_init);
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: x86/aesni - remove unused internal cipher algorithm
  2019-06-03  5:44 [PATCH] crypto: x86/aesni - remove unused internal cipher algorithm Eric Biggers
@ 2019-06-03  6:50 ` Ard Biesheuvel
  2019-06-13  6:55 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2019-06-03  6:50 UTC (permalink / raw)
  To: Eric Biggers; +Cc: open list:HARDWARE RANDOM NUMBER GENERATOR CORE

On Mon, 3 Jun 2019 at 07:45, Eric Biggers <ebiggers@kernel.org> wrote:
>
> From: Eric Biggers <ebiggers@google.com>
>
> Since commit 944585a64f5e ("crypto: x86/aes-ni - remove special handling
> of AES in PCBC mode"), the "__aes-aesni" internal cipher algorithm is no
> longer used.  So remove it too.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  arch/x86/crypto/aesni-intel_glue.c | 45 +++++-------------------------
>  1 file changed, 7 insertions(+), 38 deletions(-)
>
> diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
> index 21c246799aa58..c95bd397dc076 100644
> --- a/arch/x86/crypto/aesni-intel_glue.c
> +++ b/arch/x86/crypto/aesni-intel_glue.c
> @@ -375,20 +375,6 @@ static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
>         }
>  }
>
> -static void __aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
> -{
> -       struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm));
> -
> -       aesni_enc(ctx, dst, src);
> -}
> -
> -static void __aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
> -{
> -       struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm));
> -
> -       aesni_dec(ctx, dst, src);
> -}
> -
>  static int aesni_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
>                                  unsigned int len)
>  {
> @@ -924,7 +910,7 @@ static int helper_rfc4106_decrypt(struct aead_request *req)
>  }
>  #endif
>
> -static struct crypto_alg aesni_algs[] = { {
> +static struct crypto_alg aesni_cipher_alg = {
>         .cra_name               = "aes",
>         .cra_driver_name        = "aes-aesni",
>         .cra_priority           = 300,
> @@ -941,24 +927,7 @@ static struct crypto_alg aesni_algs[] = { {
>                         .cia_decrypt            = aes_decrypt
>                 }
>         }
> -}, {
> -       .cra_name               = "__aes",
> -       .cra_driver_name        = "__aes-aesni",
> -       .cra_priority           = 300,
> -       .cra_flags              = CRYPTO_ALG_TYPE_CIPHER | CRYPTO_ALG_INTERNAL,
> -       .cra_blocksize          = AES_BLOCK_SIZE,
> -       .cra_ctxsize            = CRYPTO_AES_CTX_SIZE,
> -       .cra_module             = THIS_MODULE,
> -       .cra_u  = {
> -               .cipher = {
> -                       .cia_min_keysize        = AES_MIN_KEY_SIZE,
> -                       .cia_max_keysize        = AES_MAX_KEY_SIZE,
> -                       .cia_setkey             = aes_set_key,
> -                       .cia_encrypt            = __aes_encrypt,
> -                       .cia_decrypt            = __aes_decrypt
> -               }
> -       }
> -} };
> +};
>
>  static struct skcipher_alg aesni_skciphers[] = {
>         {
> @@ -1154,7 +1123,7 @@ static int __init aesni_init(void)
>  #endif
>  #endif
>
> -       err = crypto_register_algs(aesni_algs, ARRAY_SIZE(aesni_algs));
> +       err = crypto_register_alg(&aesni_cipher_alg);
>         if (err)
>                 return err;
>
> @@ -1162,7 +1131,7 @@ static int __init aesni_init(void)
>                                              ARRAY_SIZE(aesni_skciphers),
>                                              aesni_simd_skciphers);
>         if (err)
> -               goto unregister_algs;
> +               goto unregister_cipher;
>
>         err = simd_register_aeads_compat(aesni_aeads, ARRAY_SIZE(aesni_aeads),
>                                          aesni_simd_aeads);
> @@ -1174,8 +1143,8 @@ static int __init aesni_init(void)
>  unregister_skciphers:
>         simd_unregister_skciphers(aesni_skciphers, ARRAY_SIZE(aesni_skciphers),
>                                   aesni_simd_skciphers);
> -unregister_algs:
> -       crypto_unregister_algs(aesni_algs, ARRAY_SIZE(aesni_algs));
> +unregister_cipher:
> +       crypto_unregister_alg(&aesni_cipher_alg);
>         return err;
>  }
>
> @@ -1185,7 +1154,7 @@ static void __exit aesni_exit(void)
>                               aesni_simd_aeads);
>         simd_unregister_skciphers(aesni_skciphers, ARRAY_SIZE(aesni_skciphers),
>                                   aesni_simd_skciphers);
> -       crypto_unregister_algs(aesni_algs, ARRAY_SIZE(aesni_algs));
> +       crypto_unregister_alg(&aesni_cipher_alg);
>  }
>
>  late_initcall(aesni_init);
> --
> 2.21.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: x86/aesni - remove unused internal cipher algorithm
  2019-06-03  5:44 [PATCH] crypto: x86/aesni - remove unused internal cipher algorithm Eric Biggers
  2019-06-03  6:50 ` Ard Biesheuvel
@ 2019-06-13  6:55 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2019-06-13  6:55 UTC (permalink / raw)
  To: Eric Biggers; +Cc: linux-crypto

Eric Biggers <ebiggers@kernel.org> wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Since commit 944585a64f5e ("crypto: x86/aes-ni - remove special handling
> of AES in PCBC mode"), the "__aes-aesni" internal cipher algorithm is no
> longer used.  So remove it too.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
> arch/x86/crypto/aesni-intel_glue.c | 45 +++++-------------------------
> 1 file changed, 7 insertions(+), 38 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-13 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-03  5:44 [PATCH] crypto: x86/aesni - remove unused internal cipher algorithm Eric Biggers
2019-06-03  6:50 ` Ard Biesheuvel
2019-06-13  6:55 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).