]> www.infradead.org Git - users/jedix/linux-maple.git/commit
crypto: chacha - centralize the skcipher wrappers for arch code
authorEric Biggers <ebiggers@google.com>
Sat, 5 Apr 2025 18:26:02 +0000 (11:26 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 7 Apr 2025 05:22:28 +0000 (13:22 +0800)
commit4aa6dc909e400b247bd3abf29f805d49a9c140bf
treea86c166bc8c691851f43489ceb97a7af89fdda62
parentceba0eda831382864dc420fcab5f6079fbb26ba2
crypto: chacha - centralize the skcipher wrappers for arch code

Following the example of the crc32 and crc32c code, make the crypto
subsystem register both generic and architecture-optimized chacha20,
xchacha20, and xchacha12 skcipher algorithms, all implemented on top of
the appropriate library functions.  This eliminates the need for every
architecture to implement the same skcipher glue code.

To register the architecture-optimized skciphers only when
architecture-optimized code is actually being used, add a function
chacha_is_arch_optimized() and make each arch implement it.  Change each
architecture's ChaCha module_init function to arch_initcall so that the
CPU feature detection is guaranteed to run before
chacha_is_arch_optimized() gets called by crypto/chacha.c.  In the case
of s390, remove the CPU feature based module autoloading, which is no
longer needed since the module just gets pulled in via function linkage.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/arm/crypto/chacha-glue.c
arch/arm64/crypto/chacha-neon-glue.c
arch/mips/crypto/chacha-glue.c
arch/powerpc/crypto/chacha-p10-glue.c
arch/riscv/crypto/chacha-riscv64-glue.c
arch/s390/crypto/chacha-glue.c
arch/x86/crypto/chacha_glue.c
crypto/Makefile
crypto/chacha.c [new file with mode: 0644]
crypto/chacha_generic.c [deleted file]
include/crypto/chacha.h