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.Definition noop_reseed_function (s: ENTROPY.stream) (x: DRBG_state_handle) (_: bool) (_: list Z) := ENTROPY.success x s.Fixpoint DRBG_generate_check (state_handle: DRBG_state_handle) (internal_states: list (string * string * string)) (returned_bits: string) :=
  let test_HMAC256_DRBG_generate_function := HMAC256_DRBG_generate_function noop_reseed_function 1024 128 128 in
  match internal_states with
    | [] => True
    | (key, v, additional_input)::[] =>
      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 "") state_handle 128 256 false 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)::tl =>
      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 "") state_handle 128 256 false 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)) (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 false (stream_dummy entropy_input) 256 false 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 test4: DRBG_check "74755f196305f7fb6689b2fe6835dc1d81484fc481a6b8087f649a1952f4df6a"%string "c36387a544a5f2b78007651a7b74b749" "9adfb5d44f961fc5e8dd8392a2faed6b7ea120be0390aed78aec9a0f0ad96ba4"%string "b80f5b61e4095fc3191d9abd3f64ae42eaf59062f6f1c9d0302f3192addd9d0f"%string "" [ ("3529765f9d1b3a4e4d2aa1f76b79078c13e491dd084c91c9c60a1ca71d136cb5"%string, "2459df9b9298b87758fee7eb96fcef9417d7bcedfaedf051179b5308f6affbda"%string, ""%string); ("b13c4e2404d451638990a1c93cf61ec24ee9786170c03381d555caf34462d9e5"%string, "77b52d69a686cd0ec28905a8cdb3579f2e429a5a8a4403842d81faf3c72f768a"%string, ""%string) ] "b2896f3af4375dab67e8062d82c1a005ef4ed119d13a9f18371b1b873774418684805fd659bfd69964f83a5cfe08667ddad672cafd16befffa9faed49865214f703951b443e6dca22edb636f3308380144b9333de4bcb0735710e4d9266786342fc53babe7bdbe3c01a3addb7f23c63ce2834729fabbd419b47beceb4a460236"%string.