Definition stream_dummy (result: string) (n: nat) : option bool :=
  let hex := bytesToBits (hexstring_to_Zlist result) in
  if nth_ok n hex false then Some (nth n hex false)
  else None.Definition get_nonce_dummy (result: string) (_: unit) := hexstring_to_Zlist result.Fixpoint DRBG_generate_check (state_handle: DRBG_state_handle) (internal_states: list (string * string * string * string)) (returned_bits: string) :=
  match internal_states with
    | [] => True
    | (key, v, additional_input, entropy_input_reseed)::[] =>
      let test_HMAC256_DRBG_reseed_function := HMAC256_DRBG_reseed_function 32 32 256 in
      let test_HMAC256_DRBG_generate_function := HMAC256_DRBG_generate_function test_HMAC256_DRBG_reseed_function 1024 128 128 in
      let key := hexstring_to_Zlist key in
      let value := hexstring_to_Zlist v in
      let additional_input := hexstring_to_Zlist additional_input in
      let returned_bits := hexstring_to_Zlist returned_bits in
      match test_HMAC256_DRBG_generate_function (stream_dummy entropy_input_reseed) state_handle 128 256 true additional_input with
        | ENTROPY.success (returned_bits', ((value', key', _), _, _)) _ => listZ_eq value value' = true /\ listZ_eq key key' = true /\ listZ_eq returned_bits returned_bits' = true
        | ENTROPY.error _ _ => False
      end
    | (key, v, additional_input, entropy_input_reseed)::tl =>
      let test_HMAC256_DRBG_reseed_function := HMAC256_DRBG_reseed_function 32 32 256 in
      let test_HMAC256_DRBG_generate_function := HMAC256_DRBG_generate_function test_HMAC256_DRBG_reseed_function 1024 128 128 in
      let key := hexstring_to_Zlist key in
      let value := hexstring_to_Zlist v in
      let additional_input := hexstring_to_Zlist additional_input in
      match test_HMAC256_DRBG_generate_function (stream_dummy entropy_input_reseed) state_handle 128 256 true additional_input with
        | ENTROPY.success (_, ((value', key', x), y, z)) _ => listZ_eq value value' = true /\ listZ_eq key key' = true /\ DRBG_generate_check ((value', key', x), y, z) tl returned_bits
        | ENTROPY.error _ _ => False
      end
  end.Definition DRBG_check (entropy_input nonce key value personalization_string: string) (internal_states: list (string * string * string * string)) (returned_bits: string) :=
  let key := hexstring_to_Zlist key in
  let value := hexstring_to_Zlist value in
  let personalization_string := hexstring_to_Zlist personalization_string in
  match HMAC256_DRBG_instantiate_function 32 32 (get_nonce_dummy nonce) 256 256 true (stream_dummy entropy_input) 256 true personalization_string with
    | ENTROPY.success ((value', key', x), y, z) _ => listZ_eq value value' = true /\ listZ_eq key key' = true /\ DRBG_generate_check ((value', key', x), y, z) internal_states returned_bits
    | _ => False
  end.

Lemma test0: DRBG_check "9969e54b4703ff31785b879a7e5c0eae0d3e309559e9fe96b0676d49d591ea4d" "07d20d46d064757d3023cac2376127ab" "c2d1fd328b9789a72097325a5623f1b23eed73ed2fdcb477e9a2dd10a96f9d27" "cba657aa552473950ef85a02f228224514c648f01cdb2cd04aa773c25ca836f2" "" [ ("d89d68107440e91a57a841b688ad0fd1fbeb440d26b199bad639280ba809da2e"%string, "df85d42ae075f3560d00a653ecf4dba120a90dc4510245aaf77c799f488df76e"%string, ""%string, "c60f2999100f738c10f74792676a3fc4a262d13721798046e29a295181569f54"%string); ("ee60a512e1383ffef37971a07a9754ceeb5b3d0aa640514e13e2a7359ec7157e"%string, "a964fd634f8f05a22719d37453ede555d6dd8fdf7beccf757e69c6fa782c5f16"%string, ""%string, "c11d4524c9071bd3096015fcf7bc24a607f22fa065c937658a2a77a8699089f4"%string) ] "abc015856094803a938dffd20da94843870ef935b82cfec17706b8f551b8385044235dd44b599f94b39be78dd476e0cf11309c995a7334e0a78b37bc9586235086fa3b637ba91cf8fb65efa22a589c137531aa7b2d4e2607aac27292b01c698e6e01ae679eb87c01a89c7422d4372d6d754ababb4bf896fcb1cd09d692d0283f"%string.