aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/amcc/crypto4xx_core.h
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@gmail.com>2018-04-19 12:41:57 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2018-04-28 04:09:45 -0400
commit658c9d2b9f374c835d0348d852a3f002196628d0 (patch)
treee64261bcde2db0be77c32533a6f99e6133e0426e /drivers/crypto/amcc/crypto4xx_core.h
parent584201f1895d915c1aa523bc86afdc126e94beca (diff)
crypto: crypto4xx - put temporary dst sg into request ctx
This patch fixes a crash that happens when testing rfc4543(gcm(aes)) Unable to handle kernel paging request for data at address 0xf59b3420 Faulting instruction address: 0xc0012994 Oops: Kernel access of bad area, sig: 11 [#1] BE PowerPC 44x Platform Modules linked in: tcrypt(+) crypto4xx [...] CPU: 0 PID: 0 Comm: swapper Tainted: G O 4.17.0-rc1+ #23 NIP: c0012994 LR: d3077934 CTR: 06026d49 REGS: cfff7e30 TRAP: 0300 Tainted: G O (4.17.0-rc1+) MSR: 00029000 <CE,EE,ME> CR: 44744822 XER: 00000000 DEAR: f59b3420 ESR: 00000000 NIP [c0012994] __dma_sync+0x58/0x10c LR [d3077934] crypto4xx_bh_tasklet_cb+0x188/0x3c8 [crypto4xx] __dma_sync was fed the temporary _dst that crypto4xx_build_pd() had in it's function stack. This clearly never worked. This patch therefore overhauls the code from the original driver and puts the temporary dst sg list into aead's request context. Fixes: a0aae821ba3d3 ("crypto: crypto4xx - prepare for AEAD support") Signed-off-by: Christian Lamparter <chunkeey@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/amcc/crypto4xx_core.h')
-rw-r--r--drivers/crypto/amcc/crypto4xx_core.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/crypto/amcc/crypto4xx_core.h b/drivers/crypto/amcc/crypto4xx_core.h
index 279f650c4f1c..e2ca56722f07 100644
--- a/drivers/crypto/amcc/crypto4xx_core.h
+++ b/drivers/crypto/amcc/crypto4xx_core.h
@@ -133,6 +133,10 @@ struct crypto4xx_ctx {
133 } sw_cipher; 133 } sw_cipher;
134}; 134};
135 135
136struct crypto4xx_aead_reqctx {
137 struct scatterlist dst[2];
138};
139
136struct crypto4xx_alg_common { 140struct crypto4xx_alg_common {
137 u32 type; 141 u32 type;
138 union { 142 union {
@@ -159,7 +163,8 @@ int crypto4xx_build_pd(struct crypto_async_request *req,
159 const __le32 *iv, const u32 iv_len, 163 const __le32 *iv, const u32 iv_len,
160 const struct dynamic_sa_ctl *sa, 164 const struct dynamic_sa_ctl *sa,
161 const unsigned int sa_len, 165 const unsigned int sa_len,
162 const unsigned int assoclen); 166 const unsigned int assoclen,
167 struct scatterlist *dst_tmp);
163int crypto4xx_setkey_aes_cbc(struct crypto_skcipher *cipher, 168int crypto4xx_setkey_aes_cbc(struct crypto_skcipher *cipher,
164 const u8 *key, unsigned int keylen); 169 const u8 *key, unsigned int keylen);
165int crypto4xx_setkey_aes_cfb(struct crypto_skcipher *cipher, 170int crypto4xx_setkey_aes_cfb(struct crypto_skcipher *cipher,