From patchwork Sat Apr 7 18:38:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salvatore Mesoraca X-Patchwork-Id: 10327987 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 880C46020F for ; Sat, 7 Apr 2018 18:39:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79D8A294D5 for ; Sat, 7 Apr 2018 18:39:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E905294E1; Sat, 7 Apr 2018 18:39:21 +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 72B18294D5 for ; Sat, 7 Apr 2018 18:39:20 +0000 (UTC) Received: (qmail 11934 invoked by uid 550); 7 Apr 2018 18:38:51 -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 11841 invoked from network); 7 Apr 2018 18:38:49 -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=B8gND4Up2KAfvNWR9ywbIfoZ90ohlUVZD+E0nHmN7N+ZJcngAuCX+Q+JZy7nqSXfIn 3bB9i77wgD+VrXWVMlSUHO8sbDUWKdzd5GbfMWpVZDxLCVuFJNeeCRfwmnXjOriDKxIC PvXWlB2AjKB3achIM5B3qaK4iYzjIpTrpT9RTt7nkDQ2lW61+KfPze4on/lRGp8NU7hp /Mtzv/9VapjBFT+VYAxdCPSEidvoa5lsXnWMYOi5CNL1dpMjuNXrSWW1e7LhTBnmgQql /dkppdci8loaetB+efJDDc6WzFf6n8/g2OJCcSKDS43spOXEY7+btgcSYYEpA0ZKTw2k u07g== 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=j8iKTLYccB2Y0gYa975awzvFjzB3E54KzBF/qS/4tx+4KxfCL4zGLNPQr5cuVEOcaz ovR5cfrViOjtHtc58X3gBQLcLzLKs1RgsigLo1FHr+EVJCLYFEG9ANsRhgBfAaLqVQIS uIx7y/GfLGbf3xlLr4jLBEM/DWtKWxsGnRYD3Jo7ztP78eouL4+YtEJol3o3B32rDML+ 4HeA42C1fxgTADFpOyCgqGqx06pK52JzOTcMEToqUTMitqj/0Kwb1rgLADoy19m9LpzN WLDIu5SalsxBW8jB+l2HloD/0RsCSuRpjpJR4asG8vBNNjPYhlrEHZxzbw1S52GaITQL TSMQ== X-Gm-Message-State: ALQs6tCia6bMTRJbPEQgW5dHtPUT47Hh841pcdaUiUcfwMh6Zx0WZwQn yn6YedvN7HVJeGrbIF5WTEI= X-Google-Smtp-Source: AIpwx4/mCLFBLbyNJ4SEV/0snXkvoZx/fqk55uce5WAy4nDrvxzx9XK+qPFdG1tTBoLfrZ93WDa3Tw== X-Received: by 10.28.202.16 with SMTP id a16mr18912142wmg.52.1523126318196; Sat, 07 Apr 2018 11:38:38 -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: Sat, 7 Apr 2018 20:38:18 +0200 Message-Id: <1523126303-23205-2-git-send-email-s.mesoraca16@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1523126303-23205-1-git-send-email-s.mesoraca16@gmail.com> References: <1523126303-23205-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,