Skip to content

Commit

Permalink
Fix AesSivCipher heap hint on cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske committed Oct 8, 2024
1 parent 4753e1c commit e4f4274
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wolfcrypt/src/aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -14033,6 +14033,13 @@ static WARN_UNUSED_RESULT int AesSivCipher(
}
}

#ifndef WOLFSSL_SMALL_STACK
/* make aes has heap hint and isAllocated initialized for cleanup below */
if (ret != 0) {
XMEMSET(aes, 0, sizeof(Aes));
}
#endif

if (ret == 0 && dataSz > 0) {
sivTmp[12] &= 0x7f;
sivTmp[8] &= 0x7f;
Expand Down Expand Up @@ -14066,7 +14073,6 @@ static WARN_UNUSED_RESULT int AesSivCipher(
if (aes != NULL)
#endif
{
aes->isAllocated = 0;
wc_AesFree(aes);
#ifdef WOLFSSL_SMALL_STACK
XFREE(aes, NULL, DYNAMIC_TYPE_AES);
Expand Down

0 comments on commit e4f4274

Please sign in to comment.