Message ID | 20180807211843.47586-3-keescook@chromium.org (mailing list archive) |
---|---|
State | Accepted |
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 E1C531390 for <patchwork-linux-crypto@patchwork.kernel.org>; Tue, 7 Aug 2018 21:19:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE8B12A5F7 for <patchwork-linux-crypto@patchwork.kernel.org>; Tue, 7 Aug 2018 21:19:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C220E2A5FB; Tue, 7 Aug 2018 21:19:32 +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=ham 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 6647A2A5F7 for <patchwork-linux-crypto@patchwork.kernel.org>; Tue, 7 Aug 2018 21:19:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726414AbeHGXfK (ORCPT <rfc822;patchwork-linux-crypto@patchwork.kernel.org>); Tue, 7 Aug 2018 19:35:10 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:46927 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbeHGXfJ (ORCPT <rfc822;linux-crypto@vger.kernel.org>); Tue, 7 Aug 2018 19:35:09 -0400 Received: by mail-pg1-f195.google.com with SMTP id f14-v6so19315pgv.13 for <linux-crypto@vger.kernel.org>; Tue, 07 Aug 2018 14:18:51 -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=WKSfBoqqmwqW/7rTlYhIb2ASSav+oo5lfeHmCUUrk2I=; b=fRu17USj+VPtv3LEav9XxzknEFCskBJejbyi2YND9LHOBQC1cXwpSyhPgP+p3zOZgW WtBRKFmxTa4aGNJ9jKD7ItSWb6JKRGET9Pj++1oyH52TfO4HmQDANXNaN/gwXx8xahGX PWyhfcS99/Lh9FNkIh3SwqPAw+kR0t4yWDhEE= 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=WKSfBoqqmwqW/7rTlYhIb2ASSav+oo5lfeHmCUUrk2I=; b=lhcP3DgkzuxwawIgrKcZZLvuai+SsMI1NURESRWd5YSeePeq03U4vzT6TrVpFaimE+ EhKl+vkyYLJ4/8Fw/AnQM131QI8KCU1CLQhFciqyaxPBpGTCsTWnZ7F0XDGgy0ljEw+P C8MFgIWJNihk4YjUxgKbZZo6UHQMxLwhrcqf+tsLRG31G37gVL87tSpLSQ7OKGe7IJ5b biJ16d15JUg8hRDbpb0n6rKevrR31VAHXpQ8wF9EYCjqsMI1VqQffKa2oBmzSZEceoq5 EX1y5Pk1nboPgQ9SkUb8SuzoKGqScg4GBi/uW6e7bXjUnaMuK3aY0wn/gneQLKn4r97G ZL8A== X-Gm-Message-State: AOUpUlEjptjPzaK5XI4vZt5Z9xbHqAaQ9sDdbb30yghmyhpvRXuDmP2k +EWqoaCI//qSIuErfjI+6VMkXw== X-Google-Smtp-Source: AA+uWPyHehl2hGoOqA0NWSj3PgQvPdIYNMCpQkqgxVJpWVT0az2tRwqOzKUVxoyM+WRdlZ/GHZmZsw== X-Received: by 2002:a63:3444:: with SMTP id b65-v6mr74051pga.396.1533676730942; Tue, 07 Aug 2018 14:18:50 -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 s66-v6sm2342549pgc.67.2018.08.07.14.18.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Aug 2018 14:18:46 -0700 (PDT) From: Kees Cook <keescook@chromium.org> To: Herbert Xu <herbert@gondor.apana.org.au> Cc: Kees Cook <keescook@chromium.org>, Eric Biggers <ebiggers@google.com>, Ard Biesheuvel <ard.biesheuvel@linaro.org>, Giovanni Cabiddu <giovanni.cabiddu@intel.com>, Alasdair Kergon <agk@redhat.com>, Mike Snitzer <snitzer@redhat.com>, Tudor-Dan Ambarus <tudor.ambarus@microchip.com>, Andrew Morton <akpm@linux-foundation.org>, Thomas Gleixner <tglx@linutronix.de>, Geert Uytterhoeven <geert@linux-m68k.org>, Arnd Bergmann <arnd@arndb.de>, Will Deacon <will.deacon@arm.com>, Rasmus Villemoes <linux@rasmusvillemoes.dk>, David Woodhouse <dwmw@amazon.co.uk>, Matthew Wilcox <willy@infradead.org>, "David S. Miller" <davem@davemloft.net>, "Gustavo A. R. Silva" <gustavo@embeddedor.com>, linux-crypto@vger.kernel.org, dm-devel@redhat.com, qat-linux@intel.com, linux-kernel@vger.kernel.org Subject: [PATCH v8 2/9] crypto: cbc: Remove VLA usage Date: Tue, 7 Aug 2018 14:18:36 -0700 Message-Id: <20180807211843.47586-3-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807211843.47586-1-keescook@chromium.org> References: <20180807211843.47586-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..3bf28beefa33 100644 --- a/include/crypto/cbc.h +++ b/include/crypto/cbc.h @@ -113,7 +113,7 @@ 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]; /* 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)