(*******Injectivity of pad_inc*************************)

(* Specifications: *)
Lemma pad_injective_aux (l1 l2: list byte) k
(K : k * Int.modulus + (BlockSize + Zlength l1) * 8 =
(BlockSize + Zlength l2) * 8)
(N : k <> 0):
- (BlockSize + Zlength l2 + 9) mod 64 = - (BlockSize + Zlength l1 + 9) mod 64.
Lemma pad_injective_Case5 l1 l2
(H0 : (l1 ++ Byte.repr 128 :: nil) ++
list_repeat (Z.to_nat (- (BlockSize + Zlength l1 + 9) mod 64)) Byte.zero =
(l2 ++ Byte.repr 128 :: nil) ++
list_repeat (Z.to_nat (- (BlockSize + Zlength l2 + 9) mod 64)) Byte.zero)
(H : (BlockSize + Zlength l1) * 8 =
((BlockSize + Zlength l2) * 8) mod Int.modulus)
(Nonneg1 : 0 <= (BlockSize + Zlength l1) * 8)
(l : (BlockSize + Zlength l1) * 8 < Int.modulus):
length l1 = length l2.
Lemma pad_inc_injective: forall l1 l2, pad_inc l1 = pad_inc l2 -> l1=l2.
(********************************************************************)
Lemma block_8 A (l:list A): length l = b -> InBlocks 8 l.
Lemma sha_splitandpad_app : forall (l m : Blist),
length l = b ->
sha_splitandpad (l ++ m) = l ++ sha_splitandpad_inc m.
Lemma pad_injective_aux (l1 l2: list Z) k
(K : k * Int.modulus + (BlockSize + Zlength l1) * 8 =
(BlockSize + Zlength l2) * 8)
(N : k <> 0):
- (BlockSize + Zlength l2 + 9) mod 64 = - (BlockSize + Zlength l1 + 9) mod 64.
Lemma pad_injective_Case5 l1 l2
(H0 : (l1 ++ 128 :: nil) ++
list_repeat (Z.to_nat (- (BlockSize + Zlength l1 + 9) mod 64)) 0 =
(l2 ++ 128 :: nil) ++
list_repeat (Z.to_nat (- (BlockSize + Zlength l2 + 9) mod 64)) 0)
(H : (BlockSize + Zlength l1) * 8 =
((BlockSize + Zlength l2) * 8) mod Int.modulus)
(Nonneg1 : 0 <= (BlockSize + Zlength l1) * 8)
(l : (BlockSize + Zlength l1) * 8 < Int.modulus):
length l1 = length l2.
Lemma pad_inc_injective: forall l1 l2, pad_inc l1 = pad_inc l2 -> l1=l2.
(********************************************************************)
Lemma block_8 A (l:list A): length l = b -> InBlocks 8 l.
Lemma xor_equiv_byte: forall xpad XPAD k K, isbyteZ XPAD ->
bytes_bits_lists xpad (HP.HMAC_SHA256.sixtyfour XPAD) ->
bytes_bits_lists k (map Byte.unsigned K) ->
bytes_bits_lists (BLxor k xpad) (HP.HMAC_SHA256.mkArgZ K (Byte.repr XPAD)).