From: Eric Biggers Date: Sat, 21 Mar 2026 04:09:34 +0000 (-0700) Subject: crypto: sm3 - Remove the original "sm3_block_generic()" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef01e1eafb20f74e6d951a42a870a40cd8b914ca;p=thirdparty%2Fkernel%2Fstable.git crypto: sm3 - Remove the original "sm3_block_generic()" Since the architecture-optimized SM3 code was migrated into lib/crypto/, sm3_block_generic() is no longer called. Remove it. Then, since this frees up the name, rename sm3_transform() to sm3_block_generic() (matching the naming convention used in other hash algorithms). Acked-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20260321040935.410034-12-ebiggers@kernel.org Signed-off-by: Eric Biggers --- diff --git a/include/crypto/sm3.h b/include/crypto/sm3.h index 702c5326b4be..34d7eb32b7db 100644 --- a/include/crypto/sm3.h +++ b/include/crypto/sm3.h @@ -31,8 +31,6 @@ struct sm3_state { u8 buffer[SM3_BLOCK_SIZE]; }; -void sm3_block_generic(struct sm3_state *sctx, u8 const *data, int blocks); - /* State for the SM3 compression function */ struct sm3_block_state { u32 h[SM3_DIGEST_SIZE / 4]; diff --git a/lib/crypto/sm3.c b/lib/crypto/sm3.c index 20500cf4b8c0..b02b8a247adf 100644 --- a/lib/crypto/sm3.c +++ b/lib/crypto/sm3.c @@ -79,8 +79,8 @@ static const u32 ____cacheline_aligned K[64] = { ^ rol32(W[(i-13) & 0x0f], 7) \ ^ W[(i-6) & 0x0f]) -static void sm3_transform(struct sm3_block_state *state, - const u8 data[SM3_BLOCK_SIZE], u32 W[16]) +static void sm3_block_generic(struct sm3_block_state *state, + const u8 data[SM3_BLOCK_SIZE], u32 W[16]) { u32 a, b, c, d, e, f, g, h, ss1, ss2; @@ -177,26 +177,13 @@ static void sm3_transform(struct sm3_block_state *state, #undef W1 #undef W2 -void sm3_block_generic(struct sm3_state *sctx, u8 const *data, int blocks) -{ - u32 W[16]; - - do { - sm3_transform((struct sm3_block_state *)sctx->state, data, W); - data += SM3_BLOCK_SIZE; - } while (--blocks); - - memzero_explicit(W, sizeof(W)); -} -EXPORT_SYMBOL_GPL(sm3_block_generic); - static void __maybe_unused sm3_blocks_generic(struct sm3_block_state *state, const u8 *data, size_t nblocks) { u32 W[16]; do { - sm3_transform(state, data, W); + sm3_block_generic(state, data, W); data += SM3_BLOCK_SIZE; } while (--nblocks);