diff options
author | Salvatore Mesoraca <s.mesoraca16@gmail.com> | 2018-04-09 15:54:47 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-04-21 00:58:34 +0800 |
commit | 6650c4de681ee90ea6da1fc34fb913f60e9bb008 (patch) | |
tree | 6b0aad6025f677271fa95e979ddb04d5083463e1 /crypto/cts.c | |
parent | 13c935bb09948aef0202574ee12bb089459eb43b (diff) | |
download | lwn-6650c4de681ee90ea6da1fc34fb913f60e9bb008.tar.gz lwn-6650c4de681ee90ea6da1fc34fb913f60e9bb008.zip |
crypto: remove several VLAs
We avoid various VLAs[1] by using constant expressions for block size
and alignment mask.
[1] http://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com
Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/cts.c')
-rw-r--r-- | crypto/cts.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/cts.c b/crypto/cts.c index 4773c188e6d9..4e28d83ae37d 100644 --- a/crypto/cts.c +++ b/crypto/cts.c @@ -40,6 +40,7 @@ * rfc3962 includes errata information in its Appendix A. */ +#include <crypto/algapi.h> #include <crypto/internal/skcipher.h> #include <linux/err.h> #include <linux/init.h> @@ -104,7 +105,7 @@ static int cts_cbc_encrypt(struct skcipher_request *req) struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); struct skcipher_request *subreq = &rctx->subreq; int bsize = crypto_skcipher_blocksize(tfm); - u8 d[bsize * 2] __aligned(__alignof__(u32)); + u8 d[MAX_CIPHER_BLOCKSIZE * 2] __aligned(__alignof__(u32)); struct scatterlist *sg; unsigned int offset; int lastn; @@ -183,7 +184,7 @@ static int cts_cbc_decrypt(struct skcipher_request *req) struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); struct skcipher_request *subreq = &rctx->subreq; int bsize = crypto_skcipher_blocksize(tfm); - u8 d[bsize * 2] __aligned(__alignof__(u32)); + u8 d[MAX_CIPHER_BLOCKSIZE * 2] __aligned(__alignof__(u32)); struct scatterlist *sg; unsigned int offset; u8 *space; |