acded24bbb206e6f233a4cb6a4b0a2cb4907762f
[openwrt/openwrt.git] / target / linux / apm821xx / patches-4.14 / 020-0014-crypto-crypto4xx-fix-off-by-one-AES-OFB.patch
1 From e9b8e4e1129d0886094cfe013cdbaafc4ce0de76 Mon Sep 17 00:00:00 2001
2 From: Christian Lamparter <chunkeey@gmail.com>
3 Date: Wed, 4 Oct 2017 01:00:06 +0200
4 Subject: [PATCH 14/25] crypto: crypto4xx - fix off-by-one AES-OFB
5
6 I used aes-cbc as a template for ofb. But sadly I forgot
7 to update set_key method to crypto4xx_setkey_aes_ofb().
8
9 this was caught by the testmgr:
10 alg: skcipher: Test 1 failed (invalid result) on encr. for ofb-aes-ppc4xx
11 00000000: 76 49 ab ac 81 19 b2 46 ce e9 8e 9b 12 e9 19 7d
12 00000010: 50 86 cb 9b 50 72 19 ee 95 db 11 3a 91 76 78 b2
13 00000020: 73 be d6 b8 e3 c1 74 3b 71 16 e6 9e 22 22 95 16
14 00000030: 3f f1 ca a1 68 1f ac 09 12 0e ca 30 75 86 e1 a7
15
16 With the correct set_key method, the aes-ofb cipher passes the test.
17
18 name : ofb(aes)
19 driver : ofb-aes-ppc4xx
20 module : crypto4xx
21 priority : 300
22 refcnt : 1
23 selftest : passed
24 internal : no
25 type : ablkcipher
26 async : yes
27 blocksize : 16
28 min keysize : 16
29 max keysize : 32
30 ivsize : 16
31 geniv : <default>
32
33 Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
34 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
35 ---
36 drivers/crypto/amcc/crypto4xx_core.c | 2 +-
37 1 file changed, 1 insertion(+), 1 deletion(-)
38
39 --- a/drivers/crypto/amcc/crypto4xx_core.c
40 +++ b/drivers/crypto/amcc/crypto4xx_core.c
41 @@ -1148,7 +1148,7 @@ struct crypto4xx_alg_common crypto4xx_al
42 .min_keysize = AES_MIN_KEY_SIZE,
43 .max_keysize = AES_MAX_KEY_SIZE,
44 .ivsize = AES_IV_SIZE,
45 - .setkey = crypto4xx_setkey_aes_cbc,
46 + .setkey = crypto4xx_setkey_aes_ofb,
47 .encrypt = crypto4xx_encrypt,
48 .decrypt = crypto4xx_decrypt,
49 }