@@ -15795,15 +15795,24 @@ static int test_wc_CmacFinal(void)
1579515795 ExpectIntEQ(wc_InitCmac(&cmac, key, keySz, type, NULL), 0);
1579615796 ExpectIntEQ(wc_CmacUpdate(&cmac, msg, msgSz), 0);
1579715797
15798- ExpectIntEQ(wc_CmacFinalNoFree(&cmac, mac, &macSz), 0);
15799- ExpectIntEQ(XMEMCMP(mac, expMac, expMacSz), 0);
15800-
15798+ #if (!defined(HAVE_FIPS) || FIPS_VERSION_GE(5, 3)) && !defined(HAVE_SELFTEST)
1580115799 /* Pass in bad args. */
1580215800 ExpectIntEQ(wc_CmacFinalNoFree(NULL, mac, &macSz), BAD_FUNC_ARG);
1580315801 ExpectIntEQ(wc_CmacFinalNoFree(&cmac, NULL, &macSz), BAD_FUNC_ARG);
15802+ ExpectIntEQ(wc_CmacFinalNoFree(&cmac, mac, &badMacSz), BUFFER_E);
1580415803
1580515804 /* For the last call, use the API with implicit wc_CmacFree(). */
15805+ ExpectIntEQ(wc_CmacFinal(&cmac, mac, &macSz), 0);
15806+ ExpectIntEQ(XMEMCMP(mac, expMac, expMacSz), 0);
15807+ #else /* !HAVE_FIPS || FIPS>=5.3 */
15808+ ExpectIntEQ(wc_CmacFinal(&cmac, mac, &macSz), 0);
15809+ ExpectIntEQ(XMEMCMP(mac, expMac, expMacSz), 0);
15810+
15811+ /* Pass in bad args. */
15812+ ExpectIntEQ(wc_CmacFinal(NULL, mac, &macSz), BAD_FUNC_ARG);
15813+ ExpectIntEQ(wc_CmacFinal(&cmac, NULL, &macSz), BAD_FUNC_ARG);
1580615814 ExpectIntEQ(wc_CmacFinal(&cmac, mac, &badMacSz), BUFFER_E);
15815+ #endif /* !HAVE_FIPS || FIPS>=5.3 */
1580715816#endif
1580815817 return EXPECT_RESULT();
1580915818} /* END test_wc_CmacFinal */
0 commit comments