Skip to content

Commit e37f285

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

2 files changed

Lines changed: 2 additions & 9 deletions

File tree

drivers/crypto/starfive/jh7110-hash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ static struct ahash_engine_alg algs_sha2_sm3[] = {
795795
.base.exit_tfm = starfive_hash_exit_tfm,
796796
.base.halg = {
797797
.digestsize = SM3_DIGEST_SIZE,
798-
.statesize = sizeof(struct sm3_state),
798+
.statesize = sizeof(struct sm3_ctx),
799799
.base = {
800800
.cra_name = "sm3",
801801
.cra_driver_name = "sm3-starfive",
@@ -824,7 +824,7 @@ static struct ahash_engine_alg algs_sha2_sm3[] = {
824824
.base.setkey = starfive_hash_setkey,
825825
.base.halg = {
826826
.digestsize = SM3_DIGEST_SIZE,
827-
.statesize = sizeof(struct sm3_state),
827+
.statesize = sizeof(struct sm3_ctx),
828828
.base = {
829829
.cra_name = "hmac(sm3)",
830830
.cra_driver_name = "sm3-hmac-starfive",

include/crypto/sm3.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#define SM3_DIGEST_SIZE 32
1616
#define SM3_BLOCK_SIZE 64
17-
#define SM3_STATE_SIZE 40
1817

1918
#define SM3_IVA 0x7380166f
2019
#define SM3_IVB 0x4914b2b9
@@ -25,12 +24,6 @@
2524
#define SM3_IVG 0xe38dee4d
2625
#define SM3_IVH 0xb0fb0e4e
2726

28-
struct sm3_state {
29-
u32 state[SM3_DIGEST_SIZE / 4];
30-
u64 count;
31-
u8 buffer[SM3_BLOCK_SIZE];
32-
};
33-
3427
/* State for the SM3 compression function */
3528
struct sm3_block_state {
3629
u32 h[SM3_DIGEST_SIZE / 4];

0 commit comments

Comments
 (0)