On Mon, Jun 30, 2025 at 09:06:31AM -0700, Eric Biggers wrote: > This series is also available at: > > git fetch > https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git > sha256-lib-cleanup-v2 > > This series improves the SHA-224 and SHA-256 library code to be > consistent with what I did for SHA-384 and SHA-512. This includes: > > - Use stronger typing in the SHA-224 and SHA-256 functions. > > - Add support for HMAC-SHA224 and HMAC-SHA256. (I'll send a separate > patch with KUnit test cases for this.) > > - Make the old-school crypto API's support for sha224 and sha256 just > use the actual library API, instead of unsafe low-level functions. > > - Consolidate the CPU-based SHA-224 and SHA-256 code into a single > module, with better inlining and dead code elimination. > > - Properly document the SHA-224 and SHA-256 functions. > > - Other changes to synchronize the code with SHA-384 and SHA-512. > > Changed in v2: > - Dropped sha224_kunit.c changes; it will be added later in the history > - Dropped some patches that I folded into the SHA-512 series > - Removed redundant checks of IS_ENABLED(CONFIG_KERNEL_MODE_NEON) > - Removed obsolete setting of -DARCH for sha256.o > - Fixed a commit title to mention sha256 instead of sha512 > - Excluded HMAC-SHA{224,256} code from purgatory, where it isn't needed > > Eric Biggers (14): > libceph: Rename hmac_sha256() to ceph_hmac_sha256() > cxl/test: Simplify fw_buf_checksum_show() > lib/crypto: sha256: Reorder some code > lib/crypto: sha256: Remove sha256_blocks_simd() > lib/crypto: sha256: Add sha224() and sha224_update() > lib/crypto: sha256: Make library API use strongly-typed contexts > lib/crypto: sha256: Propagate sha256_block_state type to > implementations > lib/crypto: sha256: Add HMAC-SHA224 and HMAC-SHA256 support > crypto: sha256 - Wrap library and add HMAC support > crypto: sha256 - Use same state format as legacy drivers > lib/crypto: sha256: Remove sha256_is_arch_optimized() > lib/crypto: sha256: Consolidate into single module > lib/crypto: sha256: Sync sha256_update() with sha512_update() > lib/crypto: sha256: Document the SHA-224 and SHA-256 API
FYI, applied to libcrypto-next. Reviews and acks would be greatly appreciated, though! To fix https://lore.kernel.org/r/202507010837.erx7aww7-...@intel.com/ I applied the following fixup to "lib/crypto: sha256: Propagate sha256_block_state type to implementations". diff --git a/lib/crypto/powerpc/sha256.c b/lib/crypto/powerpc/sha256.c index c3f844ae0aceb..55f42403d572a 100644 --- a/lib/crypto/powerpc/sha256.c +++ b/lib/crypto/powerpc/sha256.c @@ -26,7 +26,8 @@ */ #define MAX_BYTES 1024 -extern void ppc_spe_sha256_transform(u32 *state, const u8 *src, u32 blocks); +extern void ppc_spe_sha256_transform(struct sha256_block_state *state, + const u8 *src, u32 blocks); static void spe_begin(void) {