Skip to content

Commit 4fb6cfe

Browse files
committed
tests/cmac: guard tooSmallMacSz declaration for the frozen selftest API
test_wc_CmacFinal declares tooSmallMacSz but only uses it inside the "#if (!HAVE_FIPS || FIPS>=5.3) && !HAVE_SELFTEST" block (wc_CmacFinalNoFree bad-arg checks). Under the CAVP-selftest config that block is compiled out, leaving the variable unused -> -Werror=unused-variable. Declare it under the same condition as its use.
1 parent 9efcb7b commit 4fb6cfe

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tests/api/test_cmac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ int test_wc_CmacFinal(void)
167167
word32 keySz = (word32)sizeof(key);
168168
word32 macSz = sizeof(mac);
169169
word32 badMacSz = 17;
170+
#if (!defined(HAVE_FIPS) || FIPS_VERSION_GE(5, 3)) && !defined(HAVE_SELFTEST)
171+
/* only used by the bad-arg checks in the matching #if block below */
170172
word32 tooSmallMacSz = WC_CMAC_TAG_MIN_SZ - 1;
173+
#endif
171174
int expMacSz = sizeof(expMac);
172175
int type = WC_CMAC_AES;
173176

0 commit comments

Comments
 (0)