mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 22:23:27 +00:00
d540725871
Without this patch, the chacha block counter is not incremented on neon rounds, resulting in incorrect calculations and corrupt packets. This also switches to using `--no-numbered --zero-commit` so that future diffs are smaller. Reported-by: Hans Geiblinger <cybrnook2002@yahoo.com> Reviewed-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com> Cc: David Bauer <mail@david-bauer.net> Cc: Petr Štetiar <ynezz@true.cz> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
69 lines
2.2 KiB
Diff
69 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Eric Biggers <ebiggers@google.com>
|
|
Date: Sun, 17 Nov 2019 23:21:29 -0800
|
|
Subject: [PATCH] crypto: chacha_generic - remove unnecessary setkey()
|
|
functions
|
|
|
|
commit 2043323a799a660bc84bbee404cf7a2617ec6157 upstream.
|
|
|
|
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>
|
|
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
|
|
---
|
|
crypto/chacha_generic.c | 18 +++---------------
|
|
1 file changed, 3 insertions(+), 15 deletions(-)
|
|
|
|
--- a/crypto/chacha_generic.c
|
|
+++ b/crypto/chacha_generic.c
|
|
@@ -37,18 +37,6 @@ static int chacha_stream_xor(struct skci
|
|
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,
|
|
}
|