diff options
| author | Eric Biggers <ebiggers@kernel.org> | 2025-11-09 15:47:17 -0800 |
|---|---|---|
| committer | Eric Biggers <ebiggers@kernel.org> | 2025-11-11 11:03:38 -0800 |
| commit | 3d176751e541362ff40c2478d6a2de41f8c62318 (patch) | |
| tree | c56c111a0f2af61bc38cc7163293601958a2094b /lib/crypto/Makefile | |
| parent | e1c360849794c2e638cff5486e4ee256568dd3b3 (diff) | |
lib/crypto: polyval: Add POLYVAL library
Add support for POLYVAL to lib/crypto/.
This will replace the polyval crypto_shash algorithm and its use in the
hctr2 template, simplifying the code and reducing overhead.
Specifically, this commit introduces the POLYVAL library API and a
generic implementation of it. Later commits will migrate the existing
architecture-optimized implementations of POLYVAL into lib/crypto/ and
add a KUnit test suite.
I've also rewritten the generic implementation completely, using a more
modern approach instead of the traditional table-based approach. It's
now constant-time, requires no precomputation or dynamic memory
allocations, decreases the per-key memory usage from 4096 bytes to 16
bytes, and is faster than the old polyval-generic even on bulk data
reusing the same key (at least on x86_64, where I measured 15% faster).
We should do this for GHASH too, but for now just do it for POLYVAL.
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20251109234726.638437-3-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'lib/crypto/Makefile')
| -rw-r--r-- | lib/crypto/Makefile | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile index 5515e73bfd5e..055e44008805 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -198,6 +198,14 @@ clean-files += arm/poly1305-core.S \ ################################################################################ +obj-$(CONFIG_CRYPTO_LIB_POLYVAL) += libpolyval.o +libpolyval-y := polyval.o +ifeq ($(CONFIG_CRYPTO_LIB_POLYVAL_ARCH),y) +CFLAGS_polyval.o += -I$(src)/$(SRCARCH) +endif + +################################################################################ + obj-$(CONFIG_CRYPTO_LIB_SHA1) += libsha1.o libsha1-y := sha1.o ifeq ($(CONFIG_CRYPTO_LIB_SHA1_ARCH),y) |
