@@ -231,15 +231,15 @@ int crypto_sign_keypair(uint8_t *pk, uint8_t *sk)
231231 return result ;
232232}
233233
234- static void shake256_absorb_with_residual ( keccak_state * state ,
235- const uint8_t * in , size_t inlen ,
236- uint8_t * residual , size_t * pos )
234+ static void mld_shake256_absorb_with_residual ( mld_shake256ctx * state ,
235+ const uint8_t * in , size_t inlen ,
236+ uint8_t * residual , size_t * pos )
237237__contract__ (
238238 requires (0 <= * pos && pos <= 8 )
239- requires (memory_no_alias (state , sizeof (uint64_t ) * MLD_KECCAK_LANES ))
239+ requires (memory_no_alias (state , sizeof (mld_shake256ctx ) ))
240240 requires (in == NULL || memory_no_alias (in , inlen ))
241241 requires (memory_no_alias (residual , 8 ))
242- assigns (memory_slice (state , sizeof (uint64_t ) * MLD_KECCAK_LANES ))
242+ assigns (memory_slice (state , sizeof (mld_shake256ctx ) ))
243243 assigns (memory_slice (residual , 8 ))
244244 assigns (* pos )
245245)
@@ -256,14 +256,14 @@ __contract__(
256256 * pos += nb ;
257257 if (* pos == 8 )
258258 {
259- shake256_absorb (state , residual , 8U );
259+ mld_shake256_absorb (state , residual , 8U );
260260 * pos = 0 ;
261261 }
262262 }
263263 nb = inlen & ~7UL ;
264264 if (nb )
265265 {
266- shake256_absorb (state , in , nb );
266+ mld_shake256_absorb (state , in , nb );
267267 in += nb ;
268268 inlen -= nb ;
269269 }
@@ -312,23 +312,22 @@ __contract__(
312312 assigns (memory_slice (out , outlen ))
313313)
314314{
315- keccak_state state ;
315+ mld_shake256ctx state ;
316316 uint8_t buf [8 ];
317317 size_t pos = 0 ;
318- shake256_init (& state );
319- shake256_absorb_with_residual (& state , in1 , in1len , buf , & pos );
320- shake256_absorb_with_residual (& state , in2 , in2len , buf , & pos );
321- shake256_absorb_with_residual (& state , in3 , in3len , buf , & pos );
318+ mld_shake256_init (& state );
319+ mld_shake256_absorb_with_residual (& state , in1 , in1len , buf , & pos );
320+ mld_shake256_absorb_with_residual (& state , in2 , in2len , buf , & pos );
321+ mld_shake256_absorb_with_residual (& state , in3 , in3len , buf , & pos );
322322 if (pos )
323323 {
324- shake256_absorb (& state , buf , pos );
324+ mld_shake256_absorb (& state , buf , pos );
325325 }
326326 mld_shake256_finalize (& state );
327327 mld_shake256_squeeze (out , outlen , & state );
328328 mld_shake256_release (& state );
329329
330330 /* @[FIPS204, Section 3.6.3] Destruction of intermediate values. */
331- mld_zeroize (& state , sizeof (state ));
332331 mld_zeroize (& buf , sizeof (buf ));
333332}
334333
0 commit comments