From patchwork Sun Aug 11 22:59:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 11089189 Return-Path: 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 C32CB1399 for ; Sun, 11 Aug 2019 22:59:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5DE127F2B for ; Sun, 11 Aug 2019 22:59:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9691227F82; Sun, 11 Aug 2019 22:59:27 +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 2D15127F2B for ; Sun, 11 Aug 2019 22:59:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726155AbfHKW70 (ORCPT ); Sun, 11 Aug 2019 18:59:26 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:37012 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbfHKW7Z (ORCPT ); Sun, 11 Aug 2019 18:59:25 -0400 Received: by mail-wm1-f65.google.com with SMTP id z23so10184432wmf.2 for ; Sun, 11 Aug 2019 15:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=/tNZwOFvVQgW3Q3LEkFArhFgiZFUVCSFYAfHFcwsvMY=; b=MGN4ecvbcpj5SpsE+uvsZTJQgIEL1VaeVc/I3SK5gWS96Mah4Whgg/utWV4jVinjEu u7gbnlDqL7meLp4IeUops9LBq3hn0VXLoD1xj8Sd21XvG5Vd6c/qkQD8Emy0D7RnFnhm t2FXq/tOb9Dg6Xt2sEt6+Wz4W5g5FWC8ljYKH5A2G6UdRJP6nOK3miln1Ww7lulTmCXQ Z42/5D4laLs9MZX1DZSWaE/LTjpG1Js2o0fo1uX74IIAPu1dQlOl570X00t/wd5LRdKi huamKsANG1S9kXA5iIw30QWmyd6LQynz2T/himOPcmCIAN0xMRrv/6XRdTh9LhI/DxYm Tsjg== 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; bh=/tNZwOFvVQgW3Q3LEkFArhFgiZFUVCSFYAfHFcwsvMY=; b=XwG8CFXm9A2Bns5h6f3mUrMGkr18KrSXwYItxnWN9WHVbyG6yAj9O6U4iNAtQbTJzy Zp8OnPDAX7qq893KgCjrV0QNYoRVwciYs7mflP/LIgsvj50/gQpMAEuWqdQfj76qc5JM noqWT3jY/Jfo+/a40lzHAUcfjeWNGnXpDoUycm0LekqV2VobBi9N2dES4PEFbn4UR0Lr Xtoz1atvRLkzvHQ2CpZD0gFutaswPeH6oAayb8CDpOIfFdLlDAPnimvM2/JSa6FL/oDx ZtkAu42P2JRgjgo6f7OkqyIJ0I4pP9B9Fauoj3/hRpoh88V29XIH+vUAeCXHSgLK5/nv hqHg== X-Gm-Message-State: APjAAAXZ9lNG8TNqzpzSW9HYUaQWEw5ogRx6bxr8F1jix1az4d/FRETA 8jRTb4NufVRLyfqjZGE+GVrQO6QgQWpu+A== X-Google-Smtp-Source: APXvYqznwY/uZTeoSeceh+sD2Djv7+dWTnJNlomh9LFkwDUmLD/mtxciOewWEbxvUzNnDtqae3DZNQ== X-Received: by 2002:a1c:1d08:: with SMTP id d8mr23598731wmd.22.1565564363227; Sun, 11 Aug 2019 15:59:23 -0700 (PDT) Received: from localhost.localdomain ([2a02:587:a407:da00:5df1:4fcc:7bd1:4860]) by smtp.gmail.com with ESMTPSA id a17sm5930888wmm.47.2019.08.11.15.59.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2019 15:59:22 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, ebiggers@kernel.org, Ard Biesheuvel Subject: [PATCH v2 0/3] crypto: aegis128 followup Date: Mon, 12 Aug 2019 01:59:09 +0300 Message-Id: <20190811225912.19412-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This series resubmits the aegis128 SIMD patches that were reverted due to the fact that the compiler's optimization behavior wrt variables with static linkage does not turn out to guarantee that function calls that are conditional on the value of such a variable are optimized away if the value is a compile time constant and the condition evaluates to false at compile time as well. Changes since v1: - minor tweaks to #2 to drop a memset() invocation from the decrypt path, and some temp vars in various places - update the NEON code in #3 so it builds with Clang as well as GCC (and drop the RFC annotation) Patch #1 reintroduces the changes to the generic code to permit SIMD routines to be attached to the aegis128 driver. This time, the conditional check is pulled into a helper function which collapses to 'return false' if the CONFIG_CRYPTO_AEGIS128_SIMD Kconfig symbol is not set. (This has been confirmed by one of the reporters of the original issue as sufficient to address the problem). Patch #2 is mostly unchanged wrt the version that got reverted, only some inline annotations were added back. Patch #3 is new and implements the SIMD routines for arm64 without using the optional AES instructions, but using plain SIMD arithmetic instead. This is much slower than AES instructions, but still substantially more efficient than table based scalar AES on systems where memory accesses are expensive, such as the Raspberry Pi 3 (which does not implement the AES instructions) Ard Biesheuvel (3): crypto: aegis128 - add support for SIMD acceleration crypto: aegis128 - provide a SIMD implementation based on NEON intrinsics crypto: arm64/aegis128 - implement plain NEON version crypto/Kconfig | 5 + crypto/Makefile | 20 ++ crypto/{aegis128.c => aegis128-core.c} | 52 ++++- crypto/aegis128-neon-inner.c | 212 ++++++++++++++++++++ crypto/aegis128-neon.c | 49 +++++ 5 files changed, 334 insertions(+), 4 deletions(-) rename crypto/{aegis128.c => aegis128-core.c} (89%) create mode 100644 crypto/aegis128-neon-inner.c create mode 100644 crypto/aegis128-neon.c