unfold hmac256drbgabs_generate.
remember  (@Zlength (@reptype hmac_drbg_compspecs.CompSpecs tuchar)
(@map Int.int val Vint (@map Z Int.int Int.repr bytes))) as len.
remember (HMAC256DRBGabs key V reseed_counter entropy_len prediction_resistance
reseed_interval) as A.
remember (HMAC256DRBGabs l0 l z entropy_len b reseed_interval) as B.
assert (HB: B = (hmac256drbgabs_generate A s len [])).
{ clear - Heqlen ASS8 H0. rewrte . rewrite ASS8 in H0.  subst.  subst. rewrite ASS8 in H0. unfold hmac256drbgabs_generate,  mbedtls_HMAC256_DRBG_generate_function. simpl in H0. rewrite H0.
rewrite <- HB.
cancel.
remember (hmac256drbgabs_generate
(HMAC256DRBGabs key V reseed_counter entropy_len prediction_resistance
reseed_interval) s (Zlength (map Vint (map Int.repr bytes))) (@nil Z)) as hh; clear Heqhh.
destruct initial_state as [? ? ? ? ?]. simpl.
unfold hmac256drbgabs_to_state.
remember (mbedtls_HMAC256_DRBG_generate_function s I
(Zlength (map Vint (map Int.repr bytes))) []).
assert (r=ENTROPY.success (bytes, J) ss).
{ subst r. apply ASS8. } clear Heqr. cancel.
remember (hmac256drbgabs_generate I s
(Zlength (map Vint (map Int.repr bytes))) []) as h.
unfold hmac256drbgabs_generate in Heqh.
unfold hmac256drbgabs_common_mpreds; simpl.
remember (mbedtls_HMAC256_DRBG_generate_function s I
(Zlength (map Vint (map Int.repr bytes))) []).
assert (r=ENTROPY.success (bytes, J) ss).
{ subst r. apply ASS8. } clear Heqr.
Exists (hmac256drbgabs_to_state h initial_state).
apply andp_right.
admit. OK, is on comment
entailer.
cancel.
destruct I. destruct J as [[[[? ?] ?] ?] ?].
eapply derives_trans. apply sepcon_derives. apply derives_refl.
instantiate (1:=emp).
apply orp_left. trivial. normalize. unfold hmac256drbgabs_generate.
remember  (@Zlength (@reptype hmac_drbg_compspecs.CompSpecs tuchar)
(@map Int.int val Vint (@map Z Int.int Int.repr bytes))) as len.
remember (HMAC256DRBGabs key V reseed_counter entropy_len prediction_resistance
reseed_interval) as A.
remember (HMAC256DRBGabs l0 l z entropy_len b reseed_interval) as B.
assert (HB: B = (hmac256drbgabs_generate A s len [])).
{ clear - Heqlen ASS8 H0. rewrte . rewrite ASS8 in H0.  subst.  subst. rewrite ASS8 in H0. unfold hmac256drbgabs_generate,  mbedtls_HMAC256_DRBG_generate_function. simpl in H0. rewrite H0.
rewrite <- HB.
cancel.
remember (hmac256drbgabs_generate
(HMAC256DRBGabs key V reseed_counter entropy_len prediction_resistance
reseed_interval) s (Zlength (map Vint (map Int.repr bytes))) (@nil Z)) as hh; clear Heqhh.
destruct initial_state as [? ? ? ? ?]. simpl.
unfold hmac256drbgabs_to_state.
Print hmac256drbgstate. cancel. simpl.
remember ().
unfold hmac256drbgabs_generate.
normalize. cancel.
Qed.
remember (hmac256drbgabs_generate I s (Zlength (map Vint (map Int.repr bytes)))
[]).
unfold hmac256drbgabs_generate. rewrite ASS8. clear ASS8.
destruct I as [K V RC EL PR RI]. simpl in *.
destruct J as [[[[VAL KEY] RCC] SecStr] PRflag]. simpl. rewrite ASS7. subst h; simpl.
destruct I (hmac256drbgabs_generate I s (Zlength (map Vint (map Int.repr bytes))) []).
unfold hmac256drbgabs_common_mpreds. simpl.
unfold hmac256drbgabs_generate in Heqh. rewrite ASS8 in Heqh.
subst h. entailer.
Locate hmac256drbgabs.
destruct I as [K V RC EL PR RI]. simpl in *.
Print DRBG_functions.DRBG_state_handle. destruct J as [[[[VAL KEY] RCC] SecStr] PRflag]. subst h; simpl.
unfold return_value_relate_result, da_emp; simpl. entailer!.
unfold hmac256drbgabs_common_mpreds. simpl.
cancel.
eapply derives_trans. apply sepcon_derives. apply derives_refl.
instantiate (1:=emp). 2: cancel.
apply orp_left. trivial. normalize.
Qed. ntailer.
normalize. cancel. destruct (
destruct I. simpl in *.
apply Zgt_is_gt_bool_f in ASS7. rewrite ASS7 in *.
rewrite ASS8 in *; clear ASS8.  unfold return_value_relate_result in *. simpl in *.
unfold da_emp; simpl. unfold hmac256drbgabs_common_mpreds; simpl. unfold hmac256drbgabs_to_state. simpl.
destruct xx as [[[[V' key'] rc'] x']pr'].
destruct initial_state. simpl.
unfold hmac256drbgstate_md_info_pointer. simpl.
unfold hmac256drbgabs_common_mpreds. simpl.
unfold hmac256drbgabs_to_state, hmac256drbgstate_md_info_pointer.
simpl.
unfold mbedtls_HMAC256_DRBG_generate_function in H5.
destruct initial_state_abs.  simpl in *. rewrite H5.
remember (Z.gtb out_len 1024). Focus 2. rewrite if_false.
rewrite H5. Exists (Vint v). entailer!.
Qed.
*)

(* Specifications: *)
Lemma body_hmac_drbg_init: semax_body HmacDrbgVarSpecs HmacDrbgFunSpecs
f_mbedtls_hmac_drbg_init hmac_drbg_init_spec.
Lemma body_zeroize: semax_body HmacDrbgVarSpecs HmacDrbgFunSpecs
f_mbedtls_zeroize mbedtls_zeroize_spec.
Lemma body_hmac_drbg_setPredictionResistance:
semax_body HmacDrbgVarSpecs HmacDrbgFunSpecs
f_mbedtls_hmac_drbg_set_prediction_resistance hmac_drbg_setPredictionResistance_spec.
Lemma body_hmac_drbg_setEntropyLen:
semax_body HmacDrbgVarSpecs HmacDrbgFunSpecs
f_mbedtls_hmac_drbg_set_entropy_len hmac_drbg_setEntropyLen_spec.
Lemma body_hmac_drbg_setReseedInterval:
semax_body HmacDrbgVarSpecs HmacDrbgFunSpecs
f_mbedtls_hmac_drbg_set_reseed_interval hmac_drbg_setReseedInterval_spec.