diff options
author | Salvatore Mesoraca <s.mesoraca16@gmail.com> | 2018-04-09 15:54:46 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-04-21 00:58:32 +0800 |
commit | 13c935bb09948aef0202574ee12bb089459eb43b (patch) | |
tree | 6fa0ea9c5433ea754889a5924d566815b6ad7f35 /include/crypto | |
parent | c4e848586cf11dd80633e4981108f36d4b414df1 (diff) | |
download | linux-stable-13c935bb09948aef0202574ee12bb089459eb43b.tar.gz linux-stable-13c935bb09948aef0202574ee12bb089459eb43b.tar.bz2 linux-stable-13c935bb09948aef0202574ee12bb089459eb43b.zip |
crypto: api - laying defines and checks for statically allocated buffers
In preparation for the removal of VLAs[1] from crypto code.
We create 2 new compile-time constants: all ciphers implemented
in Linux have a block size less than or equal to 16 bytes and
the most demanding hw require 16 bytes alignment for the block
buffer.
We also enforce these limits in crypto_check_alg when a new
cipher is registered.
[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 'include/crypto')
-rw-r--r-- | include/crypto/algapi.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 1aba888241dd..bd5e8ccf1687 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h @@ -17,6 +17,14 @@ #include <linux/kernel.h> #include <linux/skbuff.h> +/* + * Maximum values for blocksize and alignmask, used to allocate + * static buffers that are big enough for any combination of + * ciphers and architectures. + */ +#define MAX_CIPHER_BLOCKSIZE 16 +#define MAX_CIPHER_ALIGNMASK 15 + struct crypto_aead; struct crypto_instance; struct module; |