summaryrefslogtreecommitdiff
path: root/crypto/simd.c
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2018-11-08 23:55:16 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2018-11-09 17:35:43 +0800
commit4b66bf1800121546dbe593302b162f11c65300d3 (patch)
tree4639b5954f95b89ffe59c67b3c9f6ba78794dab7 /crypto/simd.c
parentc7ef39a437ecd8db2f7f3c7b36cbcc1eeb525636 (diff)
downloadlinux-crypto-4b66bf1800121546dbe593302b162f11c65300d3.tar.gz
linux-crypto-4b66bf1800121546dbe593302b162f11c65300d3.zip
crypto: simd - correctly take reqsize of wrapped skcipher into account
The simd wrapper's skcipher request context structure consists of a single subrequest whose size is taken from the subordinate skcipher. However, in simd_skcipher_init(), the reqsize that is retrieved is not from the subordinate skcipher but from the cryptd request structure, whose size is completely unrelated to the actual wrapped skcipher. Reported-by: Qian Cai <cai@gmx.us> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Qian Cai <cai@gmx.us> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--crypto/simd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/simd.c b/crypto/simd.c
index ea7240be..78e8d037 100644
--- a/crypto/simd.c
+++ b/crypto/simd.c
@@ -124,8 +124,9 @@ static int simd_skcipher_init(struct crypto_skcipher *tfm)
ctx->cryptd_tfm = cryptd_tfm;
- reqsize = sizeof(struct skcipher_request);
- reqsize += crypto_skcipher_reqsize(&cryptd_tfm->base);
+ reqsize = crypto_skcipher_reqsize(cryptd_skcipher_child(cryptd_tfm));
+ reqsize = max(reqsize, crypto_skcipher_reqsize(&cryptd_tfm->base));
+ reqsize += sizeof(struct skcipher_request);
crypto_skcipher_set_reqsize(tfm, reqsize);