linux/drivers/crypto/starfive
Eric Biggers e0cd371691 crypto: sha256 - Wrap library and add HMAC support
Like I did for crypto/sha512.c, rework crypto/sha256.c to simply wrap
the normal library functions instead of accessing the low-level arch-
optimized and generic block functions directly.  Also add support for
HMAC-SHA224 and HMAC-SHA256, again just wrapping the library functions.

Since the replacement crypto_shash algorithms are implemented using the
(potentially arch-optimized) library functions, give them driver names
ending with "-lib" rather than "-generic".  Update crypto/testmgr.c and
a couple odd drivers to take this change in driver name into account.

Besides the above cases which are accounted for, there are no known
cases where the driver names were being depended on.  There is
potential for confusion for people manually checking /proc/crypto (e.g.
https://lore.kernel.org/r/9e33c893-2466-4d4e-afb1-966334e451a2@linux.ibm.com/),
but really people just need to get used to the driver name not being
meaningful for the software algorithms.  Historically, the optimized
code was disabled by default, so there was some purpose to checking
whether it was enabled or not.  However, this is now fixed for all SHA-2
algorithms, and the library code just always does the right thing.  E.g.
if the CPU supports SHA-256 instructions, they are used.

This change does also mean that the generic 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/20250630160645.3198-10-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2025-07-04 10:23:11 -07:00
..
jh7110-aes.c crypto: starfive - Use fallback for unaligned dma access 2024-05-10 17:15:24 +08:00
jh7110-cryp.c crypto: starfive - remove unneeded crypto_engine_stop() call 2024-10-28 18:33:11 +08:00
jh7110-cryp.h crypto: starfive - Fix nent assignment in rsa dec 2024-07-06 10:20:00 +10:00
jh7110-hash.c crypto: sha256 - Wrap library and add HMAC support 2025-07-04 10:23:11 -07:00
jh7110-rsa.c crypto: drivers - Drop sign/verify operations 2024-10-05 13:22:04 +08:00
Kconfig crypto: starfive - Use dma for aes requests 2024-04-02 10:49:38 +08:00
Makefile crypto: starfive - Add AES skcipher and aead support 2023-07-28 18:20:25 +08:00