Commit d73d67fb authored by Kees Cook's avatar Kees Cook Committed by Herbert Xu

crypto: cbc - Remove VLA usage

In the quest to remove all stack VLA usage from the kernel[1], this
uses the upper bounds on blocksize. Since this is always a cipher
blocksize, use the existing cipher max blocksize.

[1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.comSigned-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 3bdd23f8
...@@ -113,7 +113,7 @@ static inline int crypto_cbc_decrypt_inplace( ...@@ -113,7 +113,7 @@ static inline int crypto_cbc_decrypt_inplace(
unsigned int bsize = crypto_skcipher_blocksize(tfm); unsigned int bsize = crypto_skcipher_blocksize(tfm);
unsigned int nbytes = walk->nbytes; unsigned int nbytes = walk->nbytes;
u8 *src = walk->src.virt.addr; u8 *src = walk->src.virt.addr;
u8 last_iv[bsize]; u8 last_iv[MAX_CIPHER_BLOCKSIZE];
/* Start of the last block. */ /* Start of the last block. */
src += nbytes - (nbytes & (bsize - 1)) - bsize; src += nbytes - (nbytes & (bsize - 1)) - bsize;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment