stash caller heap before cryptocb fires so InitCmac_* callbacks can honor it

This commit is contained in:
night1rider
2026-05-05 12:03:37 -06:00
parent a3f5260260
commit 291ec20d4e
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -126,6 +126,13 @@ static int _InitCmac_common(Cmac* cmac, const byte* key, word32 keySz,
#endif
XMEMSET(cmac, 0, sizeof(Cmac));
/* Stash heap so the cryptocb can read it from the zeroed cmac. */
#ifndef NO_AES
cmac->aes.heap = heap;
#else
cmac->heap = heap;
#endif
/* Store id/label on the Cmac struct so the crypto callback can
* inspect them to determine the hardware key slot. */
#ifdef WOLF_PRIVATE_KEY_ID
+2
View File
@@ -63,6 +63,8 @@ struct Cmac {
byte digest[WC_AES_BLOCK_SIZE]; /* running digest */
byte k1[WC_AES_BLOCK_SIZE];
byte k2[WC_AES_BLOCK_SIZE];
#else
void* heap; /* fallback when no aes.heap is available */
#endif
word32 bufferSz;
word32 totalSz;