@@ -219,12 +219,24 @@ static void hash_2_1(uint8_t* chall_1, const uint8_t* mu, const vec_com_t* vecCo
219219 H2_init (& h2_ctx , lambda );
220220
221221 H2_update (& h2_ctx , mu , lambda /8 * 2 );
222- H2_update (& h2_ctx , vecCom -> com , (params -> faest_param .L * (lambda /8 ) * 3 )); // TODO: chekc if len is correct
223- H2_update (& h2_ctx , c , (params -> faest_param .l / 8 ) + 2 * (lambda /8 ) + UNIVERSAL_HASH_B ); // TODO: check if len is correct
222+ H2_update (& h2_ctx , vecCom -> com , (params -> faest_param .L * (lambda /8 ) * 3 )); // L * com_size (where com_size = lambda/8 * 3) // TODO: check if len is correct
223+ H2_update (& h2_ctx , c , (( params -> faest_param .l / 8 ) + 2 * (lambda /8 ) + UNIVERSAL_HASH_B ) * params -> faest_param . tau ); // TODO: check if len is correct
224224 H2_update (& h2_ctx , iv , 16 );
225225 H2_final (& h2_ctx , chall_1 , (5 * lambda / 8 ) + 8 );
226226}
227227
228+ // Called in FAEST.Sign()::15
229+ static void hash_2_2 (uint8_t * chall_2 , const uint8_t * chall_1 , const uint8_t * u_tilde , const uint8_t * h_v , const uint8_t * d , unsigned int lambda , const faest_paramset_t * params ) {
230+ H2_context_t h2_ctx ;
231+ H2_init (& h2_ctx , lambda );
232+
233+ H2_update (& h2_ctx , chall_1 , (5 * lambda /8 ) + 8 );
234+ H2_update (& h2_ctx , u_tilde , lambda /8 + UNIVERSAL_HASH_B ); // TODO: check if len is correct
235+ H2_update (& h2_ctx , h_v , lambda /8 * 2 );
236+ H2_update (& h2_ctx , d , params -> faest_param .l / 8 ); // ell_bytes
237+ H2_final (& h2_ctx , chall_2 , (3 * lambda / 8 ) + 8 );
238+ }
239+
228240// Called in FAEST.Sign()::4
229241static void hash_3 (uint8_t * r , uint8_t * sig , const uint8_t * owf_sk , const uint8_t * mu , const uint8_t * rho , unsigned int lambda , const faest_paramset_t * params ) {
230242 H3_context_t h3_ctx ;
@@ -360,15 +372,15 @@ void faest_sign(uint8_t* sig, const uint8_t* msg, size_t msg_len, const uint8_t*
360372 H5_final (& h5_ctx_1 , h_v , lambda /8 * 2 );
361373 }
362374
363- // Step: 9, 10
375+ // ::13
364376 uint8_t * w = aes_extend_witness (owf_key , owf_input , params );
365- // Step: 11
377+ // ::14
366378 xor_u8_array (w , u , signature_d (sig , params ), ell_bytes );
367379
368- // Step: 12
380+ // ::15
369381 uint8_t chall_2 [3 * MAX_LAMBDA_BYTES + 8 ];
370- hash_challenge_2 (chall_2 , chall_1 , signature_u_tilde (sig , params ), h_v , signature_d (sig , params ),
371- lambda , l );
382+ hash_2_2 (chall_2 , chall_1 , signature_u_tilde (sig , params ), h_v , signature_d (sig , params ), lambda , params );
383+
372384
373385 // Step: 14..15
374386 // transpose is computed in aes_prove
0 commit comments