From patchwork Tue Jun 20 09:29:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 105941 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1274442qgd; Tue, 20 Jun 2017 02:36:50 -0700 (PDT) X-Received: by 10.84.214.22 with SMTP id h22mr6110777pli.127.1497951409927; Tue, 20 Jun 2017 02:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497951409; cv=none; d=google.com; s=arc-20160816; b=GxBj/whcVXmdkiuTXbSqACw6g+f8QgQvI4IQrySTpyUyN56hcA2WG+LNGmWZrPZmt9 bKvZrpWy4TFZU3DABglWWhwROjk2DlfKphTswF5Bpzllq8MGCQfW88CdwULJ334f6qra NQMQtCcAxUGabvbMILybyysVRzKKpRGz9k6MSc2j5zOML9P5lFVYpwfSOTy7XyXUO9Wa BisNhafFW92LMEGd3yMLexT+hQc0y3GqWcMpwV/p449kd//N7V9k4qAsnVb/R2OApTgm u+5x1hCUeiDk8PppeuBA/39FvS3a2xjIiAG5R70XB8Y+JUmc94zTwgzFdzceZc7CzH1P MFnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=5T8+8O6HjmsfaB+zGABg1aaZRYEeqs3KD/qw/uzfBDI=; b=R+48qGSWUJuP3+jxBLmxLaddaJ4gtX3PBZHiq93I7gJrpdMLbVPGCKG9Fb1T8qc3de 4qXyHKMWGXQPtxJpDaOwMFqA7MQhV8zYm6makqp0lIG2LSPXrEqvnjw7bENxU7DXR5CH GyLT2meBjipJIMQrD4s8M7QuCZhDnLf2wBKsN5XL5xSGG2pTX1AUI/Ft9S3vQeTYr+oz 7I5wjNAQzq9JViAog5CoGYe9/GIh9miGGtBdt8bZq2fShpt82fC8Fr2vMEf46NNS9gNF 4+znnjFRZ4JnGfBm8vIpEOEAjVUXFJsp6yrbPWdnxwSrfLJD9yFbyTtxfDKS3qOKZ4wJ gCvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=JiFSMZg4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 189si9722394pfa.495.2017.06.20.02.36.49; Tue, 20 Jun 2017 02:36:49 -0700 (PDT) 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=pass header.i=@linaro.org header.b=JiFSMZg4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751083AbdFTJak (ORCPT + 1 other); Tue, 20 Jun 2017 05:30:40 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:36983 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752049AbdFTJ3N (ORCPT ); Tue, 20 Jun 2017 05:29:13 -0400 Received: by mail-wm0-f50.google.com with SMTP id d73so14418313wma.0 for ; Tue, 20 Jun 2017 02:29:12 -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:in-reply-to:references; bh=5T8+8O6HjmsfaB+zGABg1aaZRYEeqs3KD/qw/uzfBDI=; b=JiFSMZg4VtnN2FBouG0HjZ0PTN9xp79Ko6lE9o4pycN91555HQuA1n4S5kngSwNzYg KL/i2Lw6ZhOhwu4jxQuDCAsVNbTbDMGO0tjzwBWnx3n+nxzNnE+rK2zESMM6LdLDxMuh wFHYs7GpyWeoYciJ+tFQlaiQ75dm+yjDAWSs4= 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=5T8+8O6HjmsfaB+zGABg1aaZRYEeqs3KD/qw/uzfBDI=; b=skBZXkAgad9RTk67p/BWH5KbtQaEpr/79OkpKg3yj+GRG6X8RJL2XpKiIoDi6cwlhV cgx12Eadc0elddod0cQ4/lukobtqnWIOQRo0/QTHjAClIc0GJznRaHSHTxASZpv9C1qg ZsoMYZtY50vbRAujYDRWPR/gc9UatTdLcD+OK8mn5sPRSZo3P/JCIIbnYjzN7nSTlcHU DJe7HfvWvu79uT/KxtpACTILHbgcngU4ROGHCY2T9unY2o9ZhSt+SAQoGMmr4iyCju0V UcN0LOftmbhNnCCzLTPxO1Pa8ZfRlRr1i1gZvWXLYCDBURXBHhO6JBNqQpgRsXnjbSHs UJfQ== X-Gm-Message-State: AKS2vOxltQU3h61JfIwdBwf42hO/Q1Ia0Vg59kdaHE3NIUH6wPd7huLM 2ekoMgZXWEW4I/uAQpBWyQ== X-Received: by 10.80.145.25 with SMTP id e25mr20622094eda.8.1497950951997; Tue, 20 Jun 2017 02:29:11 -0700 (PDT) Received: from localhost.localdomain (101-126-045-062.dynamic.caiway.nl. [62.45.126.101]) by smtp.gmail.com with ESMTPSA id a52sm6033452eda.44.2017.06.20.02.29.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:29:11 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, nico@linaro.org, ebiggers3@gmail.com, Ard Biesheuvel Subject: [PATCH v3 7/7] crypto: aes - allow generic AES to be replaced by fixed time AES Date: Tue, 20 Jun 2017 11:29:00 +0200 Message-Id: <1497950940-24243-8-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497950940-24243-1-git-send-email-ard.biesheuvel@linaro.org> References: <1497950940-24243-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On systems where a small memory footprint is important, the generic AES code with its 16 KB of lookup tables and fully unrolled encrypt and decrypt routines may be an unnecessary burden, especially given that modern SoCs often have dedicated instructions for AES. And even if they don't, a time invariant implementation may be preferred over a fast one that may be susceptible to cache timing attacks. So allow the declared dependency of other subsystems on AES to be fulfilled by either the generic table based AES or by the much smaller generic time invariant implementation. Signed-off-by: Ard Biesheuvel --- crypto/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/crypto/Kconfig b/crypto/Kconfig index 87d9e03dcb74..dd0bc0d84789 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -899,7 +899,8 @@ config CRYPTO_AES_CORE config CRYPTO_AES tristate - select CRYPTO_AES_GENERIC + select CRYPTO_AES_GENERIC if (CRYPTO_AES=y && CRYPTO_AES_TI != y) || \ + (CRYPTO_AES=m && !CRYPTO_AES_TI) config CRYPTO_AES_GENERIC tristate "Generic table based AES cipher"