From: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
To: Herbert Xu <herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
Cc: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
Eric Biggers <ebiggers-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
"Gustavo A. R. Silva"
<gustavo-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>,
Alasdair Kergon <agk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Rabin Vincent <rabinv-VrBV9hrLPhE@public.gmane.org>,
Tim Chen <tim.c.chen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
"Rafael J. Wysocki" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>,
Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
Philipp Reisner
<philipp.reisner-63ez5xqkn6DQT0dZR+AlfA@public.gmane.org>,
Lars Ellenberg
<lars.ellenberg-63ez5xqkn6DQT0dZR+AlfA@public.gmane.org>,
Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>,
Giovanni Cabiddu
<giovanni.cabiddu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Mike Snitzer <snitzer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Paul Mackerras <paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
David Howells <dhowe
Subject: [PATCH v6 02/18] crypto: cbc: Remove VLA usage
Date: Tue, 24 Jul 2018 09:49:20 -0700 [thread overview]
Message-ID: <20180724164936.37477-3-keescook@chromium.org> (raw)
In-Reply-To: <20180724164936.37477-1-keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
In the quest to remove all stack VLA usage from the kernel[1], this
uses the upper bounds on blocksize. Since this is always a cipher
blocksize, use the existing cipher max blocksize.
[1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
include/crypto/cbc.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/crypto/cbc.h b/include/crypto/cbc.h
index f5b8bfc22e6d..47db0aac2ab9 100644
--- a/include/crypto/cbc.h
+++ b/include/crypto/cbc.h
@@ -113,7 +113,9 @@ static inline int crypto_cbc_decrypt_inplace(
unsigned int bsize = crypto_skcipher_blocksize(tfm);
unsigned int nbytes = walk->nbytes;
u8 *src = walk->src.virt.addr;
- u8 last_iv[bsize];
+ u8 last_iv[MAX_CIPHER_BLOCKSIZE];
+
+ BUG_ON(bsize > sizeof(last_iv));
/* Start of the last block. */
src += nbytes - (nbytes & (bsize - 1)) - bsize;
--
2.17.1
next prev parent reply other threads:[~2018-07-24 16:49 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-24 16:49 [PATCH v6 00/18] crypto: Remove VLA usage Kees Cook
2018-07-24 16:49 ` [PATCH v6 03/18] crypto: hash: " Kees Cook
2018-07-24 16:49 ` [PATCH v6 04/18] dm: Remove VLA usage from hashes Kees Cook
2018-07-24 16:49 ` [PATCH v6 05/18] crypto alg: Introduce generic max blocksize and alignmask Kees Cook
2018-07-24 16:49 ` [PATCH v6 06/18] crypto: qat: Remove VLA usage Kees Cook
2018-07-24 16:49 ` [PATCH v6 07/18] crypto: shash: Remove VLA usage in unaligned hashing Kees Cook
2018-07-24 16:49 ` [PATCH v6 08/18] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK Kees Cook
2018-07-24 16:49 ` [PATCH v6 09/18] ppp: mppe: Remove VLA usage Kees Cook
2018-07-24 16:49 ` [PATCH v6 10/18] x86/power/64: " Kees Cook
2018-07-25 11:32 ` Rafael J. Wysocki
[not found] ` <CAJZ5v0gVDotjufLKUW0YuQu2vA4fmU_gqia=ZA4DocW4XHxx0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-25 18:01 ` Kees Cook
2018-08-06 10:28 ` Rafael J. Wysocki
2018-07-24 16:49 ` [PATCH v6 11/18] dm crypt: Convert essiv from ahash to shash Kees Cook
2018-07-24 16:49 ` [PATCH v6 12/18] drbd: Convert " Kees Cook
[not found] ` <20180724164936.37477-13-keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-08-02 23:43 ` Kees Cook
[not found] ` <CAGXu5jJB6V0r8LXOGL6+sO0NVZ0HK3VCthML=T3gLEwMABhSDQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-03 13:44 ` Lars Ellenberg
2018-08-06 17:27 ` Kees Cook
2018-07-24 16:49 ` [PATCH v6 13/18] wireless/lib80211: " Kees Cook
2018-07-25 7:24 ` Johannes Berg
2018-07-25 8:05 ` Kalle Valo
[not found] ` <20180724164936.37477-1-keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2018-07-24 16:49 ` [PATCH v6 01/18] crypto: xcbc: Remove VLA usage Kees Cook
2018-07-24 16:49 ` Kees Cook [this message]
2018-07-24 16:49 ` [PATCH v6 14/18] staging: rtl8192u: ieee80211: Convert from ahash to shash Kees Cook
2018-07-24 16:49 ` [PATCH v6 15/18] staging: rtl8192e: " Kees Cook
2018-07-24 16:49 ` [PATCH v6 16/18] rxrpc: Reuse SKCIPHER_REQUEST_ON_STACK buffer Kees Cook
2018-08-02 23:46 ` Kees Cook
2018-08-03 9:14 ` David Howells
2018-07-24 16:49 ` [PATCH v6 17/18] crypto: ccm: Remove VLA usage Kees Cook
2018-07-24 16:57 ` Ard Biesheuvel
2018-07-24 17:51 ` Kees Cook
2018-07-24 16:49 ` [PATCH v6 18/18] crypto: Remove AHASH_REQUEST_ON_STACK Kees Cook
2018-07-24 17:31 ` Joe Perches
[not found] ` <1bdc706ae86039c4ffcff39698251424d54af116.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2018-07-24 17:53 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180724164936.37477-3-keescook@chromium.org \
--to=keescook-f7+t8e8rja9g9huczpvpmw@public.gmane.org \
--cc=agk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
--cc=ebiggers-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=giovanni.cabiddu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=gustavo-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org \
--cc=herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org \
--cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
--cc=lars.ellenberg-63ez5xqkn6DQT0dZR+AlfA@public.gmane.org \
--cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
--cc=pavel-+ZI9xUNit7I@public.gmane.org \
--cc=philipp.reisner-63ez5xqkn6DQT0dZR+AlfA@public.gmane.org \
--cc=rabinv-VrBV9hrLPhE@public.gmane.org \
--cc=rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org \
--cc=snitzer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=tim.c.chen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox