]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
lib/crypto: x86/polyval: Migrate optimized code into library
authorEric Biggers <ebiggers@kernel.org>
Sun, 9 Nov 2025 23:47:20 +0000 (15:47 -0800)
committerEric Biggers <ebiggers@kernel.org>
Tue, 11 Nov 2025 19:03:38 +0000 (11:03 -0800)
commit4d8da35579daad0392d238460ed7e9629d49ca35
tree23a836244a9b234437c105d555834787ee667a82
parent37919e239ebb2cba573cca56292f7c39fa6d7415
lib/crypto: x86/polyval: Migrate optimized code into library

Migrate the x86_64 implementation of POLYVAL into lib/crypto/, wiring it
up to the POLYVAL library interface.  This makes the POLYVAL library be
properly optimized on x86_64.

This drops the x86_64 optimizations of polyval in the crypto_shash API.
That's fine, since polyval will be removed from crypto_shash entirely
since it is unneeded there.  But even if it comes back, the crypto_shash
API could just be implemented on top of the library API, as usual.

Adjust the names and prototypes of the assembly functions to align more
closely with the rest of the library code.

Also replace a movaps instruction with movups to remove the assumption
that the key struct is 16-byte aligned.  Users can still align the key
if they want (and at least in this case, movups is just as fast as
movaps), but it's inconvenient to require it.

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20251109234726.638437-6-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
arch/x86/crypto/Kconfig
arch/x86/crypto/Makefile
arch/x86/crypto/polyval-clmulni_glue.c [deleted file]
include/crypto/polyval.h
lib/crypto/Kconfig
lib/crypto/Makefile
lib/crypto/x86/polyval-pclmul-avx.S [moved from arch/x86/crypto/polyval-clmulni_asm.S with 91% similarity]
lib/crypto/x86/polyval.h [new file with mode: 0644]