@@ -113,16 +113,17 @@ void mld_keccakf1600x4_xor_bytes(uint64_t *state, const unsigned char *data0,
113113void mld_keccakf1600x4_permute (uint64_t * state )
114114{
115115#if defined(MLD_USE_FIPS202_X4_NATIVE )
116- mld_keccak_f1600_x4_native (state );
117- #else
116+ if (mld_keccak_f1600_x4_native (state ) == MLD_NATIVE_FUNC_SUCCESS )
117+ {
118+ return ;
119+ }
120+ #endif /* MLD_USE_FIPS202_X4_NATIVE */
118121 mld_keccakf1600_permute (state + MLD_KECCAK_LANES * 0 );
119122 mld_keccakf1600_permute (state + MLD_KECCAK_LANES * 1 );
120123 mld_keccakf1600_permute (state + MLD_KECCAK_LANES * 2 );
121124 mld_keccakf1600_permute (state + MLD_KECCAK_LANES * 3 );
122- #endif /* !MLD_USE_FIPS202_X4_NATIVE */
123125}
124126
125- #if !defined(MLD_USE_FIPS202_X1_NATIVE )
126127static const uint64_t mld_KeccakF_RoundConstants [MLD_KECCAK_NROUNDS ] = {
127128 (uint64_t )0x0000000000000001ULL , (uint64_t )0x0000000000008082ULL ,
128129 (uint64_t )0x800000000000808aULL , (uint64_t )0x8000000080008000ULL ,
@@ -137,7 +138,7 @@ static const uint64_t mld_KeccakF_RoundConstants[MLD_KECCAK_NROUNDS] = {
137138 (uint64_t )0x8000000080008081ULL , (uint64_t )0x8000000000008080ULL ,
138139 (uint64_t )0x0000000080000001ULL , (uint64_t )0x8000000080008008ULL };
139140
140- void mld_keccakf1600_permute (uint64_t * state )
141+ static void mld_keccakf1600_permute_c (uint64_t * state )
141142{
142143 unsigned round ;
143144
@@ -402,12 +403,17 @@ void mld_keccakf1600_permute(uint64_t *state)
402403 state [23 ] = Aso ;
403404 state [24 ] = Asu ;
404405}
405- #else /* !MLD_USE_FIPS202_X1_NATIVE */
406+
406407void mld_keccakf1600_permute (uint64_t * state )
407408{
408- mld_keccak_f1600_x1_native (state );
409- }
409+ #if defined(MLD_USE_FIPS202_X1_NATIVE )
410+ if (mld_keccak_f1600_x1_native (state ) == MLD_NATIVE_FUNC_SUCCESS )
411+ {
412+ return ;
413+ }
410414#endif /* MLD_USE_FIPS202_X1_NATIVE */
415+ mld_keccakf1600_permute_c (state );
416+ }
411417
412418#else /* !MLD_CONFIG_MULTILEVEL_NO_SHARED */
413419
0 commit comments