(* Definition myProp s n I (i F:hmac256drbgstate): Prop := F = (hmac256drbgabs_to_state (hmac256drbgabs_generate I s n []) i).  Definition hmac_drbg_random_spec_simple := DECLARE _mbedtls_hmac_drbg_random WITH output: val, out_len: Z, ctx: val, i: hmac256drbgstate, I: hmac256drbgabs, kv: val, info: md_info_state, s: ENTROPY.stream, bytes:_, J:_, ss:_ PRE [_p_rng OF tptr tvoid, _output OF tptr tuchar, _out_len OF tuint ] PROP ( WF I; 0 <= out_len <= 1024; mbedtls_HMAC256_DRBG_generate_function s I out_len [] = ENTROPY.success (bytes, J) ss) LOCAL (temp _p_rng ctx; temp _output output; temp _out_len (Vint (Int.repr out_len)); gvar sha._K256 kv) SEP ( data_at_ Ews (tarray tuchar out_len) output; data_at Ews t_struct_hmac256drbg_context_st i ctx; hmac256drbg_relate I i; data_at Ews t_struct_mbedtls_md_info info (hmac256drbgstate_md_info_pointer i); Stream s; K_vector kv) POST [ tint ] EX final_state: hmac256drbgstate, PROP (final_state = hmac256drbgabs_to_state (hmac256drbgabs_generate I s out_len []) i) LOCAL (temp ret_temp (Vint Int.zero)) SEP (data_at Ews (tarray tuchar out_len) (map Vint (map Int.repr bytes)) output; data_at Ews t_struct_hmac256drbg_context_st final_state ctx; hmac256drbg_relate (hmac256drbgabs_generate I s out_len []) final_state; data_at Ews t_struct_mbedtls_md_info info (hmac256drbgstate_md_info_pointer final_state); Stream ss; K_vector kv). (* generatePOST (Vint Int.zero) nil nullval 0 output out_len ctx initial_state I kv info_contents s). *)

(* Specifications: *)
Lemma AUX s I n bytes J ss: mbedtls_HMAC256_DRBG_generate_function s I n [] =
ENTROPY.success (bytes, J) ss ->
hmac256drbgabs_generate I s n [] =
match J with ((((VV, KK), RC), _), PR) =>
HMAC256DRBGabs KK VV RC (hmac256drbgabs_entropy_len I) PR
(hmac256drbgabs_reseed_interval I)
end.