]> git.ipfire.org Git - thirdparty/linux.git/commit
lib/crypto: powerpc/aes: Migrate POWER8 optimized code into library
authorEric Biggers <ebiggers@kernel.org>
Mon, 12 Jan 2026 19:20:11 +0000 (11:20 -0800)
committerEric Biggers <ebiggers@kernel.org>
Mon, 12 Jan 2026 19:39:58 +0000 (11:39 -0800)
commit7cf2082e74ce7f4f4b5e14cbe67a194d75e257ef
tree5fab49d5faa476d8bf024d44b504b9a0d893b639
parent0892c91b81cc889c95dc03b095b9f4a6fdf93106
lib/crypto: powerpc/aes: Migrate POWER8 optimized code into library

Move the POWER8 AES assembly code into lib/crypto/, wire the key
expansion and single-block en/decryption functions up to the AES library
API, and remove the superseded "p8_aes" crypto_cipher algorithm.

The result is that both the AES library and crypto_cipher APIs are now
optimized for POWER8, whereas previously only crypto_cipher was (and
optimizations weren't enabled by default, which this commit fixes too).

Note that many of the functions in the POWER8 assembly code are still
used by the AES mode implementations in arch/powerpc/crypto/.  For now,
just export these functions.  These exports will go away once the AES
modes are migrated to the library as well.  (Trying to split up the
assembly file seemed like much more trouble than it would be worth.)

Another challenge with this code is that the POWER8 assembly code uses a
custom format for the expanded AES key.  Since that code is imported
from OpenSSL and is also targeted to POWER8 (rather than POWER9 which
has better data movement and byteswap instructions), that is not easily
changed.  For now I've just kept the custom format.  To maintain full
correctness, this requires executing some slow fallback code in the case
where the usability of VSX changes between key expansion and use.  This
should be tolerable, as this case shouldn't happen in practice.

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20260112192035.10427-14-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
arch/powerpc/crypto/Makefile
arch/powerpc/crypto/aes.c [deleted file]
arch/powerpc/crypto/aesp8-ppc.h
arch/powerpc/crypto/vmx.c
include/crypto/aes.h
lib/crypto/Kconfig
lib/crypto/Makefile
lib/crypto/powerpc/.gitignore [new file with mode: 0644]
lib/crypto/powerpc/aes.h
lib/crypto/powerpc/aesp8-ppc.pl [moved from arch/powerpc/crypto/aesp8-ppc.pl with 99% similarity]