Allow compiling aes.c with WOLFSSL_NO_MALLOC

This commit is contained in:
Daniele Lacamera
2024-10-09 13:55:42 +02:00
parent 43574e2255
commit 56a96ba609

View File

@ -11299,6 +11299,7 @@ int wc_AesCcmEncrypt_ex(Aes* aes, byte* out, const byte* in, word32 sz,
#endif /* HAVE_AESCCM */ #endif /* HAVE_AESCCM */
#ifndef WOLFSSL_NO_MALLOC
Aes* wc_AesNew(void* heap, int devId) Aes* wc_AesNew(void* heap, int devId)
{ {
Aes* aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_AES); Aes* aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_AES);
@ -11313,6 +11314,7 @@ Aes* wc_AesNew(void* heap, int devId)
} }
return aes; return aes;
} }
#endif
/* Initialize Aes for use with async hardware */ /* Initialize Aes for use with async hardware */
int wc_AesInit(Aes* aes, void* heap, int devId) int wc_AesInit(Aes* aes, void* heap, int devId)
@ -11525,9 +11527,11 @@ void wc_AesFree(Aes* aes)
wc_MemZero_Check(aes, sizeof(Aes)); wc_MemZero_Check(aes, sizeof(Aes));
#endif #endif
#ifndef WOLFSSL_NO_MALLOC
if (isAllocated) { if (isAllocated) {
XFREE(aes, heap, DYNAMIC_TYPE_AES); XFREE(aes, heap, DYNAMIC_TYPE_AES);
} }
#endif
} }