]> git.ipfire.org Git - thirdparty/linux.git/commit
lib/crypto: powerpc/ghash: Migrate optimized code into library
authorEric Biggers <ebiggers@kernel.org>
Thu, 19 Mar 2026 06:17:12 +0000 (23:17 -0700)
committerEric Biggers <ebiggers@kernel.org>
Mon, 23 Mar 2026 23:44:29 +0000 (16:44 -0700)
commit73f315c15d6ec1ef33202e7253af90dd44ff4a3b
tree52c7f7e2e54d594ee7d1d3d96119ec6932f7334b
parent631a84e49e5b16ab83098350c2695d806ad54d23
lib/crypto: powerpc/ghash: Migrate optimized code into library

Remove the "p8_ghash" crypto_shash algorithm.  Move the corresponding
assembly code into lib/crypto/, and wire it up to the GHASH library.

This makes the GHASH library be optimized for POWER8.  It also greatly
reduces the amount of powerpc-specific glue code that is needed, and it
fixes the issue where this optimized GHASH code was disabled by default.

Note that previously the C code defined the POWER8 GHASH key format as
"u128 htable[16]", despite the assembly code only using four entries.
Fix the C code to use the correct key format.  To fulfill the library
API contract, also make the key preparation work in all contexts.

Note that the POWER8 assembly code takes the accumulator in GHASH
format, but it actually byte-reflects it to get it into POLYVAL format.
The library already works with POLYVAL natively.  For now, just wire up
this existing code by converting it to/from GHASH format in C code.
This should be cleaned up to eliminate the unnecessary conversion later.

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20260319061723.1140720-12-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
12 files changed:
MAINTAINERS
arch/powerpc/crypto/Kconfig
arch/powerpc/crypto/Makefile
arch/powerpc/crypto/aesp8-ppc.h
arch/powerpc/crypto/ghash.c [deleted file]
arch/powerpc/crypto/vmx.c
include/crypto/gf128hash.h
lib/crypto/Kconfig
lib/crypto/Makefile
lib/crypto/powerpc/.gitignore
lib/crypto/powerpc/gf128hash.h [new file with mode: 0644]
lib/crypto/powerpc/ghashp8-ppc.pl [moved from arch/powerpc/crypto/ghashp8-ppc.pl with 98% similarity]