]> www.infradead.org Git - users/jedix/linux-maple.git/commit
crypto: sha256 - support arch-optimized lib and expose through shash
authorEric Biggers <ebiggers@google.com>
Mon, 28 Apr 2025 17:00:26 +0000 (10:00 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 5 May 2025 05:38:12 +0000 (13:38 +0800)
commit950e5c84118c9e5b06bb9a9b64edf989ee4034df
treee3fd98ecc23244877fd5397983461f6370f1f044
parent10a6d72ea355b730aa9702da0fd36aef0898a80e
crypto: sha256 - support arch-optimized lib and expose through shash

As has been done for various other algorithms, rework the design of the
SHA-256 library to support arch-optimized implementations, and make
crypto/sha256.c expose both generic and arch-optimized shash algorithms
that wrap the library functions.

This allows users of the SHA-256 library functions to take advantage of
the arch-optimized code, and this makes it much simpler to integrate
SHA-256 for each architecture.

Note that sha256_base.h is not used in the new design.  It will be
removed once all the architecture-specific code has been updated.

Move the generic block function into its own module to avoid a circular
dependency from libsha256.ko => sha256-$ARCH.ko => libsha256.ko.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Add export and import functions to maintain existing export format.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/Kconfig
crypto/Makefile
crypto/sha256.c [new file with mode: 0644]
crypto/sha256_generic.c [deleted file]
include/crypto/internal/sha2.h [new file with mode: 0644]
include/crypto/sha2.h
include/crypto/sha256_base.h
lib/crypto/Kconfig
lib/crypto/Makefile
lib/crypto/sha256-generic.c [new file with mode: 0644]
lib/crypto/sha256.c