Skip to content

Commit fffb80d

Browse files
committed
Clear sha3->hashType in InitSha3 so Final fully resets the struct for cross sha3 reuse.
1 parent 4c8c67f commit fffb80d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

wolfcrypt/src/sha3.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,12 @@ static int InitSha3(wc_Sha3* sha3)
646646
#ifdef WOLFSSL_HASH_FLAGS
647647
sha3->flags = 0;
648648
#endif
649+
#ifdef WOLF_CRYPTO_CB
650+
/* Cached hash variant is tied to sponge state; clear it whenever the
651+
* state is reset so reuse for a different SHA3 variant dispatches
652+
* correctly through the crypto callback. */
653+
sha3->hashType = WC_HASH_TYPE_NONE;
654+
#endif
649655

650656
#ifdef USE_INTEL_SPEEDUP
651657
{

0 commit comments

Comments
 (0)