crypto: arm/ghash - implement fused AES/GHASH implementation of GCM
Subsystems (2)
PATCH 1/1 crypto: arm/ghash - implement fused AES/GHASH implementation of GCM
On 32-bit ARM, AES in GCM mode takes full advantage of the ARMv8 Crypto Extensions when available, resulting in a performance of 6-7 cycles per byte for typical IPsec frames on cores such as Cortex-A53, using the generic GCM template encapsulating the accelerated AES-CTR and GHASH implementations.
At such high rates, any time spent copying data or doing other poorly optimized work in the generic layer hurts disproportionately, and we can get a significant performance improvement by combining the optimized AES-CTR and GHASH implementations into a single one.
On Cortex-A53, this results in a performance improvement of around 70%, or 4.2 cycles per byte for AES-256-GCM-128 with RFC4106 encapsulation. The fastest mode on this core is bare AES-128-GCM using 8k blocks, which manages 2.66 cycles per byte.
---
Note: this patch depends on the softirq context patches for kernel mode NEON I sent last week. More specifically, this implements a sync AEAD that does not implement a !simd fallback, as AEADs are not callable in IRQ context anyway.
arch/arm/crypto/Kconfig | 2 + arch/arm/crypto/ghash-ce-core.S | 381 +++++++++++++++++++- arch/arm/crypto/ghash-ce-glue.c | 350 +++++++++++++++++- 3 files changed, 718 insertions(+), 15 deletions(-)
arch/arm/crypto/Kconfig +2 -0
@@ -16,9 +16,11 @@ config CRYPTO_CURVE25519_NEON config CRYPTO_GHASH_ARM_CE tristate "Hash functions: GHASH (PMULL/NEON/ARMv8 Crypto Extensions)" depends on KERNEL_MODE_NEON + select CRYPTO_AEAD select CRYPTO_HASH select CRYPTO_CRYPTD select CRYPTO_GF128MUL + select CRYPTO_LIB_AES help GCM GHASH function (NIST SP800-38D)
arch/arm/crypto/ghash-ce-core.S +368 -13
448 lines not on this page · raw message
arch/arm/crypto/ghash-ce-glue.c +348 -2
403 lines not on this page · raw message
Signature · 1 line
2.35.1
Herbert Xu
maintainerQuoted 23 lines · Ard Biesheuvel
On 32-bit ARM, AES in GCM mode takes full advantage of the ARMv8 Crypto Extensions when available, resulting in a performance of 6-7 cycles per byte for typical IPsec frames on cores such as Cortex-A53, using the generic GCM template encapsulating the accelerated AES-CTR and GHASH implementations.
At such high rates, any time spent copying data or doing other poorly optimized work in the generic layer hurts disproportionately, and we can get a significant performance improvement by combining the optimized AES-CTR and GHASH implementations into a single one.
On Cortex-A53, this results in a performance improvement of around 70%, or 4.2 cycles per byte for AES-256-GCM-128 with RFC4106 encapsulation. The fastest mode on this core is bare AES-128-GCM using 8k blocks, which manages 2.66 cycles per byte.
Signed-off-by Ard Biesheuvel <[email protected]>---
Note: this patch depends on the softirq context patches for kernel mode NEON I sent last week. More specifically, this implements a sync AEAD that does not implement a !simd fallback, as AEADs are not callable in IRQ context anyway.
Quoted 4 lines
arch/arm/crypto/Kconfig | 2 + arch/arm/crypto/ghash-ce-core.S | 381 +++++++++++++++++++- arch/arm/crypto/ghash-ce-glue.c | 350 +++++++++++++++++- 3 files changed, 718 insertions(+), 15 deletions(-)
Patch 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
Herbert Xu
maintainerQuoted 24 lines · Herbert Xu
Quoted 23 lines · Ard Biesheuvel
On 32-bit ARM, AES in GCM mode takes full advantage of the ARMv8 Crypto Extensions when available, resulting in a performance of 6-7 cycles per byte for typical IPsec frames on cores such as Cortex-A53, using the generic GCM template encapsulating the accelerated AES-CTR and GHASH implementations.
At such high rates, any time spent copying data or doing other poorly optimized work in the generic layer hurts disproportionately, and we can get a significant performance improvement by combining the optimized AES-CTR and GHASH implementations into a single one.
On Cortex-A53, this results in a performance improvement of around 70%, or 4.2 cycles per byte for AES-256-GCM-128 with RFC4106 encapsulation. The fastest mode on this core is bare AES-128-GCM using 8k blocks, which manages 2.66 cycles per byte.
Signed-off-by Ard Biesheuvel <[email protected]>---
Note: this patch depends on the softirq context patches for kernel mode NEON I sent last week. More specifically, this implements a sync AEAD that does not implement a !simd fallback, as AEADs are not callable in IRQ context anyway.
Quoted 6 lines
Quoted 4 lines
arch/arm/crypto/Kconfig | 2 + arch/arm/crypto/ghash-ce-core.S | 381 +++++++++++++++++++- arch/arm/crypto/ghash-ce-glue.c | 350 +++++++++++++++++- 3 files changed, 718 insertions(+), 15 deletions(-)Patch applied. Thanks.
Oops, this email was an error. This patch hasn't been applied as it was already superceded.
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