wolfcrypt/src/aes.c: fixes for bugprone-macro-parentheses;

wolfcrypt/src/ecc.c: fix for nullPointerRedundantCheck ("possible null pointer dereference").
This commit is contained in:
Daniel Pouzzner
2023-05-11 11:51:27 -05:00
parent 870f7cc95b
commit 3c06638115
2 changed files with 8 additions and 4 deletions

View File

@ -1978,12 +1978,12 @@ static word32 GetTable8_4(const byte* t, byte o0, byte o1, byte o2, byte o3)
#define GetTable(t, o) t[o]
#define GetTable8(t, o) t[o]
#define GetTable_Multi(t, t0, o0, t1, o1, t2, o2, t3, o3) \
*t0 = t[o0]; *t1 = t[o1]; *t2 = t[o2]; *t3 = t[o3]
*(t0) = (t)[o0]; *(t1) = (t)[o1]; *(t2) = (t)[o2]; *(t3) = (t)[o3]
#define XorTable_Multi(t, t0, o0, t1, o1, t2, o2, t3, o3) \
*t0 ^= t[o0]; *t1 ^= t[o1]; *t2 ^= t[o2]; *t3 ^= t[o3]
*(t0) ^= (t)[o0]; *(t1) ^= (t)[o1]; *(t2) ^= (t)[o2]; *(t3) ^= (t)[o3]
#define GetTable8_4(t, o0, o1, o2, o3) \
(((word32)t[o0] << 24) | ((word32)t[o1] << 16) | \
((word32)t[o2] << 8) | ((word32)t[o3] << 0))
(((word32)(t)[o0] << 24) | ((word32)(t)[o1] << 16) | \
((word32)(t)[o2] << 8) | ((word32)(t)[o3] << 0))
#endif
/* Software AES - ECB Encrypt */

View File

@ -3368,6 +3368,10 @@ static int ecc_key_tmp_init(ecc_key* key, void* heap)
(void)heap;
if (key == NULL) {
return ECC_BAD_ARG_E;
}
XMEMSET(key, 0, sizeof(*key));
#if defined(WOLFSSL_SP_MATH_ALL) && defined(WOLFSSL_SMALL_STACK)