crypto: x86/sha256 - implement library instead of shash
authorEric Biggers <ebiggers@google.com>
Mon, 28 Apr 2025 17:00:36 +0000 (10:00 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 5 May 2025 10:20:44 +0000 (18:20 +0800)
commit11d7956d526f72da82b575389a2d8f9eb15dea6c
tree03c7db3aec12d8d288a22b7cb368a90d0481c6df
parent699618d422759fe096a28ad2778d79807a5384ce
crypto: x86/sha256 - implement library instead of shash

Instead of providing crypto_shash algorithms for the arch-optimized
SHA-256 code, instead implement the SHA-256 library.  This is much
simpler, it makes the SHA-256 library functions be arch-optimized, and
it fixes the longstanding issue where the arch-optimized SHA-256 was
disabled by default.  SHA-256 still remains available through
crypto_shash, but individual architectures no longer need to handle it.

To match sha256_blocks_arch(), change the type of the nblocks parameter
of the assembly functions from int to size_t.  The assembly functions
actually already treated it as size_t.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
14 files changed:
arch/x86/crypto/Kconfig
arch/x86/crypto/Makefile
arch/x86/crypto/sha256-avx-asm.S [deleted file]
arch/x86/crypto/sha256-avx2-asm.S [deleted file]
arch/x86/crypto/sha256-ssse3-asm.S [deleted file]
arch/x86/crypto/sha256_ni_asm.S [deleted file]
arch/x86/crypto/sha256_ssse3_glue.c [deleted file]
arch/x86/lib/crypto/Kconfig
arch/x86/lib/crypto/Makefile
arch/x86/lib/crypto/sha256-avx-asm.S [new file with mode: 0644]
arch/x86/lib/crypto/sha256-avx2-asm.S [new file with mode: 0644]
arch/x86/lib/crypto/sha256-ni-asm.S [new file with mode: 0644]
arch/x86/lib/crypto/sha256-ssse3-asm.S [new file with mode: 0644]
arch/x86/lib/crypto/sha256.c [new file with mode: 0644]