Skip to contentSkip to conversation

crypto: arm/aes-ce - build for v8 architecture explicitly

PATCH In review Ard Biesheuvel 2 participants 3 messages Sep 17, 2019 – Oct 1, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 crypto: arm/aes-ce - build for v8 architecture explicitly

From: Ard Biesheuvel <[email protected]>

The NEON/Crypto Extensions based AES implementation for 32-bit ARM can be built in a kernel that targets ARMv6 CPUs and higher, even though the actual code will not be able to run on that generation, but it allows for a portable image to be generated that can will use the special instructions only when they are available.

Since those instructions are part of a FPU profile rather than a CPU profile, we don't override the architecture in the assembler code, and most of the scalar code is simple enough to be ARMv6 compatible. However, that changes with commit c61b1607ed4fbbf2, which introduces calls to the movw/movt instructions, which are v7+ only.

So override the architecture in the .S file to armv8-a, which matches the architecture specification in the crypto-neon-fp-armv8 FPU specificier that we already using. Note that using armv7-a here may trigger an issue with the upcoming Clang 10 release, which no longer permits .arch/.fpu combinations it views as incompatible.

Fixes c61b1607ed4fbbf2("crypto: arm/aes-ce - implement ciphertext stealing ...")
---
 arch/arm/crypto/aes-ce-core.S | 1 +
 1 file changed, 1 insertion(+)
arch/arm/crypto/aes-ce-core.S +1 -0
index b978cdf133af..4d1707388d94 100644
@@ -9,6 +9,7 @@
 #include <asm/assembler.h>
 
 	.text
+	.arch		armv8-a
 	.fpu		crypto-neon-fp-armv8
 	.align		3
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 crypto: arm/aes-ce - add dependency on AES library

From: Ard Biesheuvel <[email protected]>

The ARM accelerated AES driver depends on the new AES library for its non-SIMD fallback so express this in its Kconfig declaration.

---
 arch/arm/crypto/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/crypto/Kconfig +1 -0
index b24df84a1d7a..043b0b18bf7e 100644
@@ -98,6 +98,7 @@ config CRYPTO_AES_ARM_CE
 	tristate "Accelerated AES using ARMv8 Crypto Extensions"
 	depends on KERNEL_MODE_NEON
 	select CRYPTO_BLKCIPHER
+	select CRYPTO_LIB_AES
 	select CRYPTO_SIMD
 	help
 	  Use an implementation of AES in CBC, CTR and XTS modes that uses
Signature · 1 line
2.17.1
maintainer
#2 lore raw
In reply to Ard Biesheuvel
Quoted 22 lines · Ard Biesheuvel

From: Ard Biesheuvel <[email protected]>

The NEON/Crypto Extensions based AES implementation for 32-bit ARM can be built in a kernel that targets ARMv6 CPUs and higher, even though the actual code will not be able to run on that generation, but it allows for a portable image to be generated that can will use the special instructions only when they are available.

Since those instructions are part of a FPU profile rather than a CPU profile, we don't override the architecture in the assembler code, and most of the scalar code is simple enough to be ARMv6 compatible. However, that changes with commit c61b1607ed4fbbf2, which introduces calls to the movw/movt instructions, which are v7+ only.

So override the architecture in the .S file to armv8-a, which matches the architecture specification in the crypto-neon-fp-armv8 FPU specificier that we already using. Note that using armv7-a here may trigger an issue with the upcoming Clang 10 release, which no longer permits .arch/.fpu combinations it views as incompatible.

Quoted 6 lines
Fixes c61b1607ed4fbbf2("crypto: arm/aes-ce - implement ciphertext stealing ...")
---
 arch/arm/crypto/aes-ce-core.S | 1 +
 1 file changed, 1 insertion(+)

All applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt