Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: qce - Return error for non-blocksize data(ECB/CBC algorithms)

ECB/CBC encryption/decryption requires the data to be blocksize aligned.
Crypto engine hangs on non-block sized operations for these algorithms.
Return invalid data if data size is not blocksize aligned for these
algorithms.

Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Thara Gopinath and committed by
Herbert Xu
44b45cde f0878946

+9
+9
drivers/crypto/qce/skcipher.c
··· 254 254 struct qce_cipher_ctx *ctx = crypto_skcipher_ctx(tfm); 255 255 struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); 256 256 struct qce_alg_template *tmpl = to_cipher_tmpl(tfm); 257 + unsigned int blocksize = crypto_skcipher_blocksize(tfm); 257 258 int keylen; 258 259 int ret; 259 260 ··· 265 264 /* CE does not handle 0 length messages */ 266 265 if (!req->cryptlen) 267 266 return 0; 267 + 268 + /* 269 + * ECB and CBC algorithms require message lengths to be 270 + * multiples of block size. 271 + */ 272 + if (IS_ECB(rctx->flags) || IS_CBC(rctx->flags)) 273 + if (!IS_ALIGNED(req->cryptlen, blocksize)) 274 + return -EINVAL; 268 275 269 276 /* qce is hanging when AES-XTS request len > QCE_SECTOR_SIZE and 270 277 * is not a multiple of it; pass such requests to the fallback