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/ctr.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/ctr.c')
-rw-r--r-- | crypto/ctr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/ctr.c b/crypto/ctr.c index 854d924f9d8e..435b75bd619e 100644 --- a/crypto/ctr.c +++ b/crypto/ctr.c | |||
@@ -58,7 +58,7 @@ static void crypto_ctr_crypt_final(struct blkcipher_walk *walk, | |||
58 | unsigned int bsize = crypto_cipher_blocksize(tfm); | 58 | unsigned int bsize = crypto_cipher_blocksize(tfm); |
59 | unsigned long alignmask = crypto_cipher_alignmask(tfm); | 59 | unsigned long alignmask = crypto_cipher_alignmask(tfm); |
60 | u8 *ctrblk = walk->iv; | 60 | u8 *ctrblk = walk->iv; |
61 | u8 tmp[bsize + alignmask]; | 61 | u8 tmp[MAX_CIPHER_BLOCKSIZE + MAX_CIPHER_ALIGNMASK]; |
62 | u8 *keystream = PTR_ALIGN(tmp + 0, alignmask + 1); | 62 | u8 *keystream = PTR_ALIGN(tmp + 0, alignmask + 1); |
63 | u8 *src = walk->src.virt.addr; | 63 | u8 *src = walk->src.virt.addr; |
64 | u8 *dst = walk->dst.virt.addr; | 64 | u8 *dst = walk->dst.virt.addr; |
@@ -106,7 +106,7 @@ static int crypto_ctr_crypt_inplace(struct blkcipher_walk *walk, | |||
106 | unsigned int nbytes = walk->nbytes; | 106 | unsigned int nbytes = walk->nbytes; |
107 | u8 *ctrblk = walk->iv; | 107 | u8 *ctrblk = walk->iv; |
108 | u8 *src = walk->src.virt.addr; | 108 | u8 *src = walk->src.virt.addr; |
109 | u8 tmp[bsize + alignmask]; | 109 | u8 tmp[MAX_CIPHER_BLOCKSIZE + MAX_CIPHER_ALIGNMASK]; |
110 | u8 *keystream = PTR_ALIGN(tmp + 0, alignmask + 1); | 110 | u8 *keystream = PTR_ALIGN(tmp + 0, alignmask + 1); |
111 | 111 | ||
112 | do { | 112 | do { |