Definition update_rounds (non_empty_additional: bool): Z :=
if non_empty_additional then 2 else 1.

(* Specifications: *)
Lemma HMAC_DRBG_update_round_incremental:
forall key V initial_state_abs contents n,
(key, V) = HMAC_DRBG_update_round HMAC256 contents
(hmac256drbgabs_key initial_state_abs)
(hmac256drbgabs_value initial_state_abs) n ->
(HMAC256 (V ++ Byte.repr (Z.of_nat n) :: contents) key,
HMAC256 V (HMAC256 (V ++ Byte.repr (Z.of_nat n) :: contents) key)) =
HMAC_DRBG_update_round HMAC256 contents
(hmac256drbgabs_key initial_state_abs)
(hmac256drbgabs_value initial_state_abs) (n + 1).
Lemma HMAC_DRBG_update_round_incremental_Z:
forall key V initial_state_abs contents i,
0 <= i ->
(key, V) = HMAC_DRBG_update_round HMAC256 contents
(hmac256drbgabs_key initial_state_abs)
(hmac256drbgabs_value initial_state_abs) (Z.to_nat i) ->
(HMAC256 (V ++ Byte.repr i :: contents) key,
HMAC256 V (HMAC256 (V ++ Byte.repr i :: contents) key)) =
HMAC_DRBG_update_round HMAC256 contents
(hmac256drbgabs_key initial_state_abs)
(hmac256drbgabs_value initial_state_abs) (Z.to_nat (i + 1)).
Lemma update_char add_len contents (HL:add_len = Zlength contents \/ add_len = 0)
(key1 V0 : list byte) additional reseed_counter entropy_len prediction_resistance V key0
reseed_interval
(H : (key1, V0) =
HMAC_DRBG_update_round HMAC256 (contents_with_add additional add_len contents) key0 V
(Z.to_nat
(if
(negb (Memory.EqDec_val additional nullval) &&
negb (initial_world.EqDec_Z add_len 0))%bool
then 2
else 1))):
hmac256drbgabs_hmac_drbg_update
(HMAC256DRBGabs key0 V reseed_counter entropy_len prediction_resistance
reseed_interval) (contents_with_add additional add_len contents) =
HMAC256DRBGabs key1 V0 reseed_counter entropy_len prediction_resistance
reseed_interval.