crypto: riscv/sha256 - implement library instead of shash
authorEric Biggers <ebiggers@google.com>
Mon, 28 Apr 2025 17:00:32 +0000 (10:00 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 5 May 2025 10:20:43 +0000 (18:20 +0800)
commitbf52d93865bde68896d20f2ce6c2f76d96cd678e
treebe37edf11cef83127448f599701964c0dca6c5c6
parent1a49c573bf886349c7bc958b331c700cf18601d8
crypto: riscv/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 function from int to size_t.  The assembly function
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>
arch/riscv/crypto/Kconfig
arch/riscv/crypto/Makefile
arch/riscv/crypto/sha256-riscv64-glue.c [deleted file]
arch/riscv/crypto/sha256-riscv64-zvknha_or_zvknhb-zvkb.S [deleted file]
arch/riscv/lib/crypto/Kconfig
arch/riscv/lib/crypto/Makefile
arch/riscv/lib/crypto/sha256-riscv64-zvknha_or_zvknhb-zvkb.S [new file with mode: 0644]
arch/riscv/lib/crypto/sha256.c [new file with mode: 0644]