Skip to content

Commit ef01e1e

Browse files
author
Eric Biggers
committed
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 <ardb@kernel.org> Link: https://lore.kernel.org/r/20260321040935.410034-12-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
1 parent 9d7f2a6 commit ef01e1e

2 files changed

Lines changed: 3 additions & 18 deletions

File tree

include/crypto/sm3.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ struct sm3_state {
3131
u8 buffer[SM3_BLOCK_SIZE];
3232
};
3333

34-
void sm3_block_generic(struct sm3_state *sctx, u8 const *data, int blocks);
35-
3634
/* State for the SM3 compression function */
3735
struct sm3_block_state {
3836
u32 h[SM3_DIGEST_SIZE / 4];

lib/crypto/sm3.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ static const u32 ____cacheline_aligned K[64] = {
7979
^ rol32(W[(i-13) & 0x0f], 7) \
8080
^ W[(i-6) & 0x0f])
8181

82-
static void sm3_transform(struct sm3_block_state *state,
83-
const u8 data[SM3_BLOCK_SIZE], u32 W[16])
82+
static void sm3_block_generic(struct sm3_block_state *state,
83+
const u8 data[SM3_BLOCK_SIZE], u32 W[16])
8484
{
8585
u32 a, b, c, d, e, f, g, h, ss1, ss2;
8686

@@ -177,26 +177,13 @@ static void sm3_transform(struct sm3_block_state *state,
177177
#undef W1
178178
#undef W2
179179

180-
void sm3_block_generic(struct sm3_state *sctx, u8 const *data, int blocks)
181-
{
182-
u32 W[16];
183-
184-
do {
185-
sm3_transform((struct sm3_block_state *)sctx->state, data, W);
186-
data += SM3_BLOCK_SIZE;
187-
} while (--blocks);
188-
189-
memzero_explicit(W, sizeof(W));
190-
}
191-
EXPORT_SYMBOL_GPL(sm3_block_generic);
192-
193180
static void __maybe_unused sm3_blocks_generic(struct sm3_block_state *state,
194181
const u8 *data, size_t nblocks)
195182
{
196183
u32 W[16];
197184

198185
do {
199-
sm3_transform(state, data, W);
186+
sm3_block_generic(state, data, W);
200187
data += SM3_BLOCK_SIZE;
201188
} while (--nblocks);
202189

0 commit comments

Comments
 (0)