Opaque FunGenerate.

(* Specifications: *)
Lemma Generate_Blist_ok RI k v z n (Z: (z<=RI)%Z) l kk vv zz
(N:(0<n)%nat):
FunGenerate RI (v, k, z) (Z.of_nat ((32 * n)%nat)) = generate_algorithm_success l (kk,vv, zz) ->
exists y,
GenUpdate_original_Blist (bytesToBits k, bytesToBits v) n =
(map bytesToBits y,(bytesToBits vv, bytesToBits kk)) /\ zz=z+1 /\
l = firstn (32 * n) (flatten (rev y)).
Lemma Generate_Bvec_ok' RI (k: list byte) v z n (Z: (z<=RI)%Z) l kk vv zz (N:(0<n)%nat)
(KL: Datatypes.length (bytesToBits k) = 256%nat) (VL:Datatypes.length (bytesToBits v) = 256%nat):
FunGenerate RI (v, k, z) (Z.of_nat ((32 * n)%nat)) = generate_algorithm_success l (kk,vv, zz) ->
match GenUpdate_original_Bvec (of_list_length _ KL, of_list_length _ VL) n with (blocks, kv) =>
zz=z+1 /\
bitsToBytes (@Vector.to_list _ 256 (fst kv)) = vv /\
bitsToBytes (@Vector.to_list _ 256 (snd kv)) = kk /\
l = firstn (32 * n) (bitsToBytes (flatten (rev (map (@Vector.to_list _ 256) blocks))))
end.
Lemma Generate_Bvec_ok RI k v z n (Z: (z<=RI)%Z) (N:(0<n)%nat)
(KL: Datatypes.length (bytesToBits k) = 256%nat)
(VL:Datatypes.length (bytesToBits v) = 256%nat):
match GenUpdate_original_Bvec (of_list_length _ KL, of_list_length _ VL) n with (blocks, (kk,vv)) =>
FunGenerate RI (v, k, z) (Z.of_nat ((32 * n)%nat))
= generate_algorithm_success (firstn (32 * n) (bitsToBytes (flatten (rev (map (@Vector.to_list _ 256) blocks)))))
(bitsToBytes (@Vector.to_list _ 256 vv), bitsToBytes (@Vector.to_list _ 256 kk), z+1)
end.
Lemma Generate_ok' RI k v z n (Z: (z<=RI)%Z) l kk vv zz (N:(0<n)%nat)
(KL: Datatypes.length (bytesToBits k) = 256%nat) (VL:Datatypes.length (bytesToBits v) = 256%nat):
FunGenerate RI (v, k, z) (Z.of_nat ((32 * n)%nat)) = generate_algorithm_success l (kk,vv, zz) ->
match GenUpdate_original_core (of_list_length _ KL, of_list_length _ VL) n with (blocks, kv) =>
zz=z+1 /\
bitsToBytes (@Vector.to_list _ 256 (fst kv)) = vv /\
bitsToBytes (@Vector.to_list _ 256 (snd kv)) = kk /\
l = firstn (32 * n) (bitsToBytes (flatten (map (@Vector.to_list _ 256) blocks)))
end.
Lemma Generate_ok RI k v z n (Z: (z<=RI)%Z) (N:(0<n)%nat)
(KL: Datatypes.length (bytesToBits k) = 256%nat)
(VL:Datatypes.length (bytesToBits v) = 256%nat):
match GenUpdate_original_core (of_list_length _ KL, of_list_length _ VL) n with (blocks, (kk,vv)) =>
FunGenerate RI (v, k, z) (Z.of_nat ((32 * n)%nat))
= generate_algorithm_success (firstn (32 * n) (bitsToBytes (flatten (map (@Vector.to_list _ 256) blocks))))
(bitsToBytes (@Vector.to_list _ 256 vv), bitsToBytes (@Vector.to_list _ 256 kk), z+1)
end.
Lemma Bridge s I n bytes J ss (M: mbedtls_HMAC256_DRBG_generate_function s I n [] = ENTROPY.success (bytes, J) ss):
match I with HMAC256DRBGabs K V reseed_counter entropy_len prediction_resistance reseed_interval =>
reseed_counter <= reseed_interval -> prediction_resistance = false ->
match J with (ws,sstrength,prflag) =>
s=ss /\ FunGenerate reseed_interval (V,K,reseed_counter) n = DRBG_functions.generate_algorithm_success bytes ws
end end.