linux/lib/crypto
Eric Biggers b646b782e5 lib/crypto: poly1305: Consolidate into single module
Consolidate the Poly1305 code into a single module, similar to various
other algorithms (SHA-1, SHA-256, SHA-512, etc.):

- Each arch now provides a header file lib/crypto/$(SRCARCH)/poly1305.h,
  replacing lib/crypto/$(SRCARCH)/poly1305*.c.  The header defines
  poly1305_block_init(), poly1305_blocks(), poly1305_emit(), and
  optionally poly1305_mod_init_arch().  It is included by
  lib/crypto/poly1305.c, and thus the code gets built into the single
  libpoly1305 module, with improved inlining in some cases.

- Whether arch-optimized Poly1305 is buildable is now controlled
  centrally by lib/crypto/Kconfig instead of by
  lib/crypto/$(SRCARCH)/Kconfig.  The conditions for enabling it remain
  the same as before, and it remains enabled by default.  (The PPC64 one
  remains unconditionally disabled due to 'depends on BROKEN'.)

- Any additional arch-specific translation units for the optimized
  Poly1305 code, such as assembly files, are now compiled by
  lib/crypto/Makefile instead of lib/crypto/$(SRCARCH)/Makefile.

A special consideration is needed because the Adiantum code uses the
poly1305_core_*() functions directly.  For now, just carry forward that
approach.  This means retaining the CRYPTO_LIB_POLY1305_GENERIC kconfig
symbol, and keeping the poly1305_core_*() functions in separate
translation units.  So it's not quite as streamlined I've done with the
other hash functions, but we still get a single libpoly1305 module.

Note: to see the diff from the arm, arm64, and x86 .c files to the new
.h files, view this commit with 'git show -M10'.

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20250829152513.92459-3-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2025-08-29 09:49:18 -07:00
..
arm lib/crypto: poly1305: Consolidate into single module 2025-08-29 09:49:18 -07:00
arm64 lib/crypto: poly1305: Consolidate into single module 2025-08-29 09:49:18 -07:00
mips lib/crypto: poly1305: Consolidate into single module 2025-08-29 09:49:18 -07:00
mpi lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
powerpc lib/crypto: poly1305: Consolidate into single module 2025-08-29 09:49:18 -07:00
riscv lib/crypto: Drop inline from all *_mod_init_arch() functions 2025-08-27 08:15:35 -07:00
s390 lib/crypto: Drop inline from all *_mod_init_arch() functions 2025-08-27 08:15:35 -07:00
sparc lib/crypto: Drop inline from all *_mod_init_arch() functions 2025-08-27 08:15:35 -07:00
tests lib/crypto: tests: Add KUnit tests for MD5 and HMAC-MD5 2025-08-27 08:15:35 -07:00
x86 lib/crypto: poly1305: Consolidate into single module 2025-08-29 09:49:18 -07:00
Kconfig lib/crypto: poly1305: Consolidate into single module 2025-08-29 09:49:18 -07:00
Makefile lib/crypto: poly1305: Consolidate into single module 2025-08-29 09:49:18 -07:00
aes.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
aescfb.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
aesgcm.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
arc4.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
blake2s-generic.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
blake2s-selftest.c crypto: lib/blake2s - Split up test function to halve stack usage 2022-12-30 22:56:27 +08:00
blake2s.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
chacha.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
chacha20poly1305-selftest.c crypto: lib/chacha - strongly type the ChaCha state 2025-05-12 13:32:53 +08:00
chacha20poly1305.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
curve25519-fiat32.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
curve25519-generic.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
curve25519-hacl64.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
curve25519-selftest.c crypto: lib/curve25519 - re-add selftests 2019-12-27 18:18:03 +08:00
curve25519.c crypto: testmgr - replace CRYPTO_MANAGER_DISABLE_TESTS with CRYPTO_SELFTESTS 2025-05-12 13:33:14 +08:00
des.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
gf128mul.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
hash_info.c lib/crypto: hash_info: Move hash_info.c into lib/crypto/ 2025-07-08 12:03:44 -07:00
libchacha.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
md5.c lib/crypto: md5: Add MD5 and HMAC-MD5 library functions 2025-08-26 12:52:27 -04:00
memneq.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
poly1305-donna32.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
poly1305-donna64.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
poly1305.c lib/crypto: poly1305: Consolidate into single module 2025-08-29 09:49:18 -07:00
sha1.c lib/crypto: sha1: Add HMAC support 2025-07-14 08:59:20 -07:00
sha256.c lib/crypto: sha2: Add hmac_sha*_init_usingrawkey() 2025-07-14 08:20:37 -07:00
sha512.c lib/crypto: sha2: Add hmac_sha*_init_usingrawkey() 2025-07-14 08:20:37 -07:00
simd.c crypto: api - move crypto_simd_disabled_for_test to lib 2024-10-28 18:33:11 +08:00
sm3.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00
utils.c lib/crypto: Explicitly include <linux/export.h> 2025-06-30 09:26:19 -07:00