]> git.ipfire.org Git - thirdparty/linux.git/commit
crypto: sha512 - Replace sha512_generic with wrapper around SHA-512 library
authorEric Biggers <ebiggers@kernel.org>
Mon, 30 Jun 2025 16:03:09 +0000 (09:03 -0700)
committerEric Biggers <ebiggers@kernel.org>
Mon, 30 Jun 2025 16:26:19 +0000 (09:26 -0700)
commit469acaa12502e05eefd439693361fe4b851a4fd5
tree26408d69b55b042cf1da3358d06af950ac671d49
parent485deceec03997eabd884d4da89217af73d1ab8d
crypto: sha512 - Replace sha512_generic with wrapper around SHA-512 library

Delete crypto/sha512_generic.c, which provided "generic" SHA-384 and
SHA-512 crypto_shash algorithms.  Replace it with crypto/sha512.c which
provides SHA-384, SHA-512, HMAC-SHA384, and HMAC-SHA512 crypto_shash
algorithms using the corresponding library functions.

This is a prerequisite for migrating all the arch-optimized SHA-512 code
(which is almost 3000 lines) to lib/crypto/ rather than duplicating it.

Since the replacement crypto_shash algorithms are implemented using the
(potentially arch-optimized) library functions, give them
cra_driver_names ending with "-lib" rather than "-generic".  Update
crypto/testmgr.c and one odd driver to take this change in driver name
into account.  Besides these cases which are accounted for, there are no
known cases where the cra_driver_name was being depended on.

This change does mean that the abstract partial block handling code in
crypto/shash.c, which got added in 6.16, no longer gets used.  But
that's fine; the library has to implement the partial block handling
anyway, and it's better to do it in the library since the block size and
other properties of the algorithm are all fixed at compile time there,
resulting in more streamlined code.

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20250630160320.2888-6-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
crypto/Kconfig
crypto/Makefile
crypto/sha512.c [new file with mode: 0644]
crypto/sha512_generic.c [deleted file]
crypto/testmgr.c
drivers/crypto/starfive/jh7110-hash.c
include/crypto/sha512_base.h