]> git.ipfire.org Git - thirdparty/linux.git/commit
lib/crypto: arm/ghash: Migrate optimized code into library
authorEric Biggers <ebiggers@kernel.org>
Thu, 19 Mar 2026 06:17:08 +0000 (23:17 -0700)
committerEric Biggers <ebiggers@kernel.org>
Mon, 23 Mar 2026 22:24:54 +0000 (15:24 -0700)
commit71e59795c9f65a30416ed719b4b4da585df3903a
tree8efffee722a469b36bfd95dd2b404d991c7e10f4
parentca5ff14c1a70e7eeff5705105554ce8bac643937
lib/crypto: arm/ghash: Migrate optimized code into library

Remove the "ghash-neon" 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 on arm (though only with NEON,
not PMULL; for now the goal is just parity with crypto_shash).  It
greatly reduces the amount of arm-specific glue code that is needed, and
it fixes the issue where this optimization was disabled by default.

To integrate the assembly code correctly with the library, make the
following tweaks:

- Change the type of 'blocks' from int to size_t.
- Change the types of 'dg' and 'h' to polyval_elem.  Note that this
  simply reflects the format that the code was already using, at least
  on little endian CPUs.  For big endian CPUs, add byte-swaps.
- Remove the 'head' argument, which is no longer needed.

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20260319061723.1140720-8-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
arch/arm/crypto/Kconfig
arch/arm/crypto/Makefile
arch/arm/crypto/ghash-ce-glue.c
lib/crypto/Kconfig
lib/crypto/Makefile
lib/crypto/arm/gf128hash.h [new file with mode: 0644]
lib/crypto/arm/ghash-neon-core.S [moved from arch/arm/crypto/ghash-neon-core.S with 92% similarity]