Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH] crypto: chacha_generic - remove unnecessary setkey() functions
@ 2019-11-18  7:21 Eric Biggers
  2019-11-18  7:26 ` Ard Biesheuvel
  2019-11-22 11:10 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Biggers @ 2019-11-18  7:21 UTC (permalink / raw)
  To: linux-crypto, Herbert Xu; +Cc: Ard Biesheuvel

From: Eric Biggers <ebiggers@google.com>

Use chacha20_setkey() and chacha12_setkey() from
<crypto/internal/chacha.h> instead of defining them again in
chacha_generic.c.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 crypto/chacha_generic.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/crypto/chacha_generic.c b/crypto/chacha_generic.c
index c1b147318393..8beea79ab117 100644
--- a/crypto/chacha_generic.c
+++ b/crypto/chacha_generic.c
@@ -37,18 +37,6 @@ static int chacha_stream_xor(struct skcipher_request *req,
 	return err;
 }
 
-static int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key,
-				  unsigned int keysize)
-{
-	return chacha_setkey(tfm, key, keysize, 20);
-}
-
-static int crypto_chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key,
-				 unsigned int keysize)
-{
-	return chacha_setkey(tfm, key, keysize, 12);
-}
-
 static int crypto_chacha_crypt(struct skcipher_request *req)
 {
 	struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
@@ -91,7 +79,7 @@ static struct skcipher_alg algs[] = {
 		.max_keysize		= CHACHA_KEY_SIZE,
 		.ivsize			= CHACHA_IV_SIZE,
 		.chunksize		= CHACHA_BLOCK_SIZE,
-		.setkey			= crypto_chacha20_setkey,
+		.setkey			= chacha20_setkey,
 		.encrypt		= crypto_chacha_crypt,
 		.decrypt		= crypto_chacha_crypt,
 	}, {
@@ -106,7 +94,7 @@ static struct skcipher_alg algs[] = {
 		.max_keysize		= CHACHA_KEY_SIZE,
 		.ivsize			= XCHACHA_IV_SIZE,
 		.chunksize		= CHACHA_BLOCK_SIZE,
-		.setkey			= crypto_chacha20_setkey,
+		.setkey			= chacha20_setkey,
 		.encrypt		= crypto_xchacha_crypt,
 		.decrypt		= crypto_xchacha_crypt,
 	}, {
@@ -121,7 +109,7 @@ static struct skcipher_alg algs[] = {
 		.max_keysize		= CHACHA_KEY_SIZE,
 		.ivsize			= XCHACHA_IV_SIZE,
 		.chunksize		= CHACHA_BLOCK_SIZE,
-		.setkey			= crypto_chacha12_setkey,
+		.setkey			= chacha12_setkey,
 		.encrypt		= crypto_xchacha_crypt,
 		.decrypt		= crypto_xchacha_crypt,
 	}
-- 
2.24.0


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

* Re: [PATCH] crypto: chacha_generic - remove unnecessary setkey() functions
  2019-11-18  7:21 [PATCH] crypto: chacha_generic - remove unnecessary setkey() functions Eric Biggers
@ 2019-11-18  7:26 ` Ard Biesheuvel
  2019-11-22 11:10 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2019-11-18  7:26 UTC (permalink / raw)
  To: Eric Biggers
  Cc: open list:HARDWARE RANDOM NUMBER GENERATOR CORE, Herbert Xu,
	Ard Biesheuvel

On Mon, 18 Nov 2019 at 08:21, Eric Biggers <ebiggers@kernel.org> wrote:
>
> From: Eric Biggers <ebiggers@google.com>
>
> Use chacha20_setkey() and chacha12_setkey() from
> <crypto/internal/chacha.h> instead of defining them again in
> chacha_generic.c.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>

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

> ---
>  crypto/chacha_generic.c | 18 +++---------------
>  1 file changed, 3 insertions(+), 15 deletions(-)
>
> diff --git a/crypto/chacha_generic.c b/crypto/chacha_generic.c
> index c1b147318393..8beea79ab117 100644
> --- a/crypto/chacha_generic.c
> +++ b/crypto/chacha_generic.c
> @@ -37,18 +37,6 @@ static int chacha_stream_xor(struct skcipher_request *req,
>         return err;
>  }
>
> -static int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key,
> -                                 unsigned int keysize)
> -{
> -       return chacha_setkey(tfm, key, keysize, 20);
> -}
> -
> -static int crypto_chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key,
> -                                unsigned int keysize)
> -{
> -       return chacha_setkey(tfm, key, keysize, 12);
> -}
> -
>  static int crypto_chacha_crypt(struct skcipher_request *req)
>  {
>         struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
> @@ -91,7 +79,7 @@ static struct skcipher_alg algs[] = {
>                 .max_keysize            = CHACHA_KEY_SIZE,
>                 .ivsize                 = CHACHA_IV_SIZE,
>                 .chunksize              = CHACHA_BLOCK_SIZE,
> -               .setkey                 = crypto_chacha20_setkey,
> +               .setkey                 = chacha20_setkey,
>                 .encrypt                = crypto_chacha_crypt,
>                 .decrypt                = crypto_chacha_crypt,
>         }, {
> @@ -106,7 +94,7 @@ static struct skcipher_alg algs[] = {
>                 .max_keysize            = CHACHA_KEY_SIZE,
>                 .ivsize                 = XCHACHA_IV_SIZE,
>                 .chunksize              = CHACHA_BLOCK_SIZE,
> -               .setkey                 = crypto_chacha20_setkey,
> +               .setkey                 = chacha20_setkey,
>                 .encrypt                = crypto_xchacha_crypt,
>                 .decrypt                = crypto_xchacha_crypt,
>         }, {
> @@ -121,7 +109,7 @@ static struct skcipher_alg algs[] = {
>                 .max_keysize            = CHACHA_KEY_SIZE,
>                 .ivsize                 = XCHACHA_IV_SIZE,
>                 .chunksize              = CHACHA_BLOCK_SIZE,
> -               .setkey                 = crypto_chacha12_setkey,
> +               .setkey                 = chacha12_setkey,
>                 .encrypt                = crypto_xchacha_crypt,
>                 .decrypt                = crypto_xchacha_crypt,
>         }
> --
> 2.24.0
>

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

* Re: [PATCH] crypto: chacha_generic - remove unnecessary setkey() functions
  2019-11-18  7:21 [PATCH] crypto: chacha_generic - remove unnecessary setkey() functions Eric Biggers
  2019-11-18  7:26 ` Ard Biesheuvel
@ 2019-11-22 11:10 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2019-11-22 11:10 UTC (permalink / raw)
  To: Eric Biggers; +Cc: linux-crypto, Ard Biesheuvel

On Sun, Nov 17, 2019 at 11:21:29PM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Use chacha20_setkey() and chacha12_setkey() from
> <crypto/internal/chacha.h> instead of defining them again in
> chacha_generic.c.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  crypto/chacha_generic.c | 18 +++---------------
>  1 file changed, 3 insertions(+), 15 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-11-22 11:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-18  7:21 [PATCH] crypto: chacha_generic - remove unnecessary setkey() functions Eric Biggers
2019-11-18  7:26 ` Ard Biesheuvel
2019-11-22 11:10 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox