summaryrefslogtreecommitdiffstats
path: root/crypto/Makefile
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2025-04-12 21:54:14 -0700
committerHerbert Xu <herbert@gondor.apana.org.au>2025-04-16 15:36:24 +0800
commitecaa4be1280a4faf72dc4b6b4f6d867332d5762e (patch)
tree391778d51d75db5691d9fcf5625c0cb0f9146ffb /crypto/Makefile
parentcrypto: powerpc/poly1305 - implement library instead of shash (diff)
downloadlinux-ecaa4be1280a4faf72dc4b6b4f6d867332d5762e.tar.gz
linux-ecaa4be1280a4faf72dc4b6b4f6d867332d5762e.zip
crypto: poly1305 - centralize the shash wrappers for arch code
Following the example of the crc32, crc32c, and chacha code, make the crypto subsystem register both generic and architecture-optimized poly1305 shash algorithms, both implemented on top of the appropriate library functions. This eliminates the need for every architecture to implement the same shash glue code. Note that the poly1305 shash requires that the key be prepended to the data, which differs from the library functions where the key is simply a parameter to poly1305_init(). Previously this was handled at a fairly low level, polluting the library code with shash-specific code. Reorganize things so that the shash code handles this quirk itself. Also, to register the architecture-optimized shashes only when architecture-optimized code is actually being used, add a function poly1305_is_arch_optimized() and make each arch implement it. Change each architecture's Poly1305 module_init function to arch_initcall so that the CPU feature detection is guaranteed to run before poly1305_is_arch_optimized() gets called by crypto/poly1305.c. (In cases where poly1305_is_arch_optimized() just returns true unconditionally, using arch_initcall is not strictly needed, but it's still good to be consistent across architectures.) Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/Makefile')
-rw-r--r--crypto/Makefile3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/Makefile b/crypto/Makefile
index baf5040ca661..5d2f2a28d8a0 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -149,7 +149,8 @@ obj-$(CONFIG_CRYPTO_SEED) += seed.o
obj-$(CONFIG_CRYPTO_ARIA) += aria_generic.o
obj-$(CONFIG_CRYPTO_CHACHA20) += chacha.o
CFLAGS_chacha.o += -DARCH=$(ARCH)
-obj-$(CONFIG_CRYPTO_POLY1305) += poly1305_generic.o
+obj-$(CONFIG_CRYPTO_POLY1305) += poly1305.o
+CFLAGS_poly1305.o += -DARCH=$(ARCH)
obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o
obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o
obj-$(CONFIG_CRYPTO_CRC32C) += crc32c_generic.o