Require sha.sha.
Local Open Scope logic.
(*TODO: eliminate*)
Ltac canon_load_result ::= idtac.

(* Specifications: *)
Lemma isbyte_zeroExt8: forall x,
0 <= x <= Byte.max_unsigned ->
Int.repr x = (Int.zero_ext 8 (Int.repr x)).
Lemma isbyte_zeroExt8' : forall x, Int.unsigned (Int.zero_ext 8 x) <= Byte.max_unsigned.
(* Lemma eval_cast_tuchar_of_isbyteZ q: isbyteZ q -> eval_cast tuchar tuchar (Vint (Int.repr q)) = Vint (Int.repr q).  Lemma Znth_map_Vint_is_int_I8: forall l (i : Z) (F: Forall isbyteZ l), 0 <= i < Zlength l -> is_int I8 Unsigned (Znth i (map Vint (map Int.repr l))).  Lemma Znth_map_Vint_is_int_I8': forall l (i : Z) , 0 <= i < Zlength l -> is_int I8 Unsigned (Znth i (map Vint (map Int.repr (map Byte.unsigned l)))). *)
Lemma UPD_IPAD: forall
(key : list byte)
(ZLI : Zlength
(HMAC_SHA256.mkArg (HMAC_SHA256.mkKey key) Ipad) =
64)
(i : Z)
(I : 0 <= i < 64)
(X : Znth i (map Vubyte (HMAC_SHA256.mkKey key)) =
Vubyte (nth (Z.to_nat i) (HMAC_SHA256.mkKey key) Byte.zero)),
upd_Znth i
(sublist 0 i
(map Vubyte
(HMAC_SHA256.mkArg (HMAC_SHA256.mkKey key) Ipad)) ++
sublist i 64 (default_val (Tarray tuchar 64 noattr)))
(Vubyte
(Byte.xor (nth (Z.to_nat i) (HMAC_SHA256.mkKey key) Byte.zero) (Byte.repr 54))) =
sublist 0 (i + 1)
(map Vubyte
(HMAC_SHA256.mkArg (HMAC_SHA256.mkKey key) Ipad)) ++
sublist (i + 1) 64 (default_val (Tarray tuchar 64 noattr)).
Lemma UPD_OPAD: forall
(key : list byte)
(ZLI : Zlength (HMAC_SHA256.mkArg (HMAC_SHA256.mkKey key) Ipad) = 64)
(ZLO : Zlength (HMAC_SHA256.mkArg (HMAC_SHA256.mkKey key) Opad) = 64)
(i : Z)
(I : 0 <= i < 64)
(X : Znth i (map Vubyte (HMAC_SHA256.mkKey key)) =
Vubyte (nth (Z.to_nat i) (HMAC_SHA256.mkKey key) Byte.zero)),upd_Znth i
(sublist 0 i
(map Vubyte
(HMAC_SHA256.mkArg (HMAC_SHA256.mkKey key) Opad)) ++
sublist i 64
(map Vubyte
(HMAC_SHA256.mkArg (HMAC_SHA256.mkKey key) Ipad)))
(Vubyte
(Byte.xor (Byte.repr 92)
(nth (Z.to_nat i) (HMAC_SHA256.mkKey key) Byte.zero))) =
sublist 0 (i + 1)
(map Vubyte (HMAC_SHA256.mkArg (HMAC_SHA256.mkKey key) Opad)) ++
sublist (i + 1) 64
(map Vubyte (HMAC_SHA256.mkArg (HMAC_SHA256.mkKey key) Ipad)).