@@ -305,6 +305,13 @@ int test_wc_Md5HmacUpdate(void)
305305 b .inLen = XSTRLEN (b .input );
306306
307307 ExpectIntEQ (wc_HmacInit (& hmac , NULL , INVALID_DEVID ), 0 );
308+ #if !defined(WOLFSSL_KCAPI_HMAC ) && !defined(HAVE_SELFTEST ) && \
309+ (!defined(HAVE_FIPS ) || FIPS_VERSION3_GE (7 ,0 ,0 ))
310+ /* update before setkey results in err. */
311+ ExpectIntEQ (wc_HmacUpdate (& hmac , (byte * )b .input , (word32 )b .inLen ),
312+ WC_NO_ERR_TRACE (BAD_FUNC_ARG ));
313+ #endif /* !WOLFSSL_KCAPI_HMAC && !HAVE_SELFTEST && \
314+ (!HAVE_FIPS || FIPS_VERSION3_GE(7,0,0)) */
308315 ExpectIntEQ (wc_HmacSetKey (& hmac , WC_MD5 , (byte * )keys ,
309316 (word32 )XSTRLEN (keys )), 0 );
310317 ExpectIntEQ (wc_HmacUpdate (& hmac , (byte * )b .input , (word32 )b .inLen ), 0 );
@@ -346,6 +353,11 @@ int test_wc_ShaHmacUpdate(void)
346353 b .inLen = XSTRLEN (b .input );
347354
348355 ExpectIntEQ (wc_HmacInit (& hmac , NULL , INVALID_DEVID ), 0 );
356+ #if !defined(HAVE_SELFTEST ) && (!defined(HAVE_FIPS ) || FIPS_VERSION3_GE (7 ,0 ,0 ))
357+ /* update before setkey results in err. */
358+ ExpectIntEQ (wc_HmacUpdate (& hmac , (byte * )b .input , (word32 )b .inLen ),
359+ WC_NO_ERR_TRACE (BAD_FUNC_ARG ));
360+ #endif /* !HAVE_SELFTEST && (!HAVE_FIPS || FIPS_VERSION3_GE(7,0,0)) */
349361 ExpectIntEQ (wc_HmacSetKey (& hmac , WC_SHA , (byte * )keys ,
350362 (word32 )XSTRLEN (keys )), 0 );
351363 ExpectIntEQ (wc_HmacUpdate (& hmac , (byte * )b .input , (word32 )b .inLen ), 0 );
@@ -387,6 +399,11 @@ int test_wc_Sha224HmacUpdate(void)
387399 b .inLen = XSTRLEN (b .input );
388400
389401 ExpectIntEQ (wc_HmacInit (& hmac , NULL , INVALID_DEVID ), 0 );
402+ #if !defined(HAVE_SELFTEST ) && (!defined(HAVE_FIPS ) || FIPS_VERSION3_GE (7 ,0 ,0 ))
403+ /* update before setkey results in err. */
404+ ExpectIntEQ (wc_HmacUpdate (& hmac , (byte * )b .input , (word32 )b .inLen ),
405+ WC_NO_ERR_TRACE (BAD_FUNC_ARG ));
406+ #endif /* !HAVE_SELFTEST && (!HAVE_FIPS || FIPS_VERSION3_GE(7,0,0)) */
390407 ExpectIntEQ (wc_HmacSetKey (& hmac , WC_SHA224 , (byte * )keys ,
391408 (word32 )XSTRLEN (keys )), 0 );
392409 ExpectIntEQ (wc_HmacUpdate (& hmac , (byte * )b .input , (word32 )b .inLen ), 0 );
@@ -428,6 +445,11 @@ int test_wc_Sha256HmacUpdate(void)
428445 b .inLen = XSTRLEN (b .input );
429446
430447 ExpectIntEQ (wc_HmacInit (& hmac , NULL , INVALID_DEVID ), 0 );
448+ #if !defined(HAVE_SELFTEST ) && (!defined(HAVE_FIPS ) || FIPS_VERSION3_GE (7 ,0 ,0 ))
449+ /* update before setkey results in err. */
450+ ExpectIntEQ (wc_HmacUpdate (& hmac , (byte * )b .input , (word32 )b .inLen ),
451+ WC_NO_ERR_TRACE (BAD_FUNC_ARG ));
452+ #endif /* !HAVE_SELFTEST && (!HAVE_FIPS || FIPS_VERSION3_GE(7,0,0)) */
431453 ExpectIntEQ (wc_HmacSetKey (& hmac , WC_SHA256 , (byte * )keys ,
432454 (word32 )XSTRLEN (keys )), 0 );
433455 ExpectIntEQ (wc_HmacUpdate (& hmac , (byte * )b .input , (word32 )b .inLen ), 0 );
@@ -469,6 +491,11 @@ int test_wc_Sha384HmacUpdate(void)
469491 b .inLen = XSTRLEN (b .input );
470492
471493 ExpectIntEQ (wc_HmacInit (& hmac , NULL , INVALID_DEVID ), 0 );
494+ #if !defined(HAVE_SELFTEST ) && (!defined(HAVE_FIPS ) || FIPS_VERSION3_GE (7 ,0 ,0 ))
495+ /* update before setkey results in err. */
496+ ExpectIntEQ (wc_HmacUpdate (& hmac , (byte * )b .input , (word32 )b .inLen ),
497+ WC_NO_ERR_TRACE (BAD_FUNC_ARG ));
498+ #endif /* !HAVE_SELFTEST && (!HAVE_FIPS || FIPS_VERSION3_GE(7,0,0)) */
472499 ExpectIntEQ (wc_HmacSetKey (& hmac , WC_SHA384 , (byte * )keys ,
473500 (word32 )XSTRLEN (keys )), 0 );
474501 ExpectIntEQ (wc_HmacUpdate (& hmac , (byte * )b .input , (word32 )b .inLen ), 0 );
0 commit comments