From patchwork Mon Apr 9 13:53:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salvatore Mesoraca X-Patchwork-Id: 10331365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DBC7260236 for ; Mon, 9 Apr 2018 13:54:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBBA128B57 for ; Mon, 9 Apr 2018 13:54:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF35F28B59; Mon, 9 Apr 2018 13:54:59 +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=-5.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id E7A9428B57 for ; Mon, 9 Apr 2018 13:54:58 +0000 (UTC) Received: (qmail 15710 invoked by uid 550); 9 Apr 2018 13:54:28 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 15633 invoked from network); 9 Apr 2018 13:54:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=830I2FtaCI7kkwpzHkb1D64AA5JBuPJRaD87G/HzoCY=; b=fCI23bJwCyij2Jk+vsFS9ktKWZtd/FLZcLf4le8DvfuSZmSx10Hgg4CGV5U2Xyl9tG e/bK8AKmd5ZlPEQsRzLd724lFDYj4JdIlqIP7bNl+TrWGkmKq2p7jIesZe4kaND9hASy NyDwubvvq1wIseGFOpytEPouiLekNNI2i5NVypp2JW0bqveTI24t1u5KG+z8OGRrE3Kz kCOARi5a+Icv1Z714GGHeDC4hJzLkmAoY3TtqGNeF8VMylcXDuw+gj8he+deThOOgbsZ B12jHvVzt9FnhQbZVc8Kb0eWuSiGtfQWDeaHTjocRJpWeDVDgEi6BYj29Po8SSliHkdq RJ8A== 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=830I2FtaCI7kkwpzHkb1D64AA5JBuPJRaD87G/HzoCY=; b=IfK+RRUJ1gBS/M+y+TrNNWWhVfXztN1h/KxcUrdyikhgy0bxFu5Ovkk7vMSe3bVBeH paf8aSNvV0J9vbliXDaSjg185cHQ+Az4shUQ7YuIBbq3bSNThn2PoZfOJ2px72PtIOw7 YJ5j+ev4MvnhJEvYCgZ0SiEUWQ7wB5YQgakJcGzmKMP/xd58Gt9y5ozyx2qekshoW1P1 bOketfcLS+CpaJx7TOHrZ6wXoFdb8E+zBf+IV+cpM8uxWkPXpw3Jffm8bPnUg83c0Woi UWn6oyQ8rUyPYTSVergq629pmlKWxvaVJI7dHztDkMGmZ/4r027FwQIvX1GQr6Yl1knY Cwbw== X-Gm-Message-State: ALQs6tCSkkq4ddOj9PmPncyj3XcW6YakSdu3nrKkXB0t3/i0yeS81mhR jCOzLD9lPltdteq6YWR4oj0= X-Google-Smtp-Source: AIpwx48bGHZfx4c+kCNkMHQM27UMu90gsFNZg+m2j+O78SjMT4clXWVT7iGv6EZUy/dZ8bYV4MkjgQ== X-Received: by 10.28.237.3 with SMTP id l3mr45724wmh.125.1523282055988; Mon, 09 Apr 2018 06:54:15 -0700 (PDT) From: Salvatore Mesoraca To: linux-kernel@vger.kernel.org Cc: kernel-hardening@lists.openwall.com, linux-crypto@vger.kernel.org, "David S. Miller" , Herbert Xu , Kees Cook , Salvatore Mesoraca , Eric Biggers , Laura Abbott Subject: [PATCH 1/6] crypto: api - laying macros for statically allocated buffers Date: Mon, 9 Apr 2018 15:53:59 +0200 Message-Id: <1523282044-22075-2-git-send-email-s.mesoraca16@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1523282044-22075-1-git-send-email-s.mesoraca16@gmail.com> References: <1523282044-22075-1-git-send-email-s.mesoraca16@gmail.com> X-Virus-Scanned: ClamAV using ClamSMTP Creating 2 new compile-time constants for internal use, in preparation for the removal of VLAs[1] from crypto code. 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. [1] http://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com Signed-off-by: Salvatore Mesoraca --- crypto/internal.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crypto/internal.h b/crypto/internal.h index 9a3f399..89ae41e 100644 --- a/crypto/internal.h +++ b/crypto/internal.h @@ -26,6 +26,14 @@ #include #include +/* + * Maximum values for blocksize and alignmask, used to allocate + * static buffers that are big enough for any combination of + * ciphers and architectures. + */ +#define MAX_BLOCKSIZE 16 +#define MAX_ALIGNMASK 15 + /* Crypto notification events. */ enum { CRYPTO_MSG_ALG_REQUEST,