From: Eric Biggers Date: Sat, 21 Mar 2026 04:09:24 +0000 (-0700) Subject: crypto: sm3 - Fold sm3_init() into its caller X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a6b2dda5c324041e9e7db29a4eb8358c7ac8f9c;p=thirdparty%2Fkernel%2Fstable.git crypto: sm3 - Fold sm3_init() into its caller Fold sm3_init() into its caller to free up the name for use in a library API mirroring the other hash function APIs. Acked-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20260321040935.410034-2-ebiggers@kernel.org Signed-off-by: Eric Biggers --- diff --git a/include/crypto/sm3.h b/include/crypto/sm3.h index c8d02c86c298..c09f6bf4c0bf 100644 --- a/include/crypto/sm3.h +++ b/include/crypto/sm3.h @@ -46,19 +46,6 @@ struct sm3_state { * For details see lib/crypto/sm3.c */ -static inline void sm3_init(struct sm3_state *sctx) -{ - sctx->state[0] = SM3_IVA; - sctx->state[1] = SM3_IVB; - sctx->state[2] = SM3_IVC; - sctx->state[3] = SM3_IVD; - sctx->state[4] = SM3_IVE; - sctx->state[5] = SM3_IVF; - sctx->state[6] = SM3_IVG; - sctx->state[7] = SM3_IVH; - sctx->count = 0; -} - void sm3_block_generic(struct sm3_state *sctx, u8 const *data, int blocks); #endif diff --git a/include/crypto/sm3_base.h b/include/crypto/sm3_base.h index 7c53570bc05e..9fa995617495 100644 --- a/include/crypto/sm3_base.h +++ b/include/crypto/sm3_base.h @@ -21,7 +21,17 @@ typedef void (sm3_block_fn)(struct sm3_state *sst, u8 const *src, int blocks); static inline int sm3_base_init(struct shash_desc *desc) { - sm3_init(shash_desc_ctx(desc)); + struct sm3_state *sctx = shash_desc_ctx(desc); + + sctx->state[0] = SM3_IVA; + sctx->state[1] = SM3_IVB; + sctx->state[2] = SM3_IVC; + sctx->state[3] = SM3_IVD; + sctx->state[4] = SM3_IVE; + sctx->state[5] = SM3_IVF; + sctx->state[6] = SM3_IVG; + sctx->state[7] = SM3_IVH; + sctx->count = 0; return 0; }