From: Eric Biggers Date: Sat, 21 Mar 2026 04:09:35 +0000 (-0700) Subject: crypto: sm3 - Remove 'struct sm3_state' X-Git-Tag: v7.1-rc1~222^2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e37f28529b380265904af64996d34c647d917ef1;p=thirdparty%2Flinux.git crypto: sm3 - Remove 'struct sm3_state' Update one driver that used sizeof(struct sm3_state) to use sizeof(struct sm3_ctx) instead. Then, remove struct sm3_state and SM3_STATE_SIZE. This completes the replacement of struct sm3_state with struct sm3_ctx. Acked-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20260321040935.410034-13-ebiggers@kernel.org Signed-off-by: Eric Biggers --- diff --git a/drivers/crypto/starfive/jh7110-hash.c b/drivers/crypto/starfive/jh7110-hash.c index 742038a5201ac..008a47baa1657 100644 --- a/drivers/crypto/starfive/jh7110-hash.c +++ b/drivers/crypto/starfive/jh7110-hash.c @@ -795,7 +795,7 @@ static struct ahash_engine_alg algs_sha2_sm3[] = { .base.exit_tfm = starfive_hash_exit_tfm, .base.halg = { .digestsize = SM3_DIGEST_SIZE, - .statesize = sizeof(struct sm3_state), + .statesize = sizeof(struct sm3_ctx), .base = { .cra_name = "sm3", .cra_driver_name = "sm3-starfive", @@ -824,7 +824,7 @@ static struct ahash_engine_alg algs_sha2_sm3[] = { .base.setkey = starfive_hash_setkey, .base.halg = { .digestsize = SM3_DIGEST_SIZE, - .statesize = sizeof(struct sm3_state), + .statesize = sizeof(struct sm3_ctx), .base = { .cra_name = "hmac(sm3)", .cra_driver_name = "sm3-hmac-starfive", diff --git a/include/crypto/sm3.h b/include/crypto/sm3.h index 34d7eb32b7dbf..371e8a6617054 100644 --- a/include/crypto/sm3.h +++ b/include/crypto/sm3.h @@ -14,7 +14,6 @@ #define SM3_DIGEST_SIZE 32 #define SM3_BLOCK_SIZE 64 -#define SM3_STATE_SIZE 40 #define SM3_IVA 0x7380166f #define SM3_IVB 0x4914b2b9 @@ -25,12 +24,6 @@ #define SM3_IVG 0xe38dee4d #define SM3_IVH 0xb0fb0e4e -struct sm3_state { - u32 state[SM3_DIGEST_SIZE / 4]; - u64 count; - u8 buffer[SM3_BLOCK_SIZE]; -}; - /* State for the SM3 compression function */ struct sm3_block_state { u32 h[SM3_DIGEST_SIZE / 4];