All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: linux-crypto@vger.kernel.org
Cc: herbert@gondor.apana.org.au, ebiggers@google.com,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH v2 18/26] crypto: arm64/aes-ce-cipher - use AES library as fallback
Date: Sat, 22 Jun 2019 21:34:19 +0200	[thread overview]
Message-ID: <20190622193427.20336-19-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20190622193427.20336-1-ard.biesheuvel@linaro.org>

Instead of calling into the table based scalar AES code in situations
where the SIMD unit may not be used, use the generic AES code, which
is more appropriate since it is less likely to be susceptible to
timing attacks.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm64/crypto/Kconfig           | 2 +-
 arch/arm64/crypto/aes-ce-glue.c     | 7 ++-----
 arch/arm64/crypto/aes-cipher-glue.c | 3 ---
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/crypto/Kconfig b/arch/arm64/crypto/Kconfig
index 66dea518221c..4922c4451e7c 100644
--- a/arch/arm64/crypto/Kconfig
+++ b/arch/arm64/crypto/Kconfig
@@ -73,7 +73,7 @@ config CRYPTO_AES_ARM64_CE
 	tristate "AES core cipher using ARMv8 Crypto Extensions"
 	depends on ARM64 && KERNEL_MODE_NEON
 	select CRYPTO_ALGAPI
-	select CRYPTO_AES_ARM64
+	select CRYPTO_LIB_AES
 
 config CRYPTO_AES_ARM64_CE_CCM
 	tristate "AES in CCM mode using ARMv8 Crypto Extensions"
diff --git a/arch/arm64/crypto/aes-ce-glue.c b/arch/arm64/crypto/aes-ce-glue.c
index 3213843fcb46..6890e003b8f1 100644
--- a/arch/arm64/crypto/aes-ce-glue.c
+++ b/arch/arm64/crypto/aes-ce-glue.c
@@ -23,9 +23,6 @@ MODULE_DESCRIPTION("Synchronous AES cipher using ARMv8 Crypto Extensions");
 MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>");
 MODULE_LICENSE("GPL v2");
 
-asmlinkage void __aes_arm64_encrypt(u32 *rk, u8 *out, const u8 *in, int rounds);
-asmlinkage void __aes_arm64_decrypt(u32 *rk, u8 *out, const u8 *in, int rounds);
-
 struct aes_block {
 	u8 b[AES_BLOCK_SIZE];
 };
@@ -54,7 +51,7 @@ static void aes_cipher_encrypt(struct crypto_tfm *tfm, u8 dst[], u8 const src[])
 	struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm);
 
 	if (!crypto_simd_usable()) {
-		__aes_arm64_encrypt(ctx->key_enc, dst, src, num_rounds(ctx));
+		aes_encrypt(ctx, dst, src);
 		return;
 	}
 
@@ -68,7 +65,7 @@ static void aes_cipher_decrypt(struct crypto_tfm *tfm, u8 dst[], u8 const src[])
 	struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm);
 
 	if (!crypto_simd_usable()) {
-		__aes_arm64_decrypt(ctx->key_dec, dst, src, num_rounds(ctx));
+		aes_decrypt(ctx, dst, src);
 		return;
 	}
 
diff --git a/arch/arm64/crypto/aes-cipher-glue.c b/arch/arm64/crypto/aes-cipher-glue.c
index 0e90b06ebcec..bf32cc6489e1 100644
--- a/arch/arm64/crypto/aes-cipher-glue.c
+++ b/arch/arm64/crypto/aes-cipher-glue.c
@@ -13,10 +13,7 @@
 #include <linux/module.h>
 
 asmlinkage void __aes_arm64_encrypt(u32 *rk, u8 *out, const u8 *in, int rounds);
-EXPORT_SYMBOL(__aes_arm64_encrypt);
-
 asmlinkage void __aes_arm64_decrypt(u32 *rk, u8 *out, const u8 *in, int rounds);
-EXPORT_SYMBOL(__aes_arm64_decrypt);
 
 static void aes_arm64_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
 {
-- 
2.20.1


  parent reply	other threads:[~2019-06-22 19:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-22 19:34 [PATCH v2 00/26]crypto: AES cleanup Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 01/26] crypto: arm/aes-ce - cosmetic/whitespace cleanup Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 02/26] crypto: aes - rename local routines to prevent future clashes Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 03/26] crypto: aes/fixed-time - align key schedule with other implementations Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 04/26] crypto: aes - create AES library based on the fixed time AES code Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 05/26] crypto: x86/aes-ni - switch to generic for fallback and key routines Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 06/26] crypto: x86/aes - drop scalar assembler implementations Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 07/26] crypto: padlock/aes - switch to library version of key expansion routine Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 08/26] crypto: cesa/aes " Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 09/26] crypto: safexcel/aes " Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 10/26] crypto: arm64/ghash - switch to AES library Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 11/26] crypto: arm/aes-neonbs - switch to library version of key expansion routine Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 12/26] crypto: arm64/aes-ccm - switch to AES library Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 13/26] crypto: arm64/aes-neonbs - switch to library version of key expansion routine Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 14/26] crypto: arm64/aes-ce " Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 15/26] crypto: generic/aes - drop key expansion routine in favor of library version Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 16/26] crypto: ctr - add helper for performing a CTR encryption walk Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 17/26] crypto: aes - move sync ctr(aes) to AES library and generic helper Ard Biesheuvel
2019-06-22 19:34 ` Ard Biesheuvel [this message]
2019-06-22 19:34 ` [PATCH v2 19/26] crypto: aes/arm - use native endiannes for key schedule Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 20/26] crypto: arm/aes-ce - provide a synchronous version of ctr(aes) Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 21/26] crypto: arm/aes-neonbs " Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 22/26] crypto: arm/ghash - provide a synchronous version Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 23/26] bluetooth: switch to AES library Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 24/26] crypto: amcc/aes - switch to AES library for GCM key derivation Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 25/26] crypto: ccp - move to AES library for CMAC " Ard Biesheuvel
2019-06-22 19:34 ` [PATCH v2 26/26] crypto: chelsio/aes - replace AES cipher calls with library calls Ard Biesheuvel
2019-06-26  4:11 ` [PATCH v2 00/26]crypto: AES cleanup Eric Biggers
2019-06-27 10:03   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190622193427.20336-19-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --cc=ebiggers@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.