(*SHA_specific stuff Require Import SHA256. Require Import pure_lemmas. Require Import sha_padding_lemmas. Require Import ShaInstantiation. Require Import hmac_common_lemmas. Require Import HMAC256_spec_pad. Require Import HMAC256_spec_list. Require Import HMAC256_equivalence.  Lemma splitAndPad_v_to_sha_splitandpad_blocks l: map Vector.to_list (splitAndPad_v l) = sha_splitandpad_blocks l.  Lemma splitAndPad_1to1 b1 b2 (B:splitAndPad_v b1 = splitAndPad_v b2) (L1: NPeano.divide 8 (length b1)) (L2: NPeano.divide 8 (length b2)): b1 = b2. (*longer proof now in HAMC_equivalence Lemma opad_ne_ipad : EQ.opad_v <> EQ.ipad_v. intros N. assert (Vector.to_list EQ.opad_v = Vector.to_list EQ.ipad_v). rewrite N; trivial. unfold EQ.opad_v, EQ.ipad_v in H. repeat rewrite of_length_proof_irrel in H. unfold HP.Opad, HP.Ipad in H. simpl in H. discriminate. Qed. *)
*)
(* A definition of a PRF in the form of a predicate. *)
Set Implicit Arguments.
Module Type HMAC_is_PRF_Parameters (HF:HP.HASH_FUNCTION) (EQ: EQUIV_Inst HF).
Parameter P : Blist -> Prop.
Parameter HP: forall m, P m -> NPeano.Nat.divide 8 (length m).
Parameter splitAndPad_1to1: forall b1 b2 (B:EQ.splitAndPad_v b1 = EQ.splitAndPad_v b2)
(L1: NPeano.Nat.divide 8 (length b1))
(L2: NPeano.Nat.divide 8 (length b2)), b1 = b2.
End HMAC_is_PRF_Parameters.
Module HMAC_is_PRF (HF:HP.HASH_FUNCTION) (EQ: EQUIV_Inst HF) (PARS:HMAC_is_PRF_Parameters HF EQ).
Definition isPRF {D R Key:Set} (RndKey:Comp Key) (RndR: Comp R) (f: Key -> D -> R)
(ED:EqDec D) (ER:EqDec R) advantage adversary :=
PRF_Advantage RndKey RndR f _ _ adversary <= advantage.

(* Specifications: *)
(* Parameter P : Blist -> Prop. Parameter HP: forall m, P m -> NPeano.divide 8 (length m).  Parameter splitAndPad_1to1: forall b1 b2 (B:EQ.splitAndPad_v b1 = EQ.splitAndPad_v b2) (L1: NPeano.divide 8 (length b1)) (L2: NPeano.divide 8 (length b2)), b1 = b2. *)
Lemma wrappedSAP_1_1_local (msg1 msg2 : HMAC_Abstract.Message PARS.P):
HMAC_Abstract.wrappedSAP _ _ EQ.splitAndPad_v msg1 = HMAC_Abstract.wrappedSAP _ _ EQ.splitAndPad_v msg2 -> msg1 = msg2.