OSDN Git Service

crypto: api - Introduce generic max blocksize and alignmask
authorKees Cook <keescook@chromium.org>
Tue, 7 Aug 2018 21:18:40 +0000 (14:18 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 4 Sep 2018 03:35:04 +0000 (11:35 +0800)
commita9f7f88a12f1494deca1fd9e173c7ae886d14f91
tree23873d32268fd658b1b89833b2074c7bdef32528
parentb68a7ec1e9a3efac53ae26a1658a553825a2375c
crypto: api - Introduce generic max blocksize and alignmask

In the quest to remove all stack VLA usage from the kernel[1], this
exposes a new general upper bound on crypto blocksize and alignmask
(higher than for the existing cipher limits) for VLA removal,
and introduces new checks.

At present, the highest cra_alignmask in the kernel is 63. The highest
cra_blocksize is 144 (SHA3_224_BLOCK_SIZE, 18 8-byte words). For the
new blocksize limit, I went with 160 (20 8-byte words).

[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>
crypto/algapi.c
include/crypto/algapi.h