Skip to content

Commit

Permalink
fix unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
danielinux committed Oct 9, 2024
1 parent 56a96ba commit 06195a2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions wolfcrypt/src/aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -11451,14 +11451,18 @@ int wc_AesInit_Label(Aes* aes, const char* label, void* heap, int devId)
void wc_AesFree(Aes* aes)
{
void* heap;
#ifndef WOLFSSL_NO_MALLOC
byte isAllocated;
#endif

if (aes == NULL) {
return;
}

#ifndef WOLFSSL_NO_MALLOC
heap = aes->heap;
isAllocated = aes->isAllocated;
#endif

#ifdef WC_DEBUG_CIPHER_LIFECYCLE
(void)wc_debug_CipherLifecycleFree(&aes->CipherLifecycleTag, heap, 1);
Expand Down Expand Up @@ -11532,6 +11536,7 @@ void wc_AesFree(Aes* aes)
XFREE(aes, heap, DYNAMIC_TYPE_AES);
}
#endif
(void)heap;

}

Expand Down
7 changes: 5 additions & 2 deletions wolfcrypt/src/ed25519.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,13 +1026,16 @@ int wc_ed25519_init(ed25519_key* key)
void wc_ed25519_free(ed25519_key* key)
{
void* heap;
#ifndef WOLFSSL_NO_MALLOC
byte isAllocated = 0;

#endif
if (key == NULL)
return;

#ifndef WOLFSSL_NO_MALLOC
heap = key->heap;
isAllocated = key->isAllocated;
#endif

#ifdef WOLFSSL_ED25519_PERSISTENT_SHA
ed25519_hash_free(key, &key->sha);
Expand All @@ -1050,9 +1053,9 @@ void wc_ed25519_free(ed25519_key* key)
#ifndef WOLFSSL_NO_MALLOC
if (isAllocated) {
XFREE(key, heap, DYNAMIC_TYPE_ED25519);
(void)heap;
}
#endif
(void)heap;

}

Expand Down
10 changes: 8 additions & 2 deletions wolfcrypt/src/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,9 @@ int wc_HashInit_ex(wc_HashAlg* hash, enum wc_HashType type, void* heap,
if (hash == NULL)
return BAD_FUNC_ARG;

#ifndef WOLFSSL_NO_MALLOC
hash->isAllocated = 0;
#endif
hash->type = type;

switch (type) {
Expand Down Expand Up @@ -1044,19 +1046,23 @@ int wc_HashFree(wc_HashAlg* hash, enum wc_HashType type)
{
int ret = WC_NO_ERR_TRACE(HASH_TYPE_E); /* Default to hash type error */
void* heap = NULL;
#ifndef WOLFSSL_NO_MALLOC
byte isAllocated = 0;

#endif
if (hash == NULL)
return BAD_FUNC_ARG;


#ifdef DEBUG_WOLFSSL
if (hash->type != type) {
WOLFSSL_MSG("Hash free type mismatch!");
return BAD_FUNC_ARG;
}
#endif

#ifndef WOLFSSL_NO_MALLOC
isAllocated = hash->isAllocated;
#endif

switch (type) {
case WC_HASH_TYPE_MD5:
Expand Down Expand Up @@ -1175,9 +1181,9 @@ int wc_HashFree(wc_HashAlg* hash, enum wc_HashType type)
#ifndef WOLFSSL_NO_MALLOC
if (isAllocated) {
XFREE(hash, heap, DYNAMIC_TYPE_HASHES);
(void)heap;
}
#endif
(void)heap;

return ret;
}
Expand Down

0 comments on commit 06195a2

Please sign in to comment.