From patchwork Sat Jun 22 19:34:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 167497 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2255954ilk; Sat, 22 Jun 2019 12:34:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzqwqhg97K2DpH0JD6CsZZPKIfdEffkch0lVYNnawmBQfSl8iscxrkfyQzeIYL4MesVlDe X-Received: by 2002:a17:90a:ac0e:: with SMTP id o14mr14795054pjq.142.1561232097495; Sat, 22 Jun 2019 12:34:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561232097; cv=none; d=google.com; s=arc-20160816; b=F6Zea9I974L2mwzUqSTFiEx17wEK2mIJbUaKf7O8c/dNJx8lw2oLVl+LG3d+VTtsaw Qy/68aY/Z0+Tm2BodxzNhmYGQDZH1eBrR8yW49lzW6YSk0yeIkWK9slbeN7mfB4hzbDt TJrZCF+7T3OxJ0S6jETDDSVe3xHUoz20SzCYGJp4cD2H7690TUK88t9I4VgBCEqKVVpU V3BP5qjzpvTxr5fhEDD4qGXYROJveOgNKjIrpDQeUfb5hPzLdtmea9JskZCKouTwPYlw eL/DrgZsYhDx4cAxzzK727pN/p/LGU9hFkyyBvUzrfaGXyWEAoa326ft9gdd0/uc9jb6 6bQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0+abpCskFH64uUUzWz6MrJWQeWRPxd08F5mJmqOJSaY=; b=TQkmfsJAKncXa89RFtqbJUxMfy9+ewURBYAUtWajHB1OFYgkwGbkf2LB16LzRohB9A HBkbEC/3cGvRcUvMlH3FV5WYsVchU4PaYPoYeC0F8RNQDAPvpYT9zV7Cgi/QPlEPJmYE vbb20b395CP8ne0/ym5bZMY7iaEK89izzLyXTbRr3GR1aqEozrFNuJOpI0C4n6XPhR6d iVlzKaK0ROgpj9mh+jXKBX55dv2vA7yL0s7aqyukGVLBFl8qo03VcfDv5AnbKe733dTx zHBwr3pPBHpGf1cW0/Itt/huV3TSfsZ0gO/c7VQJHiIPG3DJRPYqkd9cEwGAoICE/F7d szVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tG+zChu1; 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 l21si5511699pgb.409.2019.06.22.12.34.57; Sat, 22 Jun 2019 12:34:57 -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.s=google header.b=tG+zChu1; 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 S1726359AbfFVTe4 (ORCPT + 3 others); Sat, 22 Jun 2019 15:34:56 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34664 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726286AbfFVTe4 (ORCPT ); Sat, 22 Jun 2019 15:34:56 -0400 Received: by mail-wm1-f66.google.com with SMTP id w9so11348986wmd.1 for ; Sat, 22 Jun 2019 12:34:54 -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 :mime-version:content-transfer-encoding; bh=0+abpCskFH64uUUzWz6MrJWQeWRPxd08F5mJmqOJSaY=; b=tG+zChu1TY57HmPBHNOBr8ZTS5Jg27t/A8d8SsgNlYBqbOpiXe7548t9OubC0JH1Xu vrd0A/PhM6ADLoMzc+n3JJFJrOhQg6hB9pRiyT/2zq/LTPGTNfFfYF5rDXCyrx1UWM3W rBoShNAyWgIJxndSg4OARGF1XAUzH8uCn6tXROm+c64j8MlRChJLLa9OEgXcjetsWB1W v1nZHq/9+JCZ2cSIj0o/tgr2z6icIsEQR94XEqa5nfOAuPrTv9TfLFupxvuzUGojLddG I+H2VR+nmGifnSIWqm2zKr5rT9tHNvGXyD4LBeCMiX+9dY6wQBpT4Ez2G1XP29aevM7O ZQkA== 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:mime-version:content-transfer-encoding; bh=0+abpCskFH64uUUzWz6MrJWQeWRPxd08F5mJmqOJSaY=; b=GV9pu5jDEers1HOozJ+Ck+jF3ZZAgBuT7wLg4uJebVv7VX0MyH2rG5WFBIO6QzqVJF rZtGY2Rd7qg4S/VBSvd0VngyBZGCkLmIyQjYqZa7XMs8Ej9bzxLsxyPj4azao0eiQAjg tRC43ioVmRGHaHW+zotkHe4WAVf8ci6Vkyv0FF4zmOgIFrw379MjGycmyIIbN+eB6pe4 90rXbvNfKcK/po2tmKfTt41DMpBId15XZicMKad/A0hn+9odBGWUN5uNO65fXzrnxgNW vtloH9PHXAk34WnnlvBOE2JeNGsGuQutw8a8mW7TYbzpnn8GVJnTTZpNcNLH5HCPsro1 Fcqw== X-Gm-Message-State: APjAAAV1qVYRecuzDs64wABAOdihssSuJYH8y1otOEnKFcBrg2qheNqS 9+BJspt+WAOsLEDhaxXoTSbbYr7ULPtvOMCC X-Received: by 2002:a7b:cbc6:: with SMTP id n6mr6114671wmi.14.1561232093962; Sat, 22 Jun 2019 12:34:53 -0700 (PDT) Received: from sudo.home ([2a01:cb1d:112:6f00:4bd:3f91:4ef8:ae7e]) by smtp.gmail.com with ESMTPSA id h8sm4814494wmf.12.2019.06.22.12.34.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Jun 2019 12:34:53 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, ebiggers@google.com, Ard Biesheuvel Subject: [PATCH v2 13/26] crypto: arm64/aes-neonbs - switch to library version of key expansion routine Date: Sat, 22 Jun 2019 21:34:14 +0200 Message-Id: <20190622193427.20336-14-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190622193427.20336-1-ard.biesheuvel@linaro.org> References: <20190622193427.20336-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Switch to the new AES library that also provides an implementation of the AES key expansion routine. This removes the dependency on the generic AES cipher, allowing it to be omitted entirely in the future. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/Kconfig | 1 + arch/arm64/crypto/aes-neonbs-glue.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/arch/arm64/crypto/Kconfig b/arch/arm64/crypto/Kconfig index c6032bfb44fb..17bf5dc10aad 100644 --- a/arch/arm64/crypto/Kconfig +++ b/arch/arm64/crypto/Kconfig @@ -116,6 +116,7 @@ config CRYPTO_AES_ARM64_BS select CRYPTO_BLKCIPHER select CRYPTO_AES_ARM64_NEON_BLK select CRYPTO_AES_ARM64 + select CRYPTO_LIB_AES select CRYPTO_SIMD endif diff --git a/arch/arm64/crypto/aes-neonbs-glue.c b/arch/arm64/crypto/aes-neonbs-glue.c index 02b65d9eb947..cb8d90f795a0 100644 --- a/arch/arm64/crypto/aes-neonbs-glue.c +++ b/arch/arm64/crypto/aes-neonbs-glue.c @@ -77,7 +77,7 @@ static int aesbs_setkey(struct crypto_skcipher *tfm, const u8 *in_key, struct crypto_aes_ctx rk; int err; - err = crypto_aes_expand_key(&rk, in_key, key_len); + err = aes_expandkey(&rk, in_key, key_len); if (err) return err; @@ -136,7 +136,7 @@ static int aesbs_cbc_setkey(struct crypto_skcipher *tfm, const u8 *in_key, struct crypto_aes_ctx rk; int err; - err = crypto_aes_expand_key(&rk, in_key, key_len); + err = aes_expandkey(&rk, in_key, key_len); if (err) return err; @@ -208,7 +208,7 @@ static int aesbs_ctr_setkey_sync(struct crypto_skcipher *tfm, const u8 *in_key, struct aesbs_ctr_ctx *ctx = crypto_skcipher_ctx(tfm); int err; - err = crypto_aes_expand_key(&ctx->fallback, in_key, key_len); + err = aes_expandkey(&ctx->fallback, in_key, key_len); if (err) return err; @@ -274,7 +274,7 @@ static int aesbs_xts_setkey(struct crypto_skcipher *tfm, const u8 *in_key, return err; key_len /= 2; - err = crypto_aes_expand_key(&rk, in_key + key_len, key_len); + err = aes_expandkey(&rk, in_key + key_len, key_len); if (err) return err;