]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: sm3 - Fold sm3_init() into its caller
authorEric Biggers <ebiggers@kernel.org>
Sat, 21 Mar 2026 04:09:24 +0000 (21:09 -0700)
committerEric Biggers <ebiggers@kernel.org>
Tue, 24 Mar 2026 00:50:58 +0000 (17:50 -0700)
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 <ardb@kernel.org>
Link: https://lore.kernel.org/r/20260321040935.410034-2-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
include/crypto/sm3.h
include/crypto/sm3_base.h

index c8d02c86c298aff00ff1992d62b62af5b08ce80b..c09f6bf4c0bf4d778bd42bdef04bf59f47711990 100644 (file)
@@ -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
index 7c53570bc05efc887fceb5761d69842ac78a9d55..9fa9956174956091924a7c5e9c7f4147c63df573 100644 (file)
@@ -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;
 }