]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
lib/crypto: curve25519: Consolidate into single module
authorEric Biggers <ebiggers@kernel.org>
Sat, 6 Sep 2025 21:35:21 +0000 (14:35 -0700)
committerEric Biggers <ebiggers@kernel.org>
Sat, 6 Sep 2025 23:32:43 +0000 (16:32 -0700)
commit68546e5632c0b982663af575ae12cc5d81facc91
tree61687639b00e6b35b06282fa48e5b186a4bc5090
parent8c06b330e8f79834924305362227e38e4e2469ae
lib/crypto: curve25519: Consolidate into single module

Reorganize the Curve25519 library code:

- Build a single libcurve25519 module, instead of up to three modules:
  libcurve25519, libcurve25519-generic, and an arch-specific module.

- Move the arch-specific Curve25519 code from arch/$(SRCARCH)/crypto/ to
  lib/crypto/$(SRCARCH)/.  Centralize the build rules into
  lib/crypto/Makefile and lib/crypto/Kconfig.

- Include the arch-specific code directly in lib/crypto/curve25519.c via
  a header, rather than using a separate .c file.

- Eliminate the entanglement with CRYPTO.  CRYPTO_LIB_CURVE25519 no
  longer selects CRYPTO, and the arch-specific Curve25519 code no longer
  depends on CRYPTO.

This brings Curve25519 in line with the latest conventions for
lib/crypto/, used by other algorithms.  The exception is that I kept the
generic code in separate translation units for now.  (Some of the
function names collide between the x86 and generic Curve25519 code.  And
the Curve25519 functions are very long anyway, so inlining doesn't
matter as much for Curve25519 as it does for some other algorithms.)

Link: https://lore.kernel.org/r/20250906213523.84915-11-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
16 files changed:
arch/arm/crypto/Kconfig
arch/arm/crypto/Makefile
arch/powerpc/crypto/Kconfig
arch/powerpc/crypto/Makefile
arch/x86/crypto/Kconfig
arch/x86/crypto/Makefile
include/crypto/curve25519.h
lib/crypto/Kconfig
lib/crypto/Makefile
lib/crypto/arm/curve25519-core.S [moved from arch/arm/crypto/curve25519-core.S with 100% similarity]
lib/crypto/arm/curve25519.h [moved from arch/arm/crypto/curve25519-glue.c with 58% similarity]
lib/crypto/curve25519-generic.c [deleted file]
lib/crypto/curve25519.c
lib/crypto/powerpc/curve25519-ppc64le_asm.S [moved from arch/powerpc/crypto/curve25519-ppc64le_asm.S with 100% similarity]
lib/crypto/powerpc/curve25519.h [moved from arch/powerpc/crypto/curve25519-ppc64le-core.c with 88% similarity]
lib/crypto/x86/curve25519.h [moved from arch/x86/crypto/curve25519-x86_64.c with 98% similarity]