diff options
author | Salvatore Mesoraca <s.mesoraca16@gmail.com> | 2018-04-09 09:54:47 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-04-20 12:58:34 -0400 |
commit | 6650c4de681ee90ea6da1fc34fb913f60e9bb008 (patch) | |
tree | 6b0aad6025f677271fa95e979ddb04d5083463e1 /crypto/cts.c | |
parent | 13c935bb09948aef0202574ee12bb089459eb43b (diff) |
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 @@ | |||
40 | * rfc3962 includes errata information in its Appendix A. | 40 | * rfc3962 includes errata information in its Appendix A. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #include <crypto/algapi.h> | ||
43 | #include <crypto/internal/skcipher.h> | 44 | #include <crypto/internal/skcipher.h> |
44 | #include <linux/err.h> | 45 | #include <linux/err.h> |
45 | #include <linux/init.h> | 46 | #include <linux/init.h> |
@@ -104,7 +105,7 @@ static int cts_cbc_encrypt(struct skcipher_request *req) | |||
104 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); | 105 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); |
105 | struct skcipher_request *subreq = &rctx->subreq; | 106 | struct skcipher_request *subreq = &rctx->subreq; |
106 | int bsize = crypto_skcipher_blocksize(tfm); | 107 | int bsize = crypto_skcipher_blocksize(tfm); |
107 | u8 d[bsize * 2] __aligned(__alignof__(u32)); | 108 | u8 d[MAX_CIPHER_BLOCKSIZE * 2] __aligned(__alignof__(u32)); |
108 | struct scatterlist *sg; | 109 | struct scatterlist *sg; |
109 | unsigned int offset; | 110 | unsigned int offset; |
110 | int lastn; | 111 | int lastn; |
@@ -183,7 +184,7 @@ static int cts_cbc_decrypt(struct skcipher_request *req) | |||
183 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); | 184 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); |
184 | struct skcipher_request *subreq = &rctx->subreq; | 185 | struct skcipher_request *subreq = &rctx->subreq; |
185 | int bsize = crypto_skcipher_blocksize(tfm); | 186 | int bsize = crypto_skcipher_blocksize(tfm); |
186 | u8 d[bsize * 2] __aligned(__alignof__(u32)); | 187 | u8 d[MAX_CIPHER_BLOCKSIZE * 2] __aligned(__alignof__(u32)); |
187 | struct scatterlist *sg; | 188 | struct scatterlist *sg; |
188 | unsigned int offset; | 189 | unsigned int offset; |
189 | u8 *space; | 190 | u8 *space; |