Skip to content

Commit

Permalink
crypto: cbc - Remove VLA usage
Browse files Browse the repository at this point in the history
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.com

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
kees authored and herbertx committed Sep 4, 2018
1 parent 3bdd23f commit d73d67f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/crypto/cbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static inline int crypto_cbc_decrypt_inplace(
unsigned int bsize = crypto_skcipher_blocksize(tfm);
unsigned int nbytes = walk->nbytes;
u8 *src = walk->src.virt.addr;
u8 last_iv[bsize];
u8 last_iv[MAX_CIPHER_BLOCKSIZE];

/* Start of the last block. */
src += nbytes - (nbytes & (bsize - 1)) - bsize;
Expand Down

0 comments on commit d73d67f

Please sign in to comment.