From patchwork Sat Jan 28 23:33:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 92777 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp848774qgi; Sat, 28 Jan 2017 15:33:54 -0800 (PST) X-Received: by 10.98.23.207 with SMTP id 198mr16312880pfx.103.1485646434668; Sat, 28 Jan 2017 15:33:54 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z21si5132908pgi.26.2017.01.28.15.33.54; Sat, 28 Jan 2017 15:33:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752442AbdA1Xdx (ORCPT + 1 other); Sat, 28 Jan 2017 18:33:53 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:33408 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752120AbdA1Xdx (ORCPT ); Sat, 28 Jan 2017 18:33:53 -0500 Received: by mail-wm0-f50.google.com with SMTP id d140so23829727wmd.0 for ; Sat, 28 Jan 2017 15:33:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=2oYSXy8XIlv8Z6Ks0dgh4oA1EPNyp11r2nb+A3ei1ro=; b=gcmE13hBYhXw0F9wH61LVEu5v4uKg2vihJaAP/Y8Dv3UYDoh122rv6fn0hRnG4Y5N0 uzyJdU9lGCpYRVuUPUij+SA4Q+tboS6ZwnUT/BEgDviAyMxSbm2ia77gawfxqvvAqUvd uFi1K+ipnBv6QhHyELl2wMtmnTU4pCLRRttHg= 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=2oYSXy8XIlv8Z6Ks0dgh4oA1EPNyp11r2nb+A3ei1ro=; b=oV8M0CC4PFg3FhnlI4sGrBbbd+kXkpFB525BL+7mgNdrThIjvjizL2BLVRsSy6jxz8 k5n+nHVhBfSC4gez1IUm7g0qzcyaaE8r/XTh/a1m7yGv7irQQs9VhRJhUmY9s3tzjzgB X9127AxOpowctj++Qk/YCL70EPU5uId3Kfo46/qXUOonRT3a4WHLkt4ryyk+HN8kR07k UsQJu5OpPhl/cybTHO18H2l4apE/Nw9q+/55Mh/tq46M1getPMu1OdxOgxZhvnWHYb2k O1T+6LbOX7nAqne/lh1GSJs0cr0C3vqN3isQEmmmrEpwtNyVi55ae29TjwJrIj654Vbq 5NXg== X-Gm-Message-State: AIkVDXL/VIOUtCjapVsmxyTnbeGuHHRG58ZfwDIwoWpAW2RNon7/rpGUsIJekOECWNGqCb+B X-Received: by 10.223.153.144 with SMTP id y16mr12789711wrb.81.1485646431454; Sat, 28 Jan 2017 15:33:51 -0800 (PST) Received: from localhost.localdomain ([160.163.215.165]) by smtp.gmail.com with ESMTPSA id 40sm15141221wry.22.2017.01.28.15.33.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 28 Jan 2017 15:33:50 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, herbert@gondor.apana.org.au, Ard Biesheuvel Subject: [PATCH v2 0/4] crypto: time invariant AES for CCM (and GCM/CTR) Date: Sat, 28 Jan 2017 23:33:29 +0000 Message-Id: <1485646413-17491-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This series is primarily directed at improving the performance and security of CCM on the Rasperry Pi 3. This involves splitting the MAC handling of CCM into a separate driver so that we can efficiently replace it by something else using the ordinary algo resolution machinery. Patch #1 adds some testcases for cbcmac(aes), which will be introduced later. Patch #2 replaces the open coded CBC MAC hashing routines in the CCM driver with calls to a cbcmac() hash, and implements a template for producing such transforms. This eliminates all the fuzzy scatterwalk code as well. Patch #3 implements cbcmac(aes) using NEON on arm64 Patch #4 is an RFC patch that implements ctr(aes) and cbcmac(aes) in a way that is intended to eliminate observeable data dependent latencies in AES processing, by replacing the usual 16 KB of lookup tables with a single Sbox that is prefetched before processing each block. It is 50% slower than generic AES, but this may be acceptable in many cases. Changes since v1: - remove ilen, and add missing flags assignment (#2) - deal with zero cryptlen (#2) - use correctly sized dg[] array in desc ctx (#3, #4) - fix bug in update routine (#3) - various other tweaks Ard Biesheuvel (4): crypto: testmgr - add test cases for cbcmac(aes) crypto: ccm - switch to separate cbcmac driver crypto: arm64/aes - add NEON and Crypto Extension CBC-MAC driver crypto: aes - add generic time invariant AES for CTR/CCM/GCM arch/arm64/crypto/aes-glue.c | 107 ++++++ arch/arm64/crypto/aes-modes.S | 22 ++ crypto/Kconfig | 18 + crypto/Makefile | 1 + crypto/aes_ti.c | 320 +++++++++++++++++ crypto/ccm.c | 376 +++++++++++++------- crypto/testmgr.c | 7 + crypto/testmgr.h | 58 +++ 8 files changed, 772 insertions(+), 137 deletions(-) create mode 100644 crypto/aes_ti.c -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html