Skip to content

Commit 06195a2

Browse files
committed
fix unused variables
1 parent 56a96ba commit 06195a2

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

wolfcrypt/src/aes.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11451,14 +11451,18 @@ int wc_AesInit_Label(Aes* aes, const char* label, void* heap, int devId)
1145111451
void wc_AesFree(Aes* aes)
1145211452
{
1145311453
void* heap;
11454+
#ifndef WOLFSSL_NO_MALLOC
1145411455
byte isAllocated;
11456+
#endif
1145511457

1145611458
if (aes == NULL) {
1145711459
return;
1145811460
}
1145911461

11462+
#ifndef WOLFSSL_NO_MALLOC
1146011463
heap = aes->heap;
1146111464
isAllocated = aes->isAllocated;
11465+
#endif
1146211466

1146311467
#ifdef WC_DEBUG_CIPHER_LIFECYCLE
1146411468
(void)wc_debug_CipherLifecycleFree(&aes->CipherLifecycleTag, heap, 1);
@@ -11532,6 +11536,7 @@ void wc_AesFree(Aes* aes)
1153211536
XFREE(aes, heap, DYNAMIC_TYPE_AES);
1153311537
}
1153411538
#endif
11539+
(void)heap;
1153511540

1153611541
}
1153711542

wolfcrypt/src/ed25519.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,13 +1026,16 @@ int wc_ed25519_init(ed25519_key* key)
10261026
void wc_ed25519_free(ed25519_key* key)
10271027
{
10281028
void* heap;
1029+
#ifndef WOLFSSL_NO_MALLOC
10291030
byte isAllocated = 0;
1030-
1031+
#endif
10311032
if (key == NULL)
10321033
return;
10331034

1035+
#ifndef WOLFSSL_NO_MALLOC
10341036
heap = key->heap;
10351037
isAllocated = key->isAllocated;
1038+
#endif
10361039

10371040
#ifdef WOLFSSL_ED25519_PERSISTENT_SHA
10381041
ed25519_hash_free(key, &key->sha);
@@ -1050,9 +1053,9 @@ void wc_ed25519_free(ed25519_key* key)
10501053
#ifndef WOLFSSL_NO_MALLOC
10511054
if (isAllocated) {
10521055
XFREE(key, heap, DYNAMIC_TYPE_ED25519);
1053-
(void)heap;
10541056
}
10551057
#endif
1058+
(void)heap;
10561059

10571060
}
10581061

wolfcrypt/src/hash.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,9 @@ int wc_HashInit_ex(wc_HashAlg* hash, enum wc_HashType type, void* heap,
712712
if (hash == NULL)
713713
return BAD_FUNC_ARG;
714714

715+
#ifndef WOLFSSL_NO_MALLOC
715716
hash->isAllocated = 0;
717+
#endif
716718
hash->type = type;
717719

718720
switch (type) {
@@ -1044,19 +1046,23 @@ int wc_HashFree(wc_HashAlg* hash, enum wc_HashType type)
10441046
{
10451047
int ret = WC_NO_ERR_TRACE(HASH_TYPE_E); /* Default to hash type error */
10461048
void* heap = NULL;
1049+
#ifndef WOLFSSL_NO_MALLOC
10471050
byte isAllocated = 0;
1048-
1051+
#endif
10491052
if (hash == NULL)
10501053
return BAD_FUNC_ARG;
10511054

1055+
10521056
#ifdef DEBUG_WOLFSSL
10531057
if (hash->type != type) {
10541058
WOLFSSL_MSG("Hash free type mismatch!");
10551059
return BAD_FUNC_ARG;
10561060
}
10571061
#endif
10581062

1063+
#ifndef WOLFSSL_NO_MALLOC
10591064
isAllocated = hash->isAllocated;
1065+
#endif
10601066

10611067
switch (type) {
10621068
case WC_HASH_TYPE_MD5:
@@ -1175,9 +1181,9 @@ int wc_HashFree(wc_HashAlg* hash, enum wc_HashType type)
11751181
#ifndef WOLFSSL_NO_MALLOC
11761182
if (isAllocated) {
11771183
XFREE(hash, heap, DYNAMIC_TYPE_HASHES);
1178-
(void)heap;
11791184
}
11801185
#endif
1186+
(void)heap;
11811187

11821188
return ret;
11831189
}

0 commit comments

Comments
 (0)