Message ID | 20180724164936.37477-3-keescook@chromium.org (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Herbert Xu |
Headers | show
Return-Path: <linux-crypto-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 66331157A for <patchwork-linux-crypto@patchwork.kernel.org>; Tue, 24 Jul 2018 16:53:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 559E328CD1 for <patchwork-linux-crypto@patchwork.kernel.org>; Tue, 24 Jul 2018 16:53:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4985628CDE; Tue, 24 Jul 2018 16:53:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBBDB28CD1 for <patchwork-linux-crypto@patchwork.kernel.org>; Tue, 24 Jul 2018 16:53:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388422AbeGXR5F (ORCPT <rfc822;patchwork-linux-crypto@patchwork.kernel.org>); Tue, 24 Jul 2018 13:57:05 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:38110 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388403AbeGXR5E (ORCPT <rfc822;linux-crypto@vger.kernel.org>); Tue, 24 Jul 2018 13:57:04 -0400 Received: by mail-pl0-f65.google.com with SMTP id b1-v6so2023319pls.5 for <linux-crypto@vger.kernel.org>; Tue, 24 Jul 2018 09:49:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aHfzmuE3dXR4IAoiUCBdTyidzm+NOXbAHoWt0SfC0Yk=; b=KhqlpwUhL7SO6HAt68REzVNh23xMYyqwyRYxyfbREhsXYNLJpRRD4CxsLAi/G0ABEE nEQPzunKszHZy9EQghyS9betds9tNuabN8iDV1U+D0LkktZ9RLjo2pM9X/Ooshz8Kkwx DWOS2k/XX7IAe6UdMjR7A/dGV/sM2yx1YvS2w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aHfzmuE3dXR4IAoiUCBdTyidzm+NOXbAHoWt0SfC0Yk=; b=Lv1bUvwX4sYzmsyvWuERAY5xwGnxvP/VOnI7Lh/NpMNzmP0Ftvupk1jZfw6H1uE68k f4YRHG4rN6Ad2M2GW3VNDjGmKMHfgd0+TvbnUNkr+uhs8SXxQM56+mqDyS7CV78boyfz zQf6mwzAb7h4x9kTUnxdnLp0YN2MGBy1FARVp/HOTXtUJxAdoMJOcxOh3yrNEPae/ejs JuBSsP1hqXWKZpb608x4apTMJ0IQIwQy2EB1os6kzxhaw1mmJMzM5JDF0AWVPeu7ZjCG 9+5Tythq7wByvi9YOgoQoAlU0LEd11I7zYJMyA8upmZrKhfgHLfghReKU/ioPLkGe6/c BtMg== X-Gm-Message-State: AOUpUlGnB1WucvIoAnoMIt4huhYjGnulmWCWMasT+QJwicXyZW1J33i6 NXkVg2nsJI3FPhT/M/Gdpc1/5Q== X-Google-Smtp-Source: AAOMgpdtrnpgdlGnZZaNxxRflnZkRXI0URdOC8dm/ekglScefov9CteU1tBZQcasQJzTaLBwGdLJwA== X-Received: by 2002:a17:902:9b90:: with SMTP id y16-v6mr1180619plp.201.1532450983936; Tue, 24 Jul 2018 09:49:43 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id v4-v6sm13314440pgr.36.2018.07.24.09.49.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Jul 2018 09:49:42 -0700 (PDT) From: Kees Cook <keescook@chromium.org> To: Herbert Xu <herbert@gondor.apana.org.au> Cc: Kees Cook <keescook@chromium.org>, Arnd Bergmann <arnd@arndb.de>, Eric Biggers <ebiggers@google.com>, "Gustavo A. R. Silva" <gustavo@embeddedor.com>, Alasdair Kergon <agk@redhat.com>, Rabin Vincent <rabinv@axis.com>, Tim Chen <tim.c.chen@linux.intel.com>, "Rafael J. Wysocki" <rjw@rjwysocki.net>, Pavel Machek <pavel@ucw.cz>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>, x86@kernel.org, Philipp Reisner <philipp.reisner@linbit.com>, Lars Ellenberg <lars.ellenberg@linbit.com>, Jens Axboe <axboe@kernel.dk>, Giovanni Cabiddu <giovanni.cabiddu@intel.com>, Mike Snitzer <snitzer@redhat.com>, Paul Mackerras <paulus@samba.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, David Howells <dhowells@redhat.com>, Johannes Berg <johannes@sipsolutions.net>, Tudor-Dan Ambarus <tudor.ambarus@microchip.com>, Jia-Ju Bai <baijiaju1990@gmail.com>, Andrew Morton <akpm@linux-foundation.org>, Geert Uytterhoeven <geert@linux-m68k.org>, Josh Poimboeuf <jpoimboe@redhat.com>, David Woodhouse <dwmw@amazon.co.uk>, Will Deacon <will.deacon@arm.com>, dm-devel@redhat.com, linux-pm@vger.kernel.org, linux-crypto@vger.kernel.org, drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, qat-linux@intel.com, linux-ppp@vger.kernel.org, netdev@vger.kernel.org, devel@driverdev.osuosl.org, linux-afs@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 02/18] crypto: cbc: Remove VLA usage Date: Tue, 24 Jul 2018 09:49:20 -0700 Message-Id: <20180724164936.37477-3-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180724164936.37477-1-keescook@chromium.org> References: <20180724164936.37477-1-keescook@chromium.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: <linux-crypto.vger.kernel.org> X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
crypto: Remove VLA usage
|
expand
|
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;
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@mail.gmail.com Signed-off-by: Kees Cook <keescook@chromium.org> --- include/crypto/cbc.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)