ipq40xx: qce - add fixes for AES ciphers
[openwrt/staging/jogo.git] / target / linux / ipq40xx / patches-4.19 / 041-crypto-qce-fix-ctr-aes-qce-block-chunk-sizes.patch
1 From 3f5598286445f695bb63a22239dd3603c69a6eaf Mon Sep 17 00:00:00 2001
2 From: Eneas U de Queiroz <cotequeiroz@gmail.com>
3 Date: Mon, 28 Oct 2019 09:03:07 -0300
4 Subject: [PATCH] crypto: qce - fix ctr-aes-qce block, chunk sizes
5
6 Set blocksize of ctr-aes-qce to 1, so it can operate as a stream cipher,
7 adding the definition for chucksize instead, where the underlying block
8 size belongs.
9
10 Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
11
12 --- a/drivers/crypto/qce/skcipher.c
13 +++ b/drivers/crypto/qce/skcipher.c
14 @@ -261,6 +261,7 @@ struct qce_skcipher_def {
15 const char *name;
16 const char *drv_name;
17 unsigned int blocksize;
18 + unsigned int chunksize;
19 unsigned int ivsize;
20 unsigned int min_keysize;
21 unsigned int max_keysize;
22 @@ -289,7 +290,8 @@ static const struct qce_skcipher_def skc
23 .flags = QCE_ALG_AES | QCE_MODE_CTR,
24 .name = "ctr(aes)",
25 .drv_name = "ctr-aes-qce",
26 - .blocksize = AES_BLOCK_SIZE,
27 + .blocksize = 1,
28 + .chunksize = AES_BLOCK_SIZE,
29 .ivsize = AES_BLOCK_SIZE,
30 .min_keysize = AES_MIN_KEY_SIZE,
31 .max_keysize = AES_MAX_KEY_SIZE,
32 @@ -359,6 +361,7 @@ static int qce_skcipher_register_one(con
33 def->drv_name);
34
35 alg->base.cra_blocksize = def->blocksize;
36 + alg->chunksize = def->chunksize;
37 alg->ivsize = def->ivsize;
38 alg->min_keysize = def->min_keysize;
39 alg->max_keysize = def->max_keysize;