@@ -1869,7 +1869,16 @@ int test_wc_Kmac128_api(void)
18691869 EXPECT_DECLS ;
18701870#ifdef WOLFSSL_KMAC128
18711871 wc_Kmac kmac ;
1872+ #ifdef HAVE_FIPS
1873+ static const byte key [KMAC_FIPS_MIN_KEY ] =
1874+ { 0x00 , 0x01 , 0x02 , 0x03 ,
1875+ 0x00 , 0x01 , 0x02 , 0x03 ,
1876+ 0x00 , 0x01 , 0x02 , 0x03 ,
1877+ 0x00 , 0x01
1878+ };
1879+ #else
18721880 static const byte key [4 ] = { 0x00 , 0x01 , 0x02 , 0x03 };
1881+ #endif
18731882 static const byte msg [4 ] = { 0x00 , 0x01 , 0x02 , 0x03 };
18741883 byte out [200 ];
18751884 byte out2 [200 ];
@@ -1881,9 +1890,16 @@ int test_wc_Kmac128_api(void)
18811890 INVALID_DEVID ), BAD_FUNC_ARG );
18821891 ExpectIntEQ (wc_InitKmac128 (& kmac , key , (word32 )sizeof (key ), NULL , 4 ,
18831892 HEAP_HINT , INVALID_DEVID ), BAD_FUNC_ARG );
1893+
1894+ #ifdef HAVE_FIPS
1895+ ExpectIntEQ (wc_InitKmac128 (& kmac , NULL , 0 , NULL , 0 , HEAP_HINT ,
1896+ INVALID_DEVID ), KMAC_MIN_KEYLEN_E );
1897+ #else
18841898 /* NULL key with zero length is allowed. */
18851899 ExpectIntEQ (wc_InitKmac128 (& kmac , NULL , 0 , NULL , 0 , HEAP_HINT ,
18861900 INVALID_DEVID ), 0 );
1901+ #endif
1902+
18871903 wc_Kmac128_Free (& kmac );
18881904
18891905 /* wc_Kmac128_Update argument checks. */
@@ -2149,7 +2165,16 @@ int test_wc_Kmac256_api(void)
21492165 EXPECT_DECLS ;
21502166#ifdef WOLFSSL_KMAC256
21512167 wc_Kmac kmac ;
2168+ #ifdef HAVE_FIPS
2169+ static const byte key [KMAC_FIPS_MIN_KEY ] =
2170+ { 0x00 , 0x01 , 0x02 , 0x03 ,
2171+ 0x00 , 0x01 , 0x02 , 0x03 ,
2172+ 0x00 , 0x01 , 0x02 , 0x03 ,
2173+ 0x00 , 0x01
2174+ };
2175+ #else
21522176 static const byte key [4 ] = { 0x00 , 0x01 , 0x02 , 0x03 };
2177+ #endif
21532178 static const byte msg [4 ] = { 0x00 , 0x01 , 0x02 , 0x03 };
21542179 byte out [200 ];
21552180 byte out2 [200 ];
@@ -2161,8 +2186,10 @@ int test_wc_Kmac256_api(void)
21612186 INVALID_DEVID ), BAD_FUNC_ARG );
21622187 ExpectIntEQ (wc_InitKmac256 (& kmac , key , (word32 )sizeof (key ), NULL , 4 ,
21632188 HEAP_HINT , INVALID_DEVID ), BAD_FUNC_ARG );
2189+ #ifndef HAVE_FIPS
21642190 ExpectIntEQ (wc_InitKmac256 (& kmac , NULL , 0 , NULL , 0 , HEAP_HINT ,
21652191 INVALID_DEVID ), 0 );
2192+ #endif
21662193 wc_Kmac256_Free (& kmac );
21672194
21682195 /* wc_Kmac256_Update argument checks. */
@@ -2478,7 +2505,16 @@ int test_wc_Kmac_Copy(void)
24782505#ifdef WOLFSSL_KMAC128
24792506 wc_Kmac kmac ;
24802507 wc_Kmac copy ;
2508+ #ifdef HAVE_FIPS
2509+ static const byte key [KMAC_FIPS_MIN_KEY ] =
2510+ { 0x00 , 0x01 , 0x02 , 0x03 ,
2511+ 0x00 , 0x01 , 0x02 , 0x03 ,
2512+ 0x00 , 0x01 , 0x02 , 0x03 ,
2513+ 0x00 , 0x01
2514+ };
2515+ #else
24812516 static const byte key [4 ] = { 0x00 , 0x01 , 0x02 , 0x03 };
2517+ #endif
24822518 static const byte msg [8 ] = {
24832519 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07
24842520 };
0 commit comments