Local Open Scope logic.
Definition WF (I:hmac256drbgabs):=
Zlength (hmac256drbgabs_value I) = 32 /\
0 < hmac256drbgabs_entropy_len I <= 384 /\
RI_range (hmac256drbgabs_reseed_interval I)  /\
0 <= hmac256drbgabs_reseed_counter I < Int.max_signed.
Definition hmac_drbg_random_spec_simple :=
DECLARE _mbedtls_hmac_drbg_random
WITH output: val, n: Z,
ctx: val, i: hmac256drbgstate,
I: hmac256drbgabs,
info: md_info_state,
s: ENTROPY.stream, bytes:_, J:_, ss:_, gv: globals
PRE [_p_rng OF tptr tvoid, _output OF tptr tuchar, _out_len OF tuint ]
PROP ( WF I;
0 <= n <= 1024;
mbedtls_HMAC256_DRBG_generate_function s I n [] = ENTROPY.success (bytes, J) ss)
LOCAL (temp _p_rng ctx; temp _output output;
temp _out_len (Vint (Int.repr n)); gvars gv)
SEP (
data_at_ Ews (tarray tuchar n) 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 gv)
POST [ tint ] EX F: hmac256drbgabs, EX f: hmac256drbgstate,
PROP (F = match J with ((((VV, KK), RC), _), PR) =>
HMAC256DRBGabs KK VV RC (hmac256drbgabs_entropy_len I) PR
(hmac256drbgabs_reseed_interval I)
end)
LOCAL (temp ret_temp (Vint Int.zero))
SEP (data_at Ews (tarray tuchar n) (map Vubyte bytes) output;
data_at Ews t_struct_hmac256drbg_context_st f ctx;
hmac256drbg_relate F f;
data_at Ews t_struct_mbedtls_md_info info (hmac256drbgstate_md_info_pointer f);
Stream ss; K_vector gv).

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.