file_name
stringlengths
5
52
name
stringlengths
4
95
original_source_type
stringlengths
0
23k
source_type
stringlengths
9
23k
source_definition
stringlengths
9
57.9k
source
dict
source_range
dict
file_context
stringlengths
0
721k
dependencies
dict
opens_and_abbrevs
listlengths
2
94
vconfig
dict
interleaved
bool
1 class
verbose_type
stringlengths
1
7.42k
effect
stringclasses
118 values
effect_flags
sequencelengths
0
2
mutual_with
sequencelengths
0
11
ideal_premises
sequencelengths
0
236
proof_features
sequencelengths
0
1
is_simple_lemma
bool
2 classes
is_div
bool
2 classes
is_proof
bool
2 classes
is_simply_typed
bool
2 classes
is_type
bool
2 classes
partial_definition
stringlengths
5
3.99k
completed_definiton
stringlengths
1
1.63M
isa_cross_project_example
bool
1 class
Vale.Def.Words.Two_s.fsti
Vale.Def.Words.Two_s.two_to_nat
val two_to_nat (size: nat) (x: two (natN (pow2 size))) : natN (pow2 (2 * size))
val two_to_nat (size: nat) (x: two (natN (pow2 size))) : natN (pow2 (2 * size))
let two_to_nat (size:nat) (x:two (natN (pow2 size))) : natN (pow2 (2 * size)) = two_to_nat_unfold size x
{ "file_name": "vale/specs/defs/Vale.Def.Words.Two_s.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 26, "end_line": 31, "start_col": 0, "start_line": 30 }
module Vale.Def.Words.Two_s open Vale.Def.Words_s open FStar.Mul unfold let two_map (#a #b:Type) (f:a -> b) (x:two a) : two b = let Mktwo x0 x1 = x in Mktwo (f x0) (f x1) unfold let two_map2 (#a #b:Type) (f:a -> a -> b) (x y:two a) : two b = let Mktwo x0 x1 = x in let Mktwo y0 y1 = y in Mktwo (f x0 y0) (f x1 y1) unfold let nat_to_two_unfold (size:nat) (n:natN (pow2 (2 * size))) : two (natN (pow2 size)) = let n1 = pow2_norm size in let n2 = pow2_norm (2 * size) in Mktwo (n % n1) ((n / n1) % n1) let nat_to_two (size:nat) (n:natN (pow2 (2 * size))) : two (natN (pow2 size)) = nat_to_two_unfold size n unfold let two_to_nat_unfold (size:nat) (x:two (natN (pow2 size))) : natN (pow2 (2 * size)) = let n1 = pow2_norm size in let n2 = pow2_norm (2 * size) in let Mktwo x0 x1 = x in int_to_natN n2 (x0 + x1 * n1)
{ "checked_file": "/", "dependencies": [ "Vale.Def.Words_s.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.Def.Words.Two_s.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
size: Prims.nat -> x: Vale.Def.Words_s.two (Vale.Def.Words_s.natN (Prims.pow2 size)) -> Vale.Def.Words_s.natN (Prims.pow2 (2 * size))
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Vale.Def.Words_s.two", "Vale.Def.Words_s.natN", "Prims.pow2", "Vale.Def.Words.Two_s.two_to_nat_unfold", "FStar.Mul.op_Star" ]
[]
false
false
false
false
false
let two_to_nat (size: nat) (x: two (natN (pow2 size))) : natN (pow2 (2 * size)) =
two_to_nat_unfold size x
false
FStar.Array.fst
FStar.Array.array
val array (a:Type0) : Type0
val array (a:Type0) : Type0
let array a = ref (seq a)
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 25, "end_line": 28, "start_col": 0, "start_line": 28 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type0 -> Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.ST.ref", "FStar.Seq.Base.seq" ]
[]
false
false
false
true
true
let array a =
ref (seq a)
false
FStar.Array.fst
FStar.Array.as_ref
val as_ref (#a:Type0) (arr:array a) : GTot (ref (seq a))
val as_ref (#a:Type0) (arr:array a) : GTot (ref (seq a))
let as_ref #_ arr = arr
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 23, "end_line": 30, "start_col": 0, "start_line": 30 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
arr: FStar.Array.array a -> Prims.GTot (FStar.ST.ref (FStar.Seq.Base.seq a))
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Array.array", "FStar.ST.ref", "FStar.Seq.Base.seq" ]
[]
false
false
false
false
false
let as_ref #_ arr =
arr
false
LowParse.Spec.VLGen.fst
LowParse.Spec.VLGen.serialize_bounded_vlgen_payload
val serialize_bounded_vlgen_payload (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (serializer (parse_bounded_vlgen_payload min max s sz))
val serialize_bounded_vlgen_payload (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (serializer (parse_bounded_vlgen_payload min max s sz))
let serialize_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (serializer (parse_bounded_vlgen_payload min max s sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_serializer (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) (fun _ -> ()) else serialize_weaken (parse_bounded_vlgen_payload_kind min max k) (serialize_synth (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () )
{ "file_name": "src/lowparse/LowParse.Spec.VLGen.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 7, "end_line": 323, "start_col": 0, "start_line": 297 }
module LowParse.Spec.VLGen include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLData // for parse_bounded_vldata_strong_t (* TODO: this module should deprecate and replace LowParse.Spec.VLData *) module U32 = FStar.UInt32 module Seq = FStar.Seq let tag_of_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : GTot (bounded_int32 min max) = U32.uint_to_t (Seq.length (serialize s x)) inline_for_extraction let synth_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: parse_fldata_strong_t s (U32.v sz)) : Tot (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) = x inline_for_extraction let parse_bounded_vlgen_payload_kind (min: nat) (max: nat { min <= max } ) (k: parser_kind) : Tot parser_kind = [@inline_let] let kmin = k.parser_kind_low in [@inline_let] let min' = if kmin > min then kmin else min in [@inline_let] let max' = match k.parser_kind_high with | None -> max | Some kmax -> if kmax < max then kmax else max in [@inline_let] let max' = if max' < min' then min' else max' in strong_parser_kind min' max' ( match k.parser_kind_metadata with | Some ParserKindMetadataFail -> Some ParserKindMetadataFail | _ -> None ) let parse_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) else weaken (parse_bounded_vlgen_payload_kind min max k) (parse_fldata_strong s (U32.v sz) `parse_synth` synth_bounded_vlgen_payload min max s sz) let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed) )) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input inline_for_extraction let parse_bounded_vlgen_kind (sk: parser_kind) (min: nat) (max: nat { min <= max } ) (k: parser_kind) = and_then_kind sk (parse_bounded_vlgen_payload_kind min max k) let parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (parser (parse_bounded_vlgen_kind sk min max k) (parse_bounded_vldata_strong_t min max s)) = parse_tagged_union pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) let parse_bounded_vlgen_unfold_aux (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1 let parse_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1; if Seq.length input < sz + U32.v len then () else Seq.slice_slice input sz (Seq.length input) 0 (U32.v len) inline_for_extraction let synth_vlgen (min: nat) (max: nat) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : Tot t = x let parse_vlgen_precond (min: nat) (max: nat { min <= max } ) (k: parser_kind) : GTot bool = match k.parser_kind_high with | None -> false | Some kmax -> min <= k.parser_kind_low && kmax <= max let parse_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (parser (parse_bounded_vlgen_kind sk min max k) t) = parse_bounded_vlgen min max pk s `parse_synth` synth_vlgen min max s let parse_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: bytes) : Lemma (let res = parse (parse_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) input; parse_bounded_vlgen_unfold min max pk s input inline_for_extraction let synth_bounded_vlgen_payload_recip (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Tot (parse_fldata_strong_t s (U32.v sz)) = x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLData.fsti.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.VLGen.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLData", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> s: LowParse.Spec.Base.serializer p -> sz: LowParse.Spec.BoundedInt.bounded_int32 min max -> LowParse.Spec.Base.serializer (LowParse.Spec.VLGen.parse_bounded_vlgen_payload min max s sz)
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Combinators.fail_serializer", "LowParse.Spec.VLGen.parse_bounded_vlgen_payload_kind", "LowParse.Spec.Base.refine_with_tag", "LowParse.Spec.VLData.parse_bounded_vldata_strong_t", "LowParse.Spec.VLGen.tag_of_bounded_vlgen_payload", "Prims.unit", "Prims.bool", "LowParse.Spec.Combinators.serialize_weaken", "LowParse.Spec.FLData.parse_fldata_kind", "FStar.UInt32.v", "LowParse.Spec.Combinators.parse_synth", "LowParse.Spec.FLData.parse_fldata_strong_t", "LowParse.Spec.FLData.parse_fldata_strong", "LowParse.Spec.VLGen.synth_bounded_vlgen_payload", "LowParse.Spec.Combinators.serialize_synth", "LowParse.Spec.FLData.serialize_fldata_strong", "LowParse.Spec.VLGen.synth_bounded_vlgen_payload_recip", "LowParse.Spec.VLGen.parse_bounded_vlgen_payload", "Prims.op_BarBar", "Prims.op_GreaterThan", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_low", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_high" ]
[]
false
false
false
false
false
let serialize_bounded_vlgen_payload (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (serializer (parse_bounded_vlgen_payload min max s sz)) =
let bounds_off = k.parser_kind_low > U32.v sz || (match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz) in if bounds_off then fail_serializer (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) (fun _ -> ()) else serialize_weaken (parse_bounded_vlgen_payload_kind min max k) (serialize_synth (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) ())
false
LowParse.Spec.VLGen.fst
LowParse.Spec.VLGen.synth_bounded_vlgen_payload_recip
val synth_bounded_vlgen_payload_recip (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Tot (parse_fldata_strong_t s (U32.v sz))
val synth_bounded_vlgen_payload_recip (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Tot (parse_fldata_strong_t s (U32.v sz))
let synth_bounded_vlgen_payload_recip (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Tot (parse_fldata_strong_t s (U32.v sz)) = x
{ "file_name": "src/lowparse/LowParse.Spec.VLGen.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 3, "end_line": 295, "start_col": 0, "start_line": 285 }
module LowParse.Spec.VLGen include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLData // for parse_bounded_vldata_strong_t (* TODO: this module should deprecate and replace LowParse.Spec.VLData *) module U32 = FStar.UInt32 module Seq = FStar.Seq let tag_of_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : GTot (bounded_int32 min max) = U32.uint_to_t (Seq.length (serialize s x)) inline_for_extraction let synth_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: parse_fldata_strong_t s (U32.v sz)) : Tot (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) = x inline_for_extraction let parse_bounded_vlgen_payload_kind (min: nat) (max: nat { min <= max } ) (k: parser_kind) : Tot parser_kind = [@inline_let] let kmin = k.parser_kind_low in [@inline_let] let min' = if kmin > min then kmin else min in [@inline_let] let max' = match k.parser_kind_high with | None -> max | Some kmax -> if kmax < max then kmax else max in [@inline_let] let max' = if max' < min' then min' else max' in strong_parser_kind min' max' ( match k.parser_kind_metadata with | Some ParserKindMetadataFail -> Some ParserKindMetadataFail | _ -> None ) let parse_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) else weaken (parse_bounded_vlgen_payload_kind min max k) (parse_fldata_strong s (U32.v sz) `parse_synth` synth_bounded_vlgen_payload min max s sz) let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed) )) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input inline_for_extraction let parse_bounded_vlgen_kind (sk: parser_kind) (min: nat) (max: nat { min <= max } ) (k: parser_kind) = and_then_kind sk (parse_bounded_vlgen_payload_kind min max k) let parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (parser (parse_bounded_vlgen_kind sk min max k) (parse_bounded_vldata_strong_t min max s)) = parse_tagged_union pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) let parse_bounded_vlgen_unfold_aux (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1 let parse_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1; if Seq.length input < sz + U32.v len then () else Seq.slice_slice input sz (Seq.length input) 0 (U32.v len) inline_for_extraction let synth_vlgen (min: nat) (max: nat) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : Tot t = x let parse_vlgen_precond (min: nat) (max: nat { min <= max } ) (k: parser_kind) : GTot bool = match k.parser_kind_high with | None -> false | Some kmax -> min <= k.parser_kind_low && kmax <= max let parse_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (parser (parse_bounded_vlgen_kind sk min max k) t) = parse_bounded_vlgen min max pk s `parse_synth` synth_vlgen min max s let parse_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: bytes) : Lemma (let res = parse (parse_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) input; parse_bounded_vlgen_unfold min max pk s input
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLData.fsti.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.VLGen.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLData", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> s: LowParse.Spec.Base.serializer p -> sz: LowParse.Spec.BoundedInt.bounded_int32 min max -> x: LowParse.Spec.Base.refine_with_tag (LowParse.Spec.VLGen.tag_of_bounded_vlgen_payload min max s ) sz -> LowParse.Spec.FLData.parse_fldata_strong_t s (FStar.UInt32.v sz)
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.refine_with_tag", "LowParse.Spec.VLData.parse_bounded_vldata_strong_t", "LowParse.Spec.VLGen.tag_of_bounded_vlgen_payload", "LowParse.Spec.FLData.parse_fldata_strong_t", "FStar.UInt32.v" ]
[]
false
false
false
false
false
let synth_bounded_vlgen_payload_recip (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Tot (parse_fldata_strong_t s (U32.v sz)) =
x
false
Vale.Def.Words.Two_s.fsti
Vale.Def.Words.Two_s.two_insert
val two_insert (#a: Type) (x: two a) (y: a) (selector: nat1) : two a
val two_insert (#a: Type) (x: two a) (y: a) (selector: nat1) : two a
let two_insert (#a:Type) (x:two a) (y:a) (selector:nat1) : two a = match selector with | 0 -> Mktwo y x.hi | 1 -> Mktwo x.lo y
{ "file_name": "vale/specs/defs/Vale.Def.Words.Two_s.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 21, "end_line": 41, "start_col": 0, "start_line": 38 }
module Vale.Def.Words.Two_s open Vale.Def.Words_s open FStar.Mul unfold let two_map (#a #b:Type) (f:a -> b) (x:two a) : two b = let Mktwo x0 x1 = x in Mktwo (f x0) (f x1) unfold let two_map2 (#a #b:Type) (f:a -> a -> b) (x y:two a) : two b = let Mktwo x0 x1 = x in let Mktwo y0 y1 = y in Mktwo (f x0 y0) (f x1 y1) unfold let nat_to_two_unfold (size:nat) (n:natN (pow2 (2 * size))) : two (natN (pow2 size)) = let n1 = pow2_norm size in let n2 = pow2_norm (2 * size) in Mktwo (n % n1) ((n / n1) % n1) let nat_to_two (size:nat) (n:natN (pow2 (2 * size))) : two (natN (pow2 size)) = nat_to_two_unfold size n unfold let two_to_nat_unfold (size:nat) (x:two (natN (pow2 size))) : natN (pow2 (2 * size)) = let n1 = pow2_norm size in let n2 = pow2_norm (2 * size) in let Mktwo x0 x1 = x in int_to_natN n2 (x0 + x1 * n1) let two_to_nat (size:nat) (x:two (natN (pow2 size))) : natN (pow2 (2 * size)) = two_to_nat_unfold size x let two_select (#a:Type) (x:two a) (selector:nat1) : a = match selector with | 0 -> x.lo | 1 -> x.hi
{ "checked_file": "/", "dependencies": [ "Vale.Def.Words_s.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.Def.Words.Two_s.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Vale.Def.Words_s.two a -> y: a -> selector: Vale.Def.Words_s.nat1 -> Vale.Def.Words_s.two a
Prims.Tot
[ "total" ]
[]
[ "Vale.Def.Words_s.two", "Vale.Def.Words_s.nat1", "Vale.Def.Words_s.Mktwo", "Vale.Def.Words_s.__proj__Mktwo__item__hi", "Vale.Def.Words_s.__proj__Mktwo__item__lo" ]
[]
false
false
false
true
false
let two_insert (#a: Type) (x: two a) (y: a) (selector: nat1) : two a =
match selector with | 0 -> Mktwo y x.hi | 1 -> Mktwo x.lo y
false
LowParse.Spec.VLGen.fst
LowParse.Spec.VLGen.parse_vlgen_weak_payload_and_then_cases_injective
val parse_vlgen_weak_payload_and_then_cases_injective (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#k: parser_kind) (#t: Type) (p: parser k t) : Lemma (and_then_cases_injective (parse_vlgen_weak_payload min max p))
val parse_vlgen_weak_payload_and_then_cases_injective (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#k: parser_kind) (#t: Type) (p: parser k t) : Lemma (and_then_cases_injective (parse_vlgen_weak_payload min max p))
let parse_vlgen_weak_payload_and_then_cases_injective (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (p: parser k t) : Lemma (and_then_cases_injective (parse_vlgen_weak_payload min max p)) = and_then_cases_injective_intro (parse_vlgen_weak_payload min max p) (fun (x1 x2: bounded_int32 min max) b1 b2 -> parse_injective p (Seq.slice b1 0 (U32.v x1)) (Seq.slice b2 0 (U32.v x2)) )
{ "file_name": "src/lowparse/LowParse.Spec.VLGen.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 5, "end_line": 479, "start_col": 0, "start_line": 463 }
module LowParse.Spec.VLGen include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLData // for parse_bounded_vldata_strong_t (* TODO: this module should deprecate and replace LowParse.Spec.VLData *) module U32 = FStar.UInt32 module Seq = FStar.Seq let tag_of_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : GTot (bounded_int32 min max) = U32.uint_to_t (Seq.length (serialize s x)) inline_for_extraction let synth_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: parse_fldata_strong_t s (U32.v sz)) : Tot (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) = x inline_for_extraction let parse_bounded_vlgen_payload_kind (min: nat) (max: nat { min <= max } ) (k: parser_kind) : Tot parser_kind = [@inline_let] let kmin = k.parser_kind_low in [@inline_let] let min' = if kmin > min then kmin else min in [@inline_let] let max' = match k.parser_kind_high with | None -> max | Some kmax -> if kmax < max then kmax else max in [@inline_let] let max' = if max' < min' then min' else max' in strong_parser_kind min' max' ( match k.parser_kind_metadata with | Some ParserKindMetadataFail -> Some ParserKindMetadataFail | _ -> None ) let parse_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) else weaken (parse_bounded_vlgen_payload_kind min max k) (parse_fldata_strong s (U32.v sz) `parse_synth` synth_bounded_vlgen_payload min max s sz) let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed) )) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input inline_for_extraction let parse_bounded_vlgen_kind (sk: parser_kind) (min: nat) (max: nat { min <= max } ) (k: parser_kind) = and_then_kind sk (parse_bounded_vlgen_payload_kind min max k) let parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (parser (parse_bounded_vlgen_kind sk min max k) (parse_bounded_vldata_strong_t min max s)) = parse_tagged_union pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) let parse_bounded_vlgen_unfold_aux (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1 let parse_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1; if Seq.length input < sz + U32.v len then () else Seq.slice_slice input sz (Seq.length input) 0 (U32.v len) inline_for_extraction let synth_vlgen (min: nat) (max: nat) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : Tot t = x let parse_vlgen_precond (min: nat) (max: nat { min <= max } ) (k: parser_kind) : GTot bool = match k.parser_kind_high with | None -> false | Some kmax -> min <= k.parser_kind_low && kmax <= max let parse_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (parser (parse_bounded_vlgen_kind sk min max k) t) = parse_bounded_vlgen min max pk s `parse_synth` synth_vlgen min max s let parse_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: bytes) : Lemma (let res = parse (parse_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) input; parse_bounded_vlgen_unfold min max pk s input inline_for_extraction let synth_bounded_vlgen_payload_recip (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Tot (parse_fldata_strong_t s (U32.v sz)) = x let serialize_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (serializer (parse_bounded_vlgen_payload min max s sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_serializer (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) (fun _ -> ()) else serialize_weaken (parse_bounded_vlgen_payload_kind min max k) (serialize_synth (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () ) let serialize_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Lemma (serialize (serialize_bounded_vlgen_payload min max s sz) input == serialize s input) = serialize_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () input let serialize_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (serializer (parse_bounded_vlgen min max pk s)) = serialize_tagged_union ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) let serialize_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: parse_bounded_vldata_strong_t min max s) : Lemma (serialize (serialize_bounded_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_tagged_union_eq ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) input; let tg : bounded_int32 min max = tag_of_bounded_vlgen_payload min max s input in serialize_bounded_vlgen_payload_unfold min max s tg input inline_for_extraction let synth_vlgen_recip (min: nat) (max: nat { min <= max } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k } ) (x: t) : Tot (parse_bounded_vldata_strong_t min max s) = [@inline_let] let _ = let sl = Seq.length (serialize s x) in assert (min <= sl /\ sl <= max) in x let serialize_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (serializer (parse_vlgen min max pk s)) = serialize_synth (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) () let serialize_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: t) : Lemma (serialize (serialize_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) () input; serialize_bounded_vlgen_unfold min max ssk s input (* What if we are not sure the serializer exists? *) inline_for_extraction noextract let parse_vlgen_weak_payload_kind (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) : Tot parser_kind = strong_parser_kind min max None let parse_vlgen_weak_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (p: parser k t) (bound: bounded_int32 min max) : Tot (parser (parse_vlgen_weak_payload_kind min max) t) = weaken (parse_vlgen_weak_payload_kind min max) (parse_fldata p (U32.v bound))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLData.fsti.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.VLGen.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLData", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> p: LowParse.Spec.Base.parser k t -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Combinators.and_then_cases_injective (LowParse.Spec.VLGen.parse_vlgen_weak_payload min max p))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Combinators.and_then_cases_injective_intro", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.VLGen.parse_vlgen_weak_payload", "LowParse.Bytes.bytes", "LowParse.Spec.Base.parse_injective", "FStar.Seq.Base.slice", "LowParse.Bytes.byte", "FStar.UInt32.v", "Prims.unit", "Prims.l_True", "Prims.squash", "LowParse.Spec.Combinators.and_then_cases_injective", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
false
false
true
false
false
let parse_vlgen_weak_payload_and_then_cases_injective (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#k: parser_kind) (#t: Type) (p: parser k t) : Lemma (and_then_cases_injective (parse_vlgen_weak_payload min max p)) =
and_then_cases_injective_intro (parse_vlgen_weak_payload min max p) (fun (x1: bounded_int32 min max) (x2: bounded_int32 min max) b1 b2 -> parse_injective p (Seq.slice b1 0 (U32.v x1)) (Seq.slice b2 0 (U32.v x2)))
false
FStar.Array.fst
FStar.Array.of_list
val of_list (#a:Type0) (l:list a) : ST (array a) (requires fun _ -> True) (ensures create_post (seq_of_list l))
val of_list (#a:Type0) (l:list a) : ST (array a) (requires fun _ -> True) (ensures create_post (seq_of_list l))
let of_list #a l = of_seq (Seq.seq_of_list l)
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 45, "end_line": 41, "start_col": 0, "start_line": 41 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s let to_seq #a s = !s
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l: Prims.list a -> FStar.ST.ST (FStar.Array.array a)
FStar.ST.ST
[]
[]
[ "Prims.list", "FStar.Array.of_seq", "FStar.Seq.Base.seq_of_list", "FStar.Array.array" ]
[]
false
true
false
false
false
let of_list #a l =
of_seq (Seq.seq_of_list l)
false
LowParse.Spec.VLGen.fst
LowParse.Spec.VLGen.serialize_bounded_vlgen_unfold
val serialize_bounded_vlgen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk {sk.parser_kind_subkind == Some ParserStrong}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: parse_bounded_vldata_strong_t min max s) : Lemma (serialize (serialize_bounded_vlgen min max ssk s) input == (let sp = serialize s input in (serialize ssk (U32.uint_to_t (Seq.length sp))) `Seq.append` sp))
val serialize_bounded_vlgen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk {sk.parser_kind_subkind == Some ParserStrong}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: parse_bounded_vldata_strong_t min max s) : Lemma (serialize (serialize_bounded_vlgen min max ssk s) input == (let sp = serialize s input in (serialize ssk (U32.uint_to_t (Seq.length sp))) `Seq.append` sp))
let serialize_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: parse_bounded_vldata_strong_t min max s) : Lemma (serialize (serialize_bounded_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_tagged_union_eq ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) input; let tg : bounded_int32 min max = tag_of_bounded_vlgen_payload min max s input in serialize_bounded_vlgen_payload_unfold min max s tg input
{ "file_name": "src/lowparse/LowParse.Spec.VLGen.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 59, "end_line": 382, "start_col": 0, "start_line": 360 }
module LowParse.Spec.VLGen include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLData // for parse_bounded_vldata_strong_t (* TODO: this module should deprecate and replace LowParse.Spec.VLData *) module U32 = FStar.UInt32 module Seq = FStar.Seq let tag_of_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : GTot (bounded_int32 min max) = U32.uint_to_t (Seq.length (serialize s x)) inline_for_extraction let synth_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: parse_fldata_strong_t s (U32.v sz)) : Tot (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) = x inline_for_extraction let parse_bounded_vlgen_payload_kind (min: nat) (max: nat { min <= max } ) (k: parser_kind) : Tot parser_kind = [@inline_let] let kmin = k.parser_kind_low in [@inline_let] let min' = if kmin > min then kmin else min in [@inline_let] let max' = match k.parser_kind_high with | None -> max | Some kmax -> if kmax < max then kmax else max in [@inline_let] let max' = if max' < min' then min' else max' in strong_parser_kind min' max' ( match k.parser_kind_metadata with | Some ParserKindMetadataFail -> Some ParserKindMetadataFail | _ -> None ) let parse_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) else weaken (parse_bounded_vlgen_payload_kind min max k) (parse_fldata_strong s (U32.v sz) `parse_synth` synth_bounded_vlgen_payload min max s sz) let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed) )) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input inline_for_extraction let parse_bounded_vlgen_kind (sk: parser_kind) (min: nat) (max: nat { min <= max } ) (k: parser_kind) = and_then_kind sk (parse_bounded_vlgen_payload_kind min max k) let parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (parser (parse_bounded_vlgen_kind sk min max k) (parse_bounded_vldata_strong_t min max s)) = parse_tagged_union pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) let parse_bounded_vlgen_unfold_aux (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1 let parse_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1; if Seq.length input < sz + U32.v len then () else Seq.slice_slice input sz (Seq.length input) 0 (U32.v len) inline_for_extraction let synth_vlgen (min: nat) (max: nat) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : Tot t = x let parse_vlgen_precond (min: nat) (max: nat { min <= max } ) (k: parser_kind) : GTot bool = match k.parser_kind_high with | None -> false | Some kmax -> min <= k.parser_kind_low && kmax <= max let parse_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (parser (parse_bounded_vlgen_kind sk min max k) t) = parse_bounded_vlgen min max pk s `parse_synth` synth_vlgen min max s let parse_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: bytes) : Lemma (let res = parse (parse_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) input; parse_bounded_vlgen_unfold min max pk s input inline_for_extraction let synth_bounded_vlgen_payload_recip (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Tot (parse_fldata_strong_t s (U32.v sz)) = x let serialize_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (serializer (parse_bounded_vlgen_payload min max s sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_serializer (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) (fun _ -> ()) else serialize_weaken (parse_bounded_vlgen_payload_kind min max k) (serialize_synth (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () ) let serialize_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Lemma (serialize (serialize_bounded_vlgen_payload min max s sz) input == serialize s input) = serialize_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () input let serialize_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (serializer (parse_bounded_vlgen min max pk s)) = serialize_tagged_union ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLData.fsti.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.VLGen.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLData", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> ssk: LowParse.Spec.Base.serializer pk { Mkparser_kind'?.parser_kind_subkind sk == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong } -> s: LowParse.Spec.Base.serializer p -> input: LowParse.Spec.VLData.parse_bounded_vldata_strong_t min max s -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Base.serialize (LowParse.Spec.VLGen.serialize_bounded_vlgen min max ssk s) input == (let sp = LowParse.Spec.Base.serialize s input in FStar.Seq.Base.append (LowParse.Spec.Base.serialize ssk (FStar.UInt32.uint_to_t (FStar.Seq.Base.length sp))) sp))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.serializer", "Prims.eq2", "FStar.Pervasives.Native.option", "LowParse.Spec.Base.parser_subkind", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_subkind", "FStar.Pervasives.Native.Some", "LowParse.Spec.Base.ParserStrong", "LowParse.Spec.VLData.parse_bounded_vldata_strong_t", "LowParse.Spec.VLGen.serialize_bounded_vlgen_payload_unfold", "LowParse.Spec.VLGen.tag_of_bounded_vlgen_payload", "Prims.unit", "LowParse.Spec.Combinators.serialize_tagged_union_eq", "LowParse.Spec.VLGen.parse_bounded_vlgen_payload_kind", "LowParse.Spec.VLGen.parse_bounded_vlgen_payload", "LowParse.Spec.VLGen.serialize_bounded_vlgen_payload", "Prims.l_True", "Prims.squash", "FStar.Seq.Base.seq", "LowParse.Bytes.byte", "LowParse.Spec.Base.serialize", "LowParse.Spec.VLGen.parse_bounded_vlgen_kind", "LowParse.Spec.VLGen.parse_bounded_vlgen", "LowParse.Spec.VLGen.serialize_bounded_vlgen", "FStar.Seq.Base.append", "FStar.UInt32.uint_to_t", "FStar.Seq.Base.length", "LowParse.Bytes.bytes", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let serialize_bounded_vlgen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk {sk.parser_kind_subkind == Some ParserStrong}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: parse_bounded_vldata_strong_t min max s) : Lemma (serialize (serialize_bounded_vlgen min max ssk s) input == (let sp = serialize s input in (serialize ssk (U32.uint_to_t (Seq.length sp))) `Seq.append` sp)) =
serialize_tagged_union_eq ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) input; let tg:bounded_int32 min max = tag_of_bounded_vlgen_payload min max s input in serialize_bounded_vlgen_payload_unfold min max s tg input
false
EverCrypt.Poly1305.fst
EverCrypt.Poly1305.mac
val mac: output:B.buffer UInt8.t { B.length output = 16 } -> input:B.buffer UInt8.t -> input_len:U32.t { U32.v input_len = B.length input /\ U32.v input_len + 16 <= UInt.max_int 32 } -> key:B.buffer UInt8.t { B.length key = 32 } -> Stack unit (requires fun h -> B.live h input /\ B.live h output /\ B.live h key /\ B.disjoint output input /\ B.disjoint output key) (ensures fun h0 _ h1 -> B.(modifies (loc_buffer output) h0 h1 /\ ( B.as_seq h1 output == BF.of_bytes (Spec.Poly1305.poly1305_mac (BF.to_bytes (B.as_seq h0 input)) (BF.to_bytes (B.as_seq h0 key))))))
val mac: output:B.buffer UInt8.t { B.length output = 16 } -> input:B.buffer UInt8.t -> input_len:U32.t { U32.v input_len = B.length input /\ U32.v input_len + 16 <= UInt.max_int 32 } -> key:B.buffer UInt8.t { B.length key = 32 } -> Stack unit (requires fun h -> B.live h input /\ B.live h output /\ B.live h key /\ B.disjoint output input /\ B.disjoint output key) (ensures fun h0 _ h1 -> B.(modifies (loc_buffer output) h0 h1 /\ ( B.as_seq h1 output == BF.of_bytes (Spec.Poly1305.poly1305_mac (BF.to_bytes (B.as_seq h0 input)) (BF.to_bytes (B.as_seq h0 key))))))
let mac output input input_len key = let h0 = ST.get () in let vec256 = EverCrypt.AutoConfig2.has_vec256 () in let vec128 = EverCrypt.AutoConfig2.has_vec128 () in if EverCrypt.TargetConfig.hacl_can_compile_vec256 && vec256 then begin LowStar.Ignore.ignore vec128; Hacl.Streaming.Poly1305_256.mac output input input_len key end else if EverCrypt.TargetConfig.hacl_can_compile_vec128 && vec128 then begin LowStar.Ignore.ignore vec256; Hacl.Streaming.Poly1305_128.mac output input input_len key end else begin LowStar.Ignore.ignore vec256; LowStar.Ignore.ignore vec128; if EverCrypt.TargetConfig.hacl_can_compile_vale then poly1305_vale output input input_len key else ( LowStar.Ignore.ignore poly1305_vale; Hacl.Streaming.Poly1305_32.mac output input input_len key ) end
{ "file_name": "providers/evercrypt/fst/EverCrypt.Poly1305.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 5, "end_line": 152, "start_col": 0, "start_line": 130 }
module EverCrypt.Poly1305 /// A multiplexed frontend for Poly1305. module B = LowStar.Buffer module U32 = FStar.UInt32 module ST = FStar.HyperStack.ST module F = Hacl.Impl.Poly1305.Fields module S = FStar.Seq open FStar.HyperStack.ST open FStar.Integers #reset-options "--initial_fuel 1 --max_fuel 1 --max_ifuel 0" friend Lib.IntTypes #push-options "--z3rlimit 300" let poly1305_vale (dst:B.buffer UInt8.t { B.length dst = 16 }) (src:B.buffer UInt8.t) (len:U32.t { U32.v len = B.length src /\ U32.v len + 16 <= UInt.max_int 32 }) (key:B.buffer UInt8.t { B.length key = 32 }) : Stack unit (requires fun h -> EverCrypt.TargetConfig.hacl_can_compile_vale /\ B.live h src /\ B.live h dst /\ B.live h key /\ B.disjoint dst src /\ B.disjoint dst key) (ensures fun h0 _ h1 -> B.(modifies (loc_buffer dst) h0 h1 /\ ( B.as_seq h1 dst == BF.of_bytes (Spec.Poly1305.poly1305_mac (BF.to_bytes (B.as_seq h0 src)) (BF.to_bytes (B.as_seq h0 key)))))) = if EverCrypt.TargetConfig.hacl_can_compile_vale then let h0 = ST.get () in push_frame (); // Vale wants a large context let ctx = B.alloca 0uy 192ul in // With the key located at bytes [ 24; 56 ) B.blit key 0ul ctx 24ul 32ul; let n_blocks = len / 16ul in let n_extra = len % 16ul in if n_extra = 0ul then begin // Call Vale let h1 = ST.get () in // Initial hash (0) is located at bytes [ 0; 24 ) assert (forall (i:int).{:pattern (Seq.index (B.as_seq h1 ctx) i)} 0 <= i /\ i < 24 ==> Seq.index (Seq.slice (B.as_seq h1 ctx) 0 24) i == 0uy); Vale.Poly1305.CallingFromLowStar.lemma_hash_init h1 h1 ctx true; let res = Vale.Wrapper.X64.Poly.x64_poly1305 ctx src (FStar.Int.Cast.Full.uint32_to_uint64 len) 1UL in LowStar.Ignore.ignore res; let h2 = ST.get () in assert (B.length src == 8 * Vale.Poly1305.Util.readable_words (Seq.length (Vale.Arch.BufferFriend.to_bytes (B.as_seq h1 src)))); Vale.Poly1305.CallingFromLowStar.lemma_call_poly1305 h1 h2 ctx src (Vale.Arch.BufferFriend.to_bytes (B.as_seq h1 src)) (Vale.Arch.BufferFriend.to_bytes (B.as_seq h1 key)); Vale.Poly1305.Equiv.lemma_poly1305_equiv (Vale.Arch.BufferFriend.to_bytes (B.as_seq h1 src)) (Vale.Arch.BufferFriend.to_bytes (B.as_seq h1 key)); Vale.Arch.BufferFriend.lemma_le_to_n_is_nat_from_bytes (S.slice (B.as_seq h2 ctx) 0 16); Vale.Arch.BufferFriend.lemma_n_to_le_is_nat_to_bytes 16 (FStar.Endianness.le_to_n (S.slice (B.as_seq h2 ctx) 0 16)); FStar.Endianness.n_to_le_le_to_n 16 (S.slice (B.as_seq h2 ctx) 0 16); assert (S.slice (B.as_seq h2 ctx) 0 16 `S.equal` Spec.Poly1305.poly1305_mac (B.as_seq h1 src) (B.as_seq h1 key)); () end else begin let tmp = B.alloca 0uy 16ul in // space for last 0..15 bytes let len16 = n_blocks * 16ul in let src16 = B.sub src 0ul len16 in B.blit src len16 tmp 0ul n_extra; // Call Vale: all but last bytes let h1 = ST.get () in // Initial hash (0) is located at bytes [ 0; 24 ) assert (forall (i:int).{:pattern (Seq.index (B.as_seq h1 ctx) i)} 0 <= i /\ i < 24 ==> Seq.index (Seq.slice (B.as_seq h1 ctx) 0 24) i == 0uy); Vale.Poly1305.CallingFromLowStar.lemma_hash_init h1 h1 ctx true; let res = Vale.Wrapper.X64.Poly.x64_poly1305 ctx src16 (FStar.Int.Cast.Full.uint32_to_uint64 len16) 0UL in LowStar.Ignore.ignore res; let h1' = ST.get () in Vale.Poly1305.CallingFromLowStar.lemma_call_poly1305 h1 h1' ctx src16 (Vale.Arch.BufferFriend.to_bytes (B.as_seq h1 src16)) (Vale.Arch.BufferFriend.to_bytes (B.as_seq h1 key)); // Call Vale: last 0..15 bytes B.blit key 0ul ctx 24ul 32ul; let h1'' = ST.get () in assert (forall (i:int).{:pattern (Seq.index (B.as_seq h1'' ctx) i)} 0 <= i /\ i < 24 ==> Seq.index (Seq.slice (B.as_seq h1'' ctx) 0 24) i == Seq.index (Seq.slice (B.as_seq h1' ctx) 0 24) i); Vale.Poly1305.CallingFromLowStar.lemma_hash_init h1' h1'' ctx false; let res = Vale.Wrapper.X64.Poly.x64_poly1305 ctx tmp (FStar.Int.Cast.Full.uint32_to_uint64 n_extra) 1UL in LowStar.Ignore.ignore res; let h2 = ST.get () in let proof : squash (S.slice (B.as_seq h2 ctx) 0 16 `S.equal` Spec.Poly1305.poly1305_mac (B.as_seq h1 src) (B.as_seq h1 key)) = let open FStar.Seq.Base in let open Vale.Poly1305.Spec_s in let open Vale.Def.Words_s in let open Vale.Poly1305.Util in let tmps = B.sub tmp 0ul n_extra in let src' = Vale.Arch.BufferFriend.to_bytes (B.as_seq h1 src) in let src16' = Vale.Arch.BufferFriend.to_bytes (B.as_seq h1 src16) in let tmps' = Vale.Arch.BufferFriend.to_bytes (B.as_seq h1'' tmps) in let key' = Vale.Arch.BufferFriend.to_bytes (B.as_seq h1'' key) in let key_r:nat128 = Vale.Poly1305.Equiv.nat_from_bytes_le (slice key' 0 16) in let key_s:nat128 = Vale.Poly1305.Equiv.nat_from_bytes_le (slice key' 16 32) in let n = 0x10000000000000000 in let inp1:int -> nat128 = Vale.Poly1305.Equiv.block_fun src16' in let inp2:int -> nat128 = Vale.Poly1305.Equiv.block_fun (append src16' tmps') in assert (equal src' (append src16' tmps')); lemma_equal_blocks 0 (n * n) (make_r key_r) inp1 inp2 (UInt32.v n_blocks); Vale.Poly1305.Equiv.lemma_poly1305_equiv (Vale.Arch.BufferFriend.to_bytes (B.as_seq h1 src)) (Vale.Arch.BufferFriend.to_bytes (B.as_seq h1 key)); Vale.Arch.BufferFriend.lemma_le_to_n_is_nat_from_bytes (S.slice (B.as_seq h2 ctx) 0 16); Vale.Arch.BufferFriend.lemma_n_to_le_is_nat_to_bytes 16 (FStar.Endianness.le_to_n (S.slice (B.as_seq h2 ctx) 0 16)); FStar.Endianness.n_to_le_le_to_n 16 (S.slice (B.as_seq h2 ctx) 0 16); Vale.Poly1305.CallingFromLowStar.lemma_call_poly1305 h1'' h2 ctx tmp tmps' key'; () in () end; B.blit ctx 0ul dst 0ul 16ul; pop_frame (); let h3 = ST.get () in assert (B.as_seq h3 dst `S.equal` Spec.Poly1305.poly1305_mac (B.as_seq h0 src) (B.as_seq h0 key))
{ "checked_file": "/", "dependencies": [ "Vale.Wrapper.X64.Poly.fsti.checked", "Vale.Poly1305.Util.fsti.checked", "Vale.Poly1305.Spec_s.fst.checked", "Vale.Poly1305.Equiv.fsti.checked", "Vale.Poly1305.CallingFromLowStar.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.BufferFriend.fsti.checked", "Spec.Poly1305.fst.checked", "prims.fst.checked", "LowStar.Ignore.fsti.checked", "LowStar.Buffer.fst.checked", "Lib.IntTypes.fst.checked", "Hacl.Streaming.Poly1305_32.fsti.checked", "Hacl.Streaming.Poly1305_256.fsti.checked", "Hacl.Streaming.Poly1305_128.fsti.checked", "Hacl.Impl.Poly1305.Fields.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Integers.fst.checked", "FStar.Int.Cast.Full.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Endianness.fsti.checked", "EverCrypt.TargetConfig.fsti.checked", "EverCrypt.AutoConfig2.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.Poly1305.fst" }
[ { "abbrev": false, "full_module": "FStar.Integers", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Impl.Poly1305.Fields", "short_module": "F" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "Vale.Arch.BufferFriend", "short_module": "BF" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 1, "initial_ifuel": 1, "max_fuel": 1, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 300, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
output: LowStar.Buffer.buffer FStar.UInt8.t {LowStar.Monotonic.Buffer.length output = 16} -> input: LowStar.Buffer.buffer FStar.UInt8.t -> input_len: FStar.UInt32.t { FStar.UInt32.v input_len = LowStar.Monotonic.Buffer.length input /\ FStar.UInt32.v input_len + 16 <= FStar.UInt.max_int 32 } -> key: LowStar.Buffer.buffer FStar.UInt8.t {LowStar.Monotonic.Buffer.length key = 32} -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "LowStar.Buffer.buffer", "FStar.UInt8.t", "Prims.b2t", "Prims.op_Equality", "Prims.int", "LowStar.Monotonic.Buffer.length", "LowStar.Buffer.trivial_preorder", "FStar.UInt32.t", "Prims.l_and", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "FStar.UInt.size", "FStar.UInt32.n", "FStar.UInt32.v", "FStar.Integers.op_Less_Equals", "FStar.Integers.Signed", "FStar.Integers.Winfinite", "FStar.Integers.op_Plus", "FStar.UInt.max_int", "Prims.op_AmpAmp", "EverCrypt.TargetConfig.hacl_can_compile_vec256", "Hacl.Streaming.Poly1305_256.mac", "Prims.unit", "LowStar.Ignore.ignore", "Prims.bool", "EverCrypt.TargetConfig.hacl_can_compile_vec128", "Hacl.Streaming.Poly1305_128.mac", "EverCrypt.TargetConfig.hacl_can_compile_vale", "EverCrypt.Poly1305.poly1305_vale", "Hacl.Streaming.Poly1305_32.mac", "FStar.Monotonic.HyperStack.mem", "LowStar.Monotonic.Buffer.live", "LowStar.Monotonic.Buffer.disjoint", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_buffer", "Prims.eq2", "FStar.Seq.Base.seq", "LowStar.Monotonic.Buffer.as_seq", "Vale.Arch.BufferFriend.of_bytes", "Spec.Poly1305.poly1305_mac", "Vale.Arch.BufferFriend.to_bytes", "EverCrypt.AutoConfig2.has_vec128", "EverCrypt.AutoConfig2.has_vec256", "FStar.HyperStack.ST.get" ]
[]
false
true
false
false
false
let mac output input input_len key =
let h0 = ST.get () in let vec256 = EverCrypt.AutoConfig2.has_vec256 () in let vec128 = EverCrypt.AutoConfig2.has_vec128 () in if EverCrypt.TargetConfig.hacl_can_compile_vec256 && vec256 then (LowStar.Ignore.ignore vec128; Hacl.Streaming.Poly1305_256.mac output input input_len key) else if EverCrypt.TargetConfig.hacl_can_compile_vec128 && vec128 then (LowStar.Ignore.ignore vec256; Hacl.Streaming.Poly1305_128.mac output input input_len key) else (LowStar.Ignore.ignore vec256; LowStar.Ignore.ignore vec128; if EverCrypt.TargetConfig.hacl_can_compile_vale then poly1305_vale output input input_len key else (LowStar.Ignore.ignore poly1305_vale; Hacl.Streaming.Poly1305_32.mac output input input_len key))
false
LowParse.Spec.VLGen.fst
LowParse.Spec.VLGen.parse_vlgen_weak
val parse_vlgen_weak (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (parser (parse_vlgen_weak_kind sk min max) t)
val parse_vlgen_weak (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (parser (parse_vlgen_weak_kind sk min max) t)
let parse_vlgen_weak (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (parser (parse_vlgen_weak_kind sk min max) t) = parse_vlgen_weak_payload_and_then_cases_injective min max p; pk `and_then` parse_vlgen_weak_payload min max p
{ "file_name": "src/lowparse/LowParse.Spec.VLGen.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 50, "end_line": 501, "start_col": 0, "start_line": 490 }
module LowParse.Spec.VLGen include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLData // for parse_bounded_vldata_strong_t (* TODO: this module should deprecate and replace LowParse.Spec.VLData *) module U32 = FStar.UInt32 module Seq = FStar.Seq let tag_of_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : GTot (bounded_int32 min max) = U32.uint_to_t (Seq.length (serialize s x)) inline_for_extraction let synth_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: parse_fldata_strong_t s (U32.v sz)) : Tot (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) = x inline_for_extraction let parse_bounded_vlgen_payload_kind (min: nat) (max: nat { min <= max } ) (k: parser_kind) : Tot parser_kind = [@inline_let] let kmin = k.parser_kind_low in [@inline_let] let min' = if kmin > min then kmin else min in [@inline_let] let max' = match k.parser_kind_high with | None -> max | Some kmax -> if kmax < max then kmax else max in [@inline_let] let max' = if max' < min' then min' else max' in strong_parser_kind min' max' ( match k.parser_kind_metadata with | Some ParserKindMetadataFail -> Some ParserKindMetadataFail | _ -> None ) let parse_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) else weaken (parse_bounded_vlgen_payload_kind min max k) (parse_fldata_strong s (U32.v sz) `parse_synth` synth_bounded_vlgen_payload min max s sz) let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed) )) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input inline_for_extraction let parse_bounded_vlgen_kind (sk: parser_kind) (min: nat) (max: nat { min <= max } ) (k: parser_kind) = and_then_kind sk (parse_bounded_vlgen_payload_kind min max k) let parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (parser (parse_bounded_vlgen_kind sk min max k) (parse_bounded_vldata_strong_t min max s)) = parse_tagged_union pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) let parse_bounded_vlgen_unfold_aux (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1 let parse_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1; if Seq.length input < sz + U32.v len then () else Seq.slice_slice input sz (Seq.length input) 0 (U32.v len) inline_for_extraction let synth_vlgen (min: nat) (max: nat) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : Tot t = x let parse_vlgen_precond (min: nat) (max: nat { min <= max } ) (k: parser_kind) : GTot bool = match k.parser_kind_high with | None -> false | Some kmax -> min <= k.parser_kind_low && kmax <= max let parse_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (parser (parse_bounded_vlgen_kind sk min max k) t) = parse_bounded_vlgen min max pk s `parse_synth` synth_vlgen min max s let parse_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: bytes) : Lemma (let res = parse (parse_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) input; parse_bounded_vlgen_unfold min max pk s input inline_for_extraction let synth_bounded_vlgen_payload_recip (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Tot (parse_fldata_strong_t s (U32.v sz)) = x let serialize_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (serializer (parse_bounded_vlgen_payload min max s sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_serializer (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) (fun _ -> ()) else serialize_weaken (parse_bounded_vlgen_payload_kind min max k) (serialize_synth (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () ) let serialize_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Lemma (serialize (serialize_bounded_vlgen_payload min max s sz) input == serialize s input) = serialize_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () input let serialize_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (serializer (parse_bounded_vlgen min max pk s)) = serialize_tagged_union ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) let serialize_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: parse_bounded_vldata_strong_t min max s) : Lemma (serialize (serialize_bounded_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_tagged_union_eq ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) input; let tg : bounded_int32 min max = tag_of_bounded_vlgen_payload min max s input in serialize_bounded_vlgen_payload_unfold min max s tg input inline_for_extraction let synth_vlgen_recip (min: nat) (max: nat { min <= max } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k } ) (x: t) : Tot (parse_bounded_vldata_strong_t min max s) = [@inline_let] let _ = let sl = Seq.length (serialize s x) in assert (min <= sl /\ sl <= max) in x let serialize_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (serializer (parse_vlgen min max pk s)) = serialize_synth (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) () let serialize_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: t) : Lemma (serialize (serialize_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) () input; serialize_bounded_vlgen_unfold min max ssk s input (* What if we are not sure the serializer exists? *) inline_for_extraction noextract let parse_vlgen_weak_payload_kind (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) : Tot parser_kind = strong_parser_kind min max None let parse_vlgen_weak_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (p: parser k t) (bound: bounded_int32 min max) : Tot (parser (parse_vlgen_weak_payload_kind min max) t) = weaken (parse_vlgen_weak_payload_kind min max) (parse_fldata p (U32.v bound)) let parse_vlgen_weak_payload_and_then_cases_injective (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (p: parser k t) : Lemma (and_then_cases_injective (parse_vlgen_weak_payload min max p)) = and_then_cases_injective_intro (parse_vlgen_weak_payload min max p) (fun (x1 x2: bounded_int32 min max) b1 b2 -> parse_injective p (Seq.slice b1 0 (U32.v x1)) (Seq.slice b2 0 (U32.v x2)) ) inline_for_extraction noextract let parse_vlgen_weak_kind (kl: parser_kind) (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) : Tot parser_kind = and_then_kind kl (parse_vlgen_weak_payload_kind min max)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLData.fsti.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.VLGen.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLData", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> pk: LowParse.Spec.Base.parser sk (LowParse.Spec.BoundedInt.bounded_int32 min max) -> p: LowParse.Spec.Base.parser k t -> LowParse.Spec.Base.parser (LowParse.Spec.VLGen.parse_vlgen_weak_kind sk min max) t
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Combinators.and_then", "LowParse.Spec.VLGen.parse_vlgen_weak_payload_kind", "LowParse.Spec.VLGen.parse_vlgen_weak_payload", "Prims.unit", "LowParse.Spec.VLGen.parse_vlgen_weak_payload_and_then_cases_injective", "LowParse.Spec.VLGen.parse_vlgen_weak_kind" ]
[]
false
false
false
false
false
let parse_vlgen_weak (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (parser (parse_vlgen_weak_kind sk min max) t) =
parse_vlgen_weak_payload_and_then_cases_injective min max p; pk `and_then` (parse_vlgen_weak_payload min max p)
false
FStar.Array.fst
FStar.Array.to_seq
val to_seq (#a:Type0) (s:array a) : ST (seq a) (requires (fun h -> contains h s)) (ensures (fun h0 x h1 -> (sel h0 s == x /\ h0 == h1)))
val to_seq (#a:Type0) (s:array a) : ST (seq a) (requires (fun h -> contains h s)) (ensures (fun h0 x h1 -> (sel h0 s == x /\ h0 == h1)))
let to_seq #a s = !s
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 20, "end_line": 39, "start_col": 0, "start_line": 39 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Array.array a -> FStar.ST.ST (FStar.Seq.Base.seq a)
FStar.ST.ST
[]
[]
[ "FStar.Array.array", "FStar.Ref.op_Bang", "FStar.Seq.Base.seq" ]
[]
false
true
false
false
false
let to_seq #a s =
!s
false
FStar.Array.fst
FStar.Array.op_At_Bar
val op_At_Bar (#a:Type0) (s1:array a) (s2:array a) : ST (array a) (requires (fun h -> contains h s1 /\ contains h s2)) (ensures (fun h0 s h1 -> contains h0 s1 /\ contains h0 s2 /\ contains h1 s /\ sel h1 s == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1))
val op_At_Bar (#a:Type0) (s1:array a) (s2:array a) : ST (array a) (requires (fun h -> contains h s1 /\ contains h s2)) (ensures (fun h0 s h1 -> contains h0 s1 /\ contains h0 s2 /\ contains h1 s /\ sel h1 s == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1))
let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2')
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 31, "end_line": 35, "start_col": 0, "start_line": 32 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s1: FStar.Array.array a -> s2: FStar.Array.array a -> FStar.ST.ST (FStar.Array.array a)
FStar.ST.ST
[]
[]
[ "FStar.Array.array", "FStar.ST.alloc", "FStar.Seq.Base.seq", "FStar.Heap.trivial_preorder", "FStar.Seq.Base.append", "FStar.ST.mref", "FStar.Ref.op_Bang" ]
[]
false
true
false
false
false
let ( @| ) #a s1 s2 =
let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2')
false
FStar.Array.fst
FStar.Array.create
val create (#a:Type0) (n:nat) (init:a) : ST (array a) (requires (fun h -> True)) (ensures (fun h0 x h1 -> x `unused_in` h0 /\ contains h1 x /\ modifies Set.empty h0 h1 /\ sel h1 x == Seq.create n init))
val create (#a:Type0) (n:nat) (init:a) : ST (array a) (requires (fun h -> True)) (ensures (fun h0 x h1 -> x `unused_in` h0 /\ contains h1 x /\ modifies Set.empty h0 h1 /\ sel h1 x == Seq.create n init))
let create #a n init = ST.alloc (Seq.create n init)
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 51, "end_line": 43, "start_col": 0, "start_line": 43 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s let to_seq #a s = !s let of_list #a l = of_seq (Seq.seq_of_list l)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Prims.nat -> init: a -> FStar.ST.ST (FStar.Array.array a)
FStar.ST.ST
[]
[]
[ "Prims.nat", "FStar.ST.alloc", "FStar.Seq.Base.seq", "FStar.Heap.trivial_preorder", "FStar.Seq.Base.create", "FStar.ST.mref", "FStar.Array.array" ]
[]
false
true
false
false
false
let create #a n init =
ST.alloc (Seq.create n init)
false
FStar.Array.fst
FStar.Array.upd
val upd (#a:Type0) (x:array a) (n:nat) (v:a) :ST unit (requires (fun h -> contains h x /\ n < Seq.length (sel h x))) (ensures (fun h0 u h1 -> n < Seq.length (sel h0 x) /\ contains h1 x /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.upd (sel h0 x) n v))
val upd (#a:Type0) (x:array a) (n:nat) (v:a) :ST unit (requires (fun h -> contains h x /\ n < Seq.length (sel h x))) (ensures (fun h0 u h1 -> n < Seq.length (sel h0 x) /\ contains h1 x /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.upd (sel h0 x) n v))
let upd #a x n v = let s = !x in let s' = Seq.upd s n v in x:= s'
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 8, "end_line": 52, "start_col": 0, "start_line": 49 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s let to_seq #a s = !s let of_list #a l = of_seq (Seq.seq_of_list l) let create #a n init = ST.alloc (Seq.create n init) let index #a x n = let s = to_seq x in Seq.index s n
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.Array.array a -> n: Prims.nat -> v: a -> FStar.ST.ST Prims.unit
FStar.ST.ST
[]
[]
[ "FStar.Array.array", "Prims.nat", "FStar.Ref.op_Colon_Equals", "FStar.Seq.Base.seq", "Prims.unit", "FStar.Seq.Base.upd", "FStar.Ref.op_Bang" ]
[]
false
true
false
false
false
let upd #a x n v =
let s = !x in let s' = Seq.upd s n v in x := s'
false
LowParse.Spec.VLGen.fst
LowParse.Spec.VLGen.serialize_vlgen_unfold
val serialize_vlgen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk {sk.parser_kind_subkind == Some ParserStrong}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p {parse_vlgen_precond min max k}) (input: t) : Lemma (serialize (serialize_vlgen min max ssk s) input == (let sp = serialize s input in (serialize ssk (U32.uint_to_t (Seq.length sp))) `Seq.append` sp))
val serialize_vlgen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk {sk.parser_kind_subkind == Some ParserStrong}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p {parse_vlgen_precond min max k}) (input: t) : Lemma (serialize (serialize_vlgen min max ssk s) input == (let sp = serialize s input in (serialize ssk (U32.uint_to_t (Seq.length sp))) `Seq.append` sp))
let serialize_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: t) : Lemma (serialize (serialize_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) () input; serialize_bounded_vlgen_unfold min max ssk s input
{ "file_name": "src/lowparse/LowParse.Spec.VLGen.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 52, "end_line": 441, "start_col": 0, "start_line": 418 }
module LowParse.Spec.VLGen include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLData // for parse_bounded_vldata_strong_t (* TODO: this module should deprecate and replace LowParse.Spec.VLData *) module U32 = FStar.UInt32 module Seq = FStar.Seq let tag_of_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : GTot (bounded_int32 min max) = U32.uint_to_t (Seq.length (serialize s x)) inline_for_extraction let synth_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: parse_fldata_strong_t s (U32.v sz)) : Tot (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) = x inline_for_extraction let parse_bounded_vlgen_payload_kind (min: nat) (max: nat { min <= max } ) (k: parser_kind) : Tot parser_kind = [@inline_let] let kmin = k.parser_kind_low in [@inline_let] let min' = if kmin > min then kmin else min in [@inline_let] let max' = match k.parser_kind_high with | None -> max | Some kmax -> if kmax < max then kmax else max in [@inline_let] let max' = if max' < min' then min' else max' in strong_parser_kind min' max' ( match k.parser_kind_metadata with | Some ParserKindMetadataFail -> Some ParserKindMetadataFail | _ -> None ) let parse_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) else weaken (parse_bounded_vlgen_payload_kind min max k) (parse_fldata_strong s (U32.v sz) `parse_synth` synth_bounded_vlgen_payload min max s sz) let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed) )) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input inline_for_extraction let parse_bounded_vlgen_kind (sk: parser_kind) (min: nat) (max: nat { min <= max } ) (k: parser_kind) = and_then_kind sk (parse_bounded_vlgen_payload_kind min max k) let parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (parser (parse_bounded_vlgen_kind sk min max k) (parse_bounded_vldata_strong_t min max s)) = parse_tagged_union pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) let parse_bounded_vlgen_unfold_aux (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1 let parse_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1; if Seq.length input < sz + U32.v len then () else Seq.slice_slice input sz (Seq.length input) 0 (U32.v len) inline_for_extraction let synth_vlgen (min: nat) (max: nat) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : Tot t = x let parse_vlgen_precond (min: nat) (max: nat { min <= max } ) (k: parser_kind) : GTot bool = match k.parser_kind_high with | None -> false | Some kmax -> min <= k.parser_kind_low && kmax <= max let parse_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (parser (parse_bounded_vlgen_kind sk min max k) t) = parse_bounded_vlgen min max pk s `parse_synth` synth_vlgen min max s let parse_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: bytes) : Lemma (let res = parse (parse_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) input; parse_bounded_vlgen_unfold min max pk s input inline_for_extraction let synth_bounded_vlgen_payload_recip (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Tot (parse_fldata_strong_t s (U32.v sz)) = x let serialize_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (serializer (parse_bounded_vlgen_payload min max s sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_serializer (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) (fun _ -> ()) else serialize_weaken (parse_bounded_vlgen_payload_kind min max k) (serialize_synth (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () ) let serialize_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Lemma (serialize (serialize_bounded_vlgen_payload min max s sz) input == serialize s input) = serialize_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () input let serialize_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (serializer (parse_bounded_vlgen min max pk s)) = serialize_tagged_union ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) let serialize_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: parse_bounded_vldata_strong_t min max s) : Lemma (serialize (serialize_bounded_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_tagged_union_eq ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) input; let tg : bounded_int32 min max = tag_of_bounded_vlgen_payload min max s input in serialize_bounded_vlgen_payload_unfold min max s tg input inline_for_extraction let synth_vlgen_recip (min: nat) (max: nat { min <= max } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k } ) (x: t) : Tot (parse_bounded_vldata_strong_t min max s) = [@inline_let] let _ = let sl = Seq.length (serialize s x) in assert (min <= sl /\ sl <= max) in x let serialize_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (serializer (parse_vlgen min max pk s)) = serialize_synth (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLData.fsti.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.VLGen.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLData", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> ssk: LowParse.Spec.Base.serializer pk { Mkparser_kind'?.parser_kind_subkind sk == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong } -> s: LowParse.Spec.Base.serializer p {LowParse.Spec.VLGen.parse_vlgen_precond min max k} -> input: t -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Base.serialize (LowParse.Spec.VLGen.serialize_vlgen min max ssk s) input == (let sp = LowParse.Spec.Base.serialize s input in FStar.Seq.Base.append (LowParse.Spec.Base.serialize ssk (FStar.UInt32.uint_to_t (FStar.Seq.Base.length sp))) sp))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.serializer", "Prims.eq2", "FStar.Pervasives.Native.option", "LowParse.Spec.Base.parser_subkind", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_subkind", "FStar.Pervasives.Native.Some", "LowParse.Spec.Base.ParserStrong", "LowParse.Spec.VLGen.parse_vlgen_precond", "LowParse.Spec.VLGen.serialize_bounded_vlgen_unfold", "Prims.unit", "LowParse.Spec.Combinators.serialize_synth_eq", "LowParse.Spec.VLGen.parse_bounded_vlgen_kind", "LowParse.Spec.VLData.parse_bounded_vldata_strong_t", "LowParse.Spec.VLGen.parse_bounded_vlgen", "LowParse.Spec.VLGen.synth_vlgen", "LowParse.Spec.VLGen.serialize_bounded_vlgen", "LowParse.Spec.VLGen.synth_vlgen_recip", "Prims.l_True", "Prims.squash", "FStar.Seq.Base.seq", "LowParse.Bytes.byte", "LowParse.Spec.Base.serialize", "LowParse.Spec.VLGen.parse_vlgen", "LowParse.Spec.VLGen.serialize_vlgen", "FStar.Seq.Base.append", "FStar.UInt32.uint_to_t", "FStar.Seq.Base.length", "LowParse.Bytes.bytes", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let serialize_vlgen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk {sk.parser_kind_subkind == Some ParserStrong}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p {parse_vlgen_precond min max k}) (input: t) : Lemma (serialize (serialize_vlgen min max ssk s) input == (let sp = serialize s input in (serialize ssk (U32.uint_to_t (Seq.length sp))) `Seq.append` sp)) =
serialize_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) () input; serialize_bounded_vlgen_unfold min max ssk s input
false
FStar.Array.fst
FStar.Array.of_seq
val of_seq (#a:Type0) (s:seq a) : ST (array a) (requires fun _ -> True) (ensures create_post s)
val of_seq (#a:Type0) (s:seq a) : ST (array a) (requires fun _ -> True) (ensures create_post s)
let of_seq #a s = ST.alloc s
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 28, "end_line": 37, "start_col": 0, "start_line": 37 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2')
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Seq.Base.seq a -> FStar.ST.ST (FStar.Array.array a)
FStar.ST.ST
[]
[]
[ "FStar.Seq.Base.seq", "FStar.ST.alloc", "FStar.Heap.trivial_preorder", "FStar.ST.mref", "FStar.Array.array" ]
[]
false
true
false
false
false
let of_seq #a s =
ST.alloc s
false
FStar.Array.fst
FStar.Array.length
val length (#a:Type0) (x:array a) : ST nat (requires (fun h -> contains h x)) (ensures (fun h0 y h1 -> y = length (sel h0 x) /\ h0 == h1))
val length (#a:Type0) (x:array a) : ST nat (requires (fun h -> contains h x)) (ensures (fun h0 y h1 -> y = length (sel h0 x) /\ h0 == h1))
let length #a x = let s = !x in Seq.length s
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 44, "end_line": 54, "start_col": 0, "start_line": 54 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s let to_seq #a s = !s let of_list #a l = of_seq (Seq.seq_of_list l) let create #a n init = ST.alloc (Seq.create n init) let index #a x n = let s = to_seq x in Seq.index s n let upd #a x n v = let s = !x in let s' = Seq.upd s n v in x:= s'
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.Array.array a -> FStar.ST.ST Prims.nat
FStar.ST.ST
[]
[]
[ "FStar.Array.array", "FStar.Seq.Base.length", "Prims.nat", "FStar.Seq.Base.seq", "FStar.Ref.op_Bang" ]
[]
false
true
false
false
false
let length #a x =
let s = !x in Seq.length s
false
FStar.Array.fst
FStar.Array.swap
val swap (#a:Type0) (x:array a) (i:nat) (j:nat{i <= j}) : ST unit (requires (fun h -> contains h x /\ j < Seq.length (sel h x))) (ensures (fun h0 _u h1 -> j < Seq.length (sel h0 x) /\ contains h1 x /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.swap (sel h0 x) i j))
val swap (#a:Type0) (x:array a) (i:nat) (j:nat{i <= j}) : ST unit (requires (fun h -> contains h x /\ j < Seq.length (sel h x))) (ensures (fun h0 _u h1 -> j < Seq.length (sel h0 x) /\ contains h1 x /\ modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == Seq.swap (sel h0 x) i j))
let swap #a x i j = let tmpi = index x i in let tmpj = index x j in upd x j tmpi; upd x i tmpj
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 14, "end_line": 65, "start_col": 0, "start_line": 61 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s let to_seq #a s = !s let of_list #a l = of_seq (Seq.seq_of_list l) let create #a n init = ST.alloc (Seq.create n init) let index #a x n = let s = to_seq x in Seq.index s n let upd #a x n v = let s = !x in let s' = Seq.upd s n v in x:= s' let length #a x = let s = !x in Seq.length s let op #a f x = let s = !x in let s' = f s in x := s'
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.Array.array a -> i: Prims.nat -> j: Prims.nat{i <= j} -> FStar.ST.ST Prims.unit
FStar.ST.ST
[]
[]
[ "FStar.Array.array", "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Array.upd", "Prims.unit", "FStar.Array.index" ]
[]
false
true
false
false
false
let swap #a x i j =
let tmpi = index x i in let tmpj = index x j in upd x j tmpi; upd x i tmpj
false
Hacl.Impl.RSAPSS.Padding.fst
Hacl.Impl.RSAPSS.Padding.pss_encode
val pss_encode: a:Hash.hash_alg{S.hash_is_supported a} -> saltLen:salt_len_t a -> salt:lbuffer uint8 saltLen -> msgLen:msg_len_t a -> msg:lbuffer uint8 msgLen -> emBits:em_len_t a saltLen -> em:lbuffer uint8 (BD.blocks emBits 8ul) -> Stack unit (requires fun h -> live h salt /\ live h msg /\ live h em /\ disjoint msg salt /\ disjoint em msg /\ disjoint em salt /\ as_seq h em == LSeq.create (S.blocks (v emBits) 8) (u8 0)) (ensures fun h0 _ h1 -> modifies (loc em) h0 h1 /\ as_seq h1 em == S.pss_encode a (v saltLen) (as_seq h0 salt) (v msgLen) (as_seq h0 msg) (v emBits))
val pss_encode: a:Hash.hash_alg{S.hash_is_supported a} -> saltLen:salt_len_t a -> salt:lbuffer uint8 saltLen -> msgLen:msg_len_t a -> msg:lbuffer uint8 msgLen -> emBits:em_len_t a saltLen -> em:lbuffer uint8 (BD.blocks emBits 8ul) -> Stack unit (requires fun h -> live h salt /\ live h msg /\ live h em /\ disjoint msg salt /\ disjoint em msg /\ disjoint em salt /\ as_seq h em == LSeq.create (S.blocks (v emBits) 8) (u8 0)) (ensures fun h0 _ h1 -> modifies (loc em) h0 h1 /\ as_seq h1 em == S.pss_encode a (v saltLen) (as_seq h0 salt) (v msgLen) (as_seq h0 msg) (v emBits))
let pss_encode a saltLen salt msgLen msg emBits em = push_frame (); let hLen = hash_len a in let m1Hash = create hLen (u8 0) in get_m1Hash a saltLen salt msgLen msg hLen m1Hash; let emLen = BD.blocks emBits 8ul in let dbLen = emLen -! hLen -! 1ul in let db = create dbLen (u8 0) in get_maskedDB a saltLen salt hLen m1Hash emBits dbLen db; update_sub em 0ul dbLen db; update_sub em dbLen hLen m1Hash; em.(emLen -! 1ul) <- u8 0xbc; pop_frame()
{ "file_name": "code/rsapss/Hacl.Impl.RSAPSS.Padding.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 13, "end_line": 177, "start_col": 0, "start_line": 163 }
module Hacl.Impl.RSAPSS.Padding open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Impl.RSAPSS.MGF module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module Hash = Spec.Agile.Hash module S = Spec.RSAPSS module BD = Hacl.Bignum.Definitions #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let less_than_max_input_length = Spec.Hash.Definitions.less_than_max_input_length inline_for_extraction noextract let salt_len_t (a:Hash.fixed_len_alg) = saltLen:size_t{8 + Hash.hash_length a + v saltLen <= max_size_t /\ (8 + Hash.hash_length a + v saltLen) `less_than_max_input_length` a} inline_for_extraction noextract let msg_len_t (a:Hash.fixed_len_alg) = msgLen:size_t{v msgLen `less_than_max_input_length` a} inline_for_extraction noextract let em_len_t (a:Hash.fixed_len_alg) (saltLen:salt_len_t a) = emBits:size_t{0 < v emBits /\ Hash.hash_length a + v saltLen + 2 <= S.blocks (v emBits) 8} inline_for_extraction noextract val xor_bytes: len:size_t{v len > 0} -> b1:lbuffer uint8 len -> b2:lbuffer uint8 len -> Stack unit (requires fun h -> live h b1 /\ live h b2 /\ disjoint b1 b2) (ensures fun h0 _ h1 -> modifies (loc b1) h0 h1 /\ as_seq h1 b1 == S.xor_bytes (as_seq h0 b1) (as_seq h0 b2)) let xor_bytes len b1 b2 = map2T len b1 (fun x y -> x ^. y) b1 b2 inline_for_extraction noextract val db_zero: len:size_t{v len > 0} -> db:lbuffer uint8 len -> emBits:size_t -> Stack unit (requires fun h -> live h db) (ensures fun h0 _ h1 -> modifies (loc db) h0 h1 /\ as_seq h1 db == S.db_zero #(v len) (as_seq h0 db) (v emBits)) let db_zero len db emBits = let msBits = emBits %. 8ul in if msBits >. 0ul then db.(0ul) <- db.(0ul) &. (u8 0xff >>. (8ul -. msBits)) inline_for_extraction noextract val get_m1Hash: a:Hash.hash_alg{S.hash_is_supported a} -> saltLen:salt_len_t a -> salt:lbuffer uint8 saltLen -> msgLen:msg_len_t a -> msg:lbuffer uint8 msgLen -> hLen:size_t{v hLen == Hash.hash_length a} -> m1Hash:lbuffer uint8 hLen -> Stack unit (requires fun h -> live h salt /\ live h msg /\ live h m1Hash /\ disjoint msg salt /\ disjoint m1Hash msg /\ disjoint m1Hash salt) (ensures fun h0 _ h1 -> modifies (loc m1Hash) h0 h1 /\ (let mHash = Hash.hash a (as_seq h0 msg) in let m1Len = 8 + Hash.hash_length a + v saltLen in let m1 = LSeq.create m1Len (u8 0) in let m1 = LSeq.update_sub m1 8 (Hash.hash_length a) mHash in let m1 = LSeq.update_sub m1 (8 + Hash.hash_length a) (v saltLen) (as_seq h0 salt) in as_seq h1 m1Hash == Hash.hash a m1)) let get_m1Hash a saltLen salt msgLen msg hLen m1Hash = push_frame (); //m1 = [8 * 0x00; mHash; salt] let m1Len = 8ul +! hLen +! saltLen in let m1 = create m1Len (u8 0) in let h0 = ST.get () in update_sub_f h0 m1 8ul hLen (fun h -> Hash.hash a (as_seq h0 msg)) (fun _ -> hash a (sub m1 8ul hLen) msgLen msg); update_sub m1 (8ul +! hLen) saltLen salt; hash a m1Hash m1Len m1; pop_frame() inline_for_extraction noextract val get_maskedDB: a:Hash.hash_alg{S.hash_is_supported a} -> saltLen:salt_len_t a -> salt:lbuffer uint8 saltLen -> hLen:size_t{v hLen == Hash.hash_length a} -> m1Hash:lbuffer uint8 hLen -> emBits:em_len_t a saltLen -> dbLen:size_t{v dbLen == S.blocks (v emBits) 8 - Hash.hash_length a - 1} -> db_mask:lbuffer uint8 dbLen -> Stack unit (requires fun h -> live h salt /\ live h m1Hash /\ live h db_mask /\ disjoint m1Hash salt /\ disjoint m1Hash db_mask /\ disjoint db_mask salt /\ as_seq h db_mask == LSeq.create (v dbLen) (u8 0)) (ensures fun h0 _ h1 -> modifies (loc db_mask) h0 h1 /\ (let emLen = S.blocks (v emBits) 8 in let dbLen = emLen - Hash.hash_length a - 1 in let db = LSeq.create dbLen (u8 0) in let last_before_salt = dbLen - v saltLen - 1 in let db = LSeq.upd db last_before_salt (u8 1) in let db = LSeq.update_sub db (last_before_salt + 1) (v saltLen) (as_seq h0 salt) in let dbMask = S.mgf_hash a (v hLen) (as_seq h0 m1Hash) dbLen in let maskedDB = S.xor_bytes db dbMask in let maskedDB = S.db_zero maskedDB (v emBits) in as_seq h1 db_mask == maskedDB)) let get_maskedDB a saltLen salt hLen m1Hash emBits dbLen db = push_frame (); //db = [0x00;..; 0x00; 0x01; salt] let last_before_salt = dbLen -! saltLen -! 1ul in db.(last_before_salt) <- u8 1; update_sub db (last_before_salt +! 1ul) saltLen salt; let dbMask = create dbLen (u8 0) in assert_norm (Hash.hash_length a + 4 <= max_size_t /\ (Hash.hash_length a + 4) `less_than_max_input_length` a); mgf_hash a hLen m1Hash dbLen dbMask; xor_bytes dbLen db dbMask; db_zero dbLen db emBits; pop_frame() val pss_encode: a:Hash.hash_alg{S.hash_is_supported a} -> saltLen:salt_len_t a -> salt:lbuffer uint8 saltLen -> msgLen:msg_len_t a -> msg:lbuffer uint8 msgLen -> emBits:em_len_t a saltLen -> em:lbuffer uint8 (BD.blocks emBits 8ul) -> Stack unit (requires fun h -> live h salt /\ live h msg /\ live h em /\ disjoint msg salt /\ disjoint em msg /\ disjoint em salt /\ as_seq h em == LSeq.create (S.blocks (v emBits) 8) (u8 0)) (ensures fun h0 _ h1 -> modifies (loc em) h0 h1 /\ as_seq h1 em == S.pss_encode a (v saltLen) (as_seq h0 salt) (v msgLen) (as_seq h0 msg) (v emBits))
{ "checked_file": "/", "dependencies": [ "Spec.RSAPSS.fst.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.RSAPSS.MGF.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.RSAPSS.Padding.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Spec.RSAPSS", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.RSAPSS.MGF", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.RSAPSS", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.RSAPSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.hash_alg{Spec.RSAPSS.hash_is_supported a} -> saltLen: Hacl.Impl.RSAPSS.Padding.salt_len_t a -> salt: Lib.Buffer.lbuffer Lib.IntTypes.uint8 saltLen -> msgLen: Hacl.Impl.RSAPSS.Padding.msg_len_t a -> msg: Lib.Buffer.lbuffer Lib.IntTypes.uint8 msgLen -> emBits: Hacl.Impl.RSAPSS.Padding.em_len_t a saltLen -> em: Lib.Buffer.lbuffer Lib.IntTypes.uint8 (Hacl.Bignum.Definitions.blocks emBits 8ul) -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "Spec.Hash.Definitions.hash_alg", "Prims.b2t", "Spec.RSAPSS.hash_is_supported", "Hacl.Impl.RSAPSS.Padding.salt_len_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Hacl.Impl.RSAPSS.Padding.msg_len_t", "Hacl.Impl.RSAPSS.Padding.em_len_t", "Hacl.Bignum.Definitions.blocks", "FStar.UInt32.__uint_to_t", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Lib.Buffer.op_Array_Assignment", "Lib.IntTypes.op_Subtraction_Bang", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.IntTypes.u8", "Lib.Buffer.update_sub", "Lib.Buffer.MUT", "Hacl.Impl.RSAPSS.Padding.get_maskedDB", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.Buffer.create", "Prims.eq2", "Prims.int", "Prims.l_or", "Lib.IntTypes.range", "Prims.l_and", "Prims.op_GreaterThan", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Lib.IntTypes.v", "Prims.op_Multiply", "FStar.UInt32.uint_to_t", "FStar.UInt32.t", "Hacl.Spec.Bignum.Definitions.blocks", "Hacl.Impl.RSAPSS.Padding.get_m1Hash", "Prims.op_GreaterThanOrEqual", "Spec.Hash.Definitions.hash_length", "Hacl.Impl.RSAPSS.MGF.hash_len", "FStar.HyperStack.ST.push_frame" ]
[]
false
true
false
false
false
let pss_encode a saltLen salt msgLen msg emBits em =
push_frame (); let hLen = hash_len a in let m1Hash = create hLen (u8 0) in get_m1Hash a saltLen salt msgLen msg hLen m1Hash; let emLen = BD.blocks emBits 8ul in let dbLen = emLen -! hLen -! 1ul in let db = create dbLen (u8 0) in get_maskedDB a saltLen salt hLen m1Hash emBits dbLen db; update_sub em 0ul dbLen db; update_sub em dbLen hLen m1Hash; em.(emLen -! 1ul) <- u8 0xbc; pop_frame ()
false
FStar.Array.fst
FStar.Array.op
val op (#a:Type0) (f:seq a -> seq a) (x:array a) : ST unit (requires (fun h -> contains h x)) (ensures (fun h0 u h1 -> modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == f (sel h0 x)))
val op (#a:Type0) (f:seq a -> seq a) (x:array a) : ST unit (requires (fun h -> contains h x)) (ensures (fun h0 u h1 -> modifies (Set.singleton (addr_of x)) h0 h1 /\ sel h1 x == f (sel h0 x)))
let op #a f x = let s = !x in let s' = f s in x := s'
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 9, "end_line": 59, "start_col": 0, "start_line": 56 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s let to_seq #a s = !s let of_list #a l = of_seq (Seq.seq_of_list l) let create #a n init = ST.alloc (Seq.create n init) let index #a x n = let s = to_seq x in Seq.index s n let upd #a x n v = let s = !x in let s' = Seq.upd s n v in x:= s' let length #a x = let s = !x in Seq.length s
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
f: (_: FStar.Seq.Base.seq a -> FStar.Seq.Base.seq a) -> x: FStar.Array.array a -> FStar.ST.ST Prims.unit
FStar.ST.ST
[]
[]
[ "FStar.Seq.Base.seq", "FStar.Array.array", "FStar.Ref.op_Colon_Equals", "Prims.unit", "FStar.Ref.op_Bang" ]
[]
false
true
false
false
false
let op #a f x =
let s = !x in let s' = f s in x := s'
false
LowParse.SLow.Option.fst
LowParse.SLow.Option.parse32_option
val parse32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (p32: parser32 p) : Tot (parser32 (parse_option p))
val parse32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (p32: parser32 p) : Tot (parser32 (parse_option p))
let parse32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (p32: parser32 p) : Tot (parser32 (parse_option p)) = fun input -> ((match p32 input with | Some (x, consumed) -> Some (Some x, consumed) | _ -> Some (None, 0ul)) <: (y: option (option t * U32.t) { parser32_correct (parse_option p) input y } ))
{ "file_name": "src/lowparse/LowParse.SLow.Option.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 108, "end_line": 12, "start_col": 0, "start_line": 9 }
module LowParse.SLow.Option include LowParse.Spec.Option include LowParse.SLow.Base module U32 = FStar.UInt32 module B32 = FStar.Bytes
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.Option.fst.checked", "LowParse.SLow.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Bytes.fsti.checked" ], "interface_file": false, "source_file": "LowParse.SLow.Option.fst" }
[ { "abbrev": true, "full_module": "FStar.Bytes", "short_module": "B32" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.SLow.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Option", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p32: LowParse.SLow.Base.parser32 p -> LowParse.SLow.Base.parser32 (LowParse.Spec.Option.parse_option p)
Prims.Tot
[ "total" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.SLow.Base.parser32", "LowParse.SLow.Base.bytes32", "FStar.UInt32.t", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.None", "FStar.UInt32.__uint_to_t", "LowParse.SLow.Base.parser32_correct", "LowParse.Spec.Option.parse_option_kind", "LowParse.Spec.Option.parse_option" ]
[]
false
false
false
false
false
let parse32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (p32: parser32 p) : Tot (parser32 (parse_option p)) =
fun input -> ((match p32 input with | Some (x, consumed) -> Some (Some x, consumed) | _ -> Some (None, 0ul)) <: (y: option (option t * U32.t) {parser32_correct (parse_option p) input y}))
false
FStar.Array.fst
FStar.Array.index
val index (#a:Type0) (x:array a) (n:nat) : ST a (requires (fun h -> contains h x /\ n < Seq.length (sel h x))) (ensures (fun h0 v h1 -> n < Seq.length (sel h0 x) /\ h0 == h1 /\ v == Seq.index (sel h0 x) n))
val index (#a:Type0) (x:array a) (n:nat) : ST a (requires (fun h -> contains h x /\ n < Seq.length (sel h x))) (ensures (fun h0 v h1 -> n < Seq.length (sel h0 x) /\ h0 == h1 /\ v == Seq.index (sel h0 x) n))
let index #a x n = let s = to_seq x in Seq.index s n
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 15, "end_line": 47, "start_col": 0, "start_line": 45 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s let to_seq #a s = !s let of_list #a l = of_seq (Seq.seq_of_list l) let create #a n init = ST.alloc (Seq.create n init)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.Array.array a -> n: Prims.nat -> FStar.ST.ST a
FStar.ST.ST
[]
[]
[ "FStar.Array.array", "Prims.nat", "FStar.Seq.Base.index", "FStar.Seq.Base.seq", "FStar.Array.to_seq" ]
[]
false
true
false
false
false
let index #a x n =
let s = to_seq x in Seq.index s n
false
FStar.Array.fst
FStar.Array.copy
val copy (#a:Type0) (s:array a) : ST (array a) (requires (fun h -> contains h s /\ Seq.length (sel h s) > 0)) (ensures (fun h0 r h1 -> modifies Set.empty h0 h1 /\ r `unused_in` h0 /\ contains h1 r /\ sel h1 r == sel h0 s))
val copy (#a:Type0) (s:array a) : ST (array a) (requires (fun h -> contains h s /\ Seq.length (sel h s) > 0)) (ensures (fun h0 r h1 -> modifies Set.empty h0 h1 /\ r `unused_in` h0 /\ contains h1 r /\ sel h1 r == sel h0 s))
let copy #a s = let cpy = create (length s) (index s 0) in copy_aux s cpy 0; cpy
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 5, "end_line": 86, "start_col": 0, "start_line": 83 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s let to_seq #a s = !s let of_list #a l = of_seq (Seq.seq_of_list l) let create #a n init = ST.alloc (Seq.create n init) let index #a x n = let s = to_seq x in Seq.index s n let upd #a x n v = let s = !x in let s' = Seq.upd s n v in x:= s' let length #a x = let s = !x in Seq.length s let op #a f x = let s = !x in let s' = f s in x := s' let swap #a x i j = let tmpi = index x i in let tmpj = index x j in upd x j tmpi; upd x i tmpj val copy_aux: #a:Type -> s:array a -> cpy:array a -> ctr:nat -> ST unit (requires (fun h -> (contains h s /\ contains h cpy /\ addr_of s <> addr_of cpy) /\ (Seq.length (sel h cpy) = Seq.length (sel h s)) /\ (ctr <= Seq.length (sel h cpy)) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 cpy /\ addr_of s <> addr_of cpy ) /\ (modifies (only cpy) h0 h1) /\ (Seq.equal (sel h1 cpy) (sel h1 s)))) let rec copy_aux #a s cpy ctr = match length cpy - ctr with | 0 -> () | _ -> upd cpy ctr (index s ctr); copy_aux s cpy (ctr+1)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Array.array a -> FStar.ST.ST (FStar.Array.array a)
FStar.ST.ST
[]
[]
[ "FStar.Array.array", "Prims.unit", "FStar.Array.copy_aux", "FStar.Array.create", "FStar.Array.index", "Prims.nat", "FStar.Array.length" ]
[]
false
true
false
false
false
let copy #a s =
let cpy = create (length s) (index s 0) in copy_aux s cpy 0; cpy
false
LowParse.Spec.VLGen.fst
LowParse.Spec.VLGen.parse_vlgen_weak_eq_parse_bounded_vlgen
val parse_vlgen_weak_eq_parse_bounded_vlgen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (match parse (parse_vlgen_weak min max pk p) input, parse (parse_bounded_vlgen min max pk s) input with | None, None -> True | Some (res1, consumed1), Some (res2, consumed2) -> res1 == (res2 <: t) /\ consumed1 == consumed2 | _ -> False)
val parse_vlgen_weak_eq_parse_bounded_vlgen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (match parse (parse_vlgen_weak min max pk p) input, parse (parse_bounded_vlgen min max pk s) input with | None, None -> True | Some (res1, consumed1), Some (res2, consumed2) -> res1 == (res2 <: t) /\ consumed1 == consumed2 | _ -> False)
let parse_vlgen_weak_eq_parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (match parse (parse_vlgen_weak min max pk p) input, parse (parse_bounded_vlgen min max pk s) input with | None, None -> True | Some (res1, consumed1), Some (res2, consumed2) -> res1 == (res2 <: t) /\ consumed1 == consumed2 | _ -> False) = parse_vlgen_weak_unfold min max pk p input; parse_bounded_vlgen_unfold min max pk s input
{ "file_name": "src/lowparse/LowParse.Spec.VLGen.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 47, "end_line": 554, "start_col": 0, "start_line": 535 }
module LowParse.Spec.VLGen include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLData // for parse_bounded_vldata_strong_t (* TODO: this module should deprecate and replace LowParse.Spec.VLData *) module U32 = FStar.UInt32 module Seq = FStar.Seq let tag_of_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : GTot (bounded_int32 min max) = U32.uint_to_t (Seq.length (serialize s x)) inline_for_extraction let synth_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: parse_fldata_strong_t s (U32.v sz)) : Tot (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) = x inline_for_extraction let parse_bounded_vlgen_payload_kind (min: nat) (max: nat { min <= max } ) (k: parser_kind) : Tot parser_kind = [@inline_let] let kmin = k.parser_kind_low in [@inline_let] let min' = if kmin > min then kmin else min in [@inline_let] let max' = match k.parser_kind_high with | None -> max | Some kmax -> if kmax < max then kmax else max in [@inline_let] let max' = if max' < min' then min' else max' in strong_parser_kind min' max' ( match k.parser_kind_metadata with | Some ParserKindMetadataFail -> Some ParserKindMetadataFail | _ -> None ) let parse_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) else weaken (parse_bounded_vlgen_payload_kind min max k) (parse_fldata_strong s (U32.v sz) `parse_synth` synth_bounded_vlgen_payload min max s sz) let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed) )) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input inline_for_extraction let parse_bounded_vlgen_kind (sk: parser_kind) (min: nat) (max: nat { min <= max } ) (k: parser_kind) = and_then_kind sk (parse_bounded_vlgen_payload_kind min max k) let parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (parser (parse_bounded_vlgen_kind sk min max k) (parse_bounded_vldata_strong_t min max s)) = parse_tagged_union pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) let parse_bounded_vlgen_unfold_aux (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1 let parse_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1; if Seq.length input < sz + U32.v len then () else Seq.slice_slice input sz (Seq.length input) 0 (U32.v len) inline_for_extraction let synth_vlgen (min: nat) (max: nat) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : Tot t = x let parse_vlgen_precond (min: nat) (max: nat { min <= max } ) (k: parser_kind) : GTot bool = match k.parser_kind_high with | None -> false | Some kmax -> min <= k.parser_kind_low && kmax <= max let parse_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (parser (parse_bounded_vlgen_kind sk min max k) t) = parse_bounded_vlgen min max pk s `parse_synth` synth_vlgen min max s let parse_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: bytes) : Lemma (let res = parse (parse_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) input; parse_bounded_vlgen_unfold min max pk s input inline_for_extraction let synth_bounded_vlgen_payload_recip (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Tot (parse_fldata_strong_t s (U32.v sz)) = x let serialize_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (serializer (parse_bounded_vlgen_payload min max s sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_serializer (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) (fun _ -> ()) else serialize_weaken (parse_bounded_vlgen_payload_kind min max k) (serialize_synth (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () ) let serialize_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Lemma (serialize (serialize_bounded_vlgen_payload min max s sz) input == serialize s input) = serialize_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () input let serialize_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (serializer (parse_bounded_vlgen min max pk s)) = serialize_tagged_union ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) let serialize_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: parse_bounded_vldata_strong_t min max s) : Lemma (serialize (serialize_bounded_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_tagged_union_eq ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) input; let tg : bounded_int32 min max = tag_of_bounded_vlgen_payload min max s input in serialize_bounded_vlgen_payload_unfold min max s tg input inline_for_extraction let synth_vlgen_recip (min: nat) (max: nat { min <= max } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k } ) (x: t) : Tot (parse_bounded_vldata_strong_t min max s) = [@inline_let] let _ = let sl = Seq.length (serialize s x) in assert (min <= sl /\ sl <= max) in x let serialize_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (serializer (parse_vlgen min max pk s)) = serialize_synth (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) () let serialize_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: t) : Lemma (serialize (serialize_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) () input; serialize_bounded_vlgen_unfold min max ssk s input (* What if we are not sure the serializer exists? *) inline_for_extraction noextract let parse_vlgen_weak_payload_kind (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) : Tot parser_kind = strong_parser_kind min max None let parse_vlgen_weak_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (p: parser k t) (bound: bounded_int32 min max) : Tot (parser (parse_vlgen_weak_payload_kind min max) t) = weaken (parse_vlgen_weak_payload_kind min max) (parse_fldata p (U32.v bound)) let parse_vlgen_weak_payload_and_then_cases_injective (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (p: parser k t) : Lemma (and_then_cases_injective (parse_vlgen_weak_payload min max p)) = and_then_cases_injective_intro (parse_vlgen_weak_payload min max p) (fun (x1 x2: bounded_int32 min max) b1 b2 -> parse_injective p (Seq.slice b1 0 (U32.v x1)) (Seq.slice b2 0 (U32.v x2)) ) inline_for_extraction noextract let parse_vlgen_weak_kind (kl: parser_kind) (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) : Tot parser_kind = and_then_kind kl (parse_vlgen_weak_payload_kind min max) let parse_vlgen_weak (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (parser (parse_vlgen_weak_kind sk min max) t) = parse_vlgen_weak_payload_and_then_cases_injective min max p; pk `and_then` parse_vlgen_weak_payload min max p let parse_vlgen_weak_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (let res = parse (parse_vlgen_weak min max pk p) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_vlgen_weak_payload_and_then_cases_injective min max p; and_then_eq pk (parse_vlgen_weak_payload min max p) input
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLData.fsti.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.VLGen.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLData", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> pk: LowParse.Spec.Base.parser sk (LowParse.Spec.BoundedInt.bounded_int32 min max) -> s: LowParse.Spec.Base.serializer p -> input: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (ensures ((match LowParse.Spec.Base.parse (LowParse.Spec.VLGen.parse_vlgen_weak min max pk p) input, LowParse.Spec.Base.parse (LowParse.Spec.VLGen.parse_bounded_vlgen min max pk s) input with | FStar.Pervasives.Native.Mktuple2 #_ #_ (FStar.Pervasives.Native.None #_) (FStar.Pervasives.Native.None #_) -> Prims.l_True | FStar.Pervasives.Native.Mktuple2 #_ #_ (FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ res1 consumed1) ) (FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ res2 consumed2) ) -> res1 == res2 /\ consumed1 == consumed2 | _ -> Prims.l_False) <: Type0))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.serializer", "LowParse.Bytes.bytes", "LowParse.Spec.VLGen.parse_bounded_vlgen_unfold", "Prims.unit", "LowParse.Spec.VLGen.parse_vlgen_weak_unfold", "Prims.l_True", "Prims.squash", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.Base.consumed_length", "LowParse.Spec.VLData.parse_bounded_vldata_strong_t", "LowParse.Spec.Base.parse", "LowParse.Spec.VLGen.parse_vlgen_weak", "LowParse.Spec.VLGen.parse_bounded_vlgen", "Prims.eq2", "Prims.l_False", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let parse_vlgen_weak_eq_parse_bounded_vlgen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (match parse (parse_vlgen_weak min max pk p) input, parse (parse_bounded_vlgen min max pk s) input with | None, None -> True | Some (res1, consumed1), Some (res2, consumed2) -> res1 == (res2 <: t) /\ consumed1 == consumed2 | _ -> False) =
parse_vlgen_weak_unfold min max pk p input; parse_bounded_vlgen_unfold min max pk s input
false
FStar.Array.fst
FStar.Array.copy_aux
val copy_aux: #a:Type -> s:array a -> cpy:array a -> ctr:nat -> ST unit (requires (fun h -> (contains h s /\ contains h cpy /\ addr_of s <> addr_of cpy) /\ (Seq.length (sel h cpy) = Seq.length (sel h s)) /\ (ctr <= Seq.length (sel h cpy)) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 cpy /\ addr_of s <> addr_of cpy ) /\ (modifies (only cpy) h0 h1) /\ (Seq.equal (sel h1 cpy) (sel h1 s))))
val copy_aux: #a:Type -> s:array a -> cpy:array a -> ctr:nat -> ST unit (requires (fun h -> (contains h s /\ contains h cpy /\ addr_of s <> addr_of cpy) /\ (Seq.length (sel h cpy) = Seq.length (sel h s)) /\ (ctr <= Seq.length (sel h cpy)) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 cpy /\ addr_of s <> addr_of cpy ) /\ (modifies (only cpy) h0 h1) /\ (Seq.equal (sel h1 cpy) (sel h1 s))))
let rec copy_aux #a s cpy ctr = match length cpy - ctr with | 0 -> () | _ -> upd cpy ctr (index s ctr); copy_aux s cpy (ctr+1)
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 24, "end_line": 81, "start_col": 0, "start_line": 77 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s let to_seq #a s = !s let of_list #a l = of_seq (Seq.seq_of_list l) let create #a n init = ST.alloc (Seq.create n init) let index #a x n = let s = to_seq x in Seq.index s n let upd #a x n v = let s = !x in let s' = Seq.upd s n v in x:= s' let length #a x = let s = !x in Seq.length s let op #a f x = let s = !x in let s' = f s in x := s' let swap #a x i j = let tmpi = index x i in let tmpj = index x j in upd x j tmpi; upd x i tmpj val copy_aux: #a:Type -> s:array a -> cpy:array a -> ctr:nat -> ST unit (requires (fun h -> (contains h s /\ contains h cpy /\ addr_of s <> addr_of cpy) /\ (Seq.length (sel h cpy) = Seq.length (sel h s)) /\ (ctr <= Seq.length (sel h cpy)) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 cpy /\ addr_of s <> addr_of cpy ) /\ (modifies (only cpy) h0 h1)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Array.array a -> cpy: FStar.Array.array a -> ctr: Prims.nat -> FStar.ST.ST Prims.unit
FStar.ST.ST
[]
[]
[ "FStar.Array.array", "Prims.nat", "Prims.unit", "Prims.int", "FStar.Array.copy_aux", "Prims.op_Addition", "FStar.Array.upd", "FStar.Array.index", "Prims.op_Subtraction", "FStar.Array.length" ]
[ "recursion" ]
false
true
false
false
false
let rec copy_aux #a s cpy ctr =
match length cpy - ctr with | 0 -> () | _ -> upd cpy ctr (index s ctr); copy_aux s cpy (ctr + 1)
false
FStar.Array.fst
FStar.Array.sub
val sub (#a:Type0) (s:array a) (idx:nat) (len:nat) : ST (array a) (requires (fun h -> contains h s /\ Seq.length (sel h s) > 0 /\ idx + len <= Seq.length (sel h s))) (ensures (fun h0 t h1 -> contains h1 t /\ t `unused_in` h0 /\ modifies Set.empty h0 h1 /\ Seq.slice (sel h0 s) idx (idx + len) == sel h1 t))
val sub (#a:Type0) (s:array a) (idx:nat) (len:nat) : ST (array a) (requires (fun h -> contains h s /\ Seq.length (sel h s) > 0 /\ idx + len <= Seq.length (sel h s))) (ensures (fun h0 t h1 -> contains h1 t /\ t `unused_in` h0 /\ modifies Set.empty h0 h1 /\ Seq.slice (sel h0 s) idx (idx + len) == sel h1 t))
let sub #a s idx len = let h0 = ST.get () in let t = create len (index s 0) in blit s idx t 0 len; let h1 = ST.get () in assert (Seq.equal (Seq.slice (sel h0 s) idx (idx + len)) (sel h1 t)); t
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 3, "end_line": 150, "start_col": 0, "start_line": 144 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s let to_seq #a s = !s let of_list #a l = of_seq (Seq.seq_of_list l) let create #a n init = ST.alloc (Seq.create n init) let index #a x n = let s = to_seq x in Seq.index s n let upd #a x n v = let s = !x in let s' = Seq.upd s n v in x:= s' let length #a x = let s = !x in Seq.length s let op #a f x = let s = !x in let s' = f s in x := s' let swap #a x i j = let tmpi = index x i in let tmpj = index x j in upd x j tmpi; upd x i tmpj val copy_aux: #a:Type -> s:array a -> cpy:array a -> ctr:nat -> ST unit (requires (fun h -> (contains h s /\ contains h cpy /\ addr_of s <> addr_of cpy) /\ (Seq.length (sel h cpy) = Seq.length (sel h s)) /\ (ctr <= Seq.length (sel h cpy)) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 cpy /\ addr_of s <> addr_of cpy ) /\ (modifies (only cpy) h0 h1) /\ (Seq.equal (sel h1 cpy) (sel h1 s)))) let rec copy_aux #a s cpy ctr = match length cpy - ctr with | 0 -> () | _ -> upd cpy ctr (index s ctr); copy_aux s cpy (ctr+1) let copy #a s = let cpy = create (length s) (index s 0) in copy_aux s cpy 0; cpy private val blit_aux: #a:Type -> s:array a -> s_idx:nat -> t:array a -> t_idx:nat -> len:nat -> ctr:nat -> ST unit (requires (fun h -> (contains h s /\ contains h t /\ addr_of s <> addr_of t) /\ (Seq.length (sel h s) >= s_idx + len) /\ (Seq.length (sel h t) >= t_idx + len) /\ (ctr <= len) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) (s_idx+i) == Seq.index (sel h t) (t_idx+i)))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 t /\ addr_of s <> addr_of t) /\ (modifies (only t) h0 h1) /\ (Seq.length (sel h1 s) >= s_idx + len) /\ (Seq.length (sel h1 t) >= t_idx + len) /\ (Seq.length (sel h0 s) = Seq.length (sel h1 s)) /\ (Seq.length (sel h0 t) = Seq.length (sel h1 t)) /\ (forall (i:nat). i < len ==> Seq.index (sel h1 s) (s_idx+i) == Seq.index (sel h1 t) (t_idx+i)) /\ (forall (i:nat). (i < Seq.length (sel h1 t) /\ (i < t_idx \/ i >= t_idx + len)) ==> Seq.index (sel h1 t) i == Seq.index (sel h0 t) i) )) #set-options "--z3rlimit 60" let rec blit_aux #a s s_idx t t_idx len ctr = match len - ctr with | 0 -> () | _ -> upd t (t_idx + ctr) (index s (s_idx + ctr)); blit_aux s s_idx t t_idx len (ctr+1) #set-options "--z3rlimit 5" private val blit: #a:Type -> s:array a -> s_idx:nat -> t:array a -> t_idx:nat -> len:nat -> ST unit (requires (fun h -> (contains h s) /\ (contains h t) /\ (addr_of s <> addr_of t) /\ (Seq.length (sel h s) >= s_idx + len) /\ (Seq.length (sel h t) >= t_idx + len))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 t /\ addr_of s <> addr_of t) /\ (Seq.length (sel h1 s) >= s_idx + len) /\ (Seq.length (sel h1 t) >= t_idx + len) /\ (Seq.length (sel h0 s) = Seq.length (sel h1 s)) /\ (Seq.length (sel h0 t) = Seq.length (sel h1 t)) /\ (modifies (only t) h0 h1) /\ (forall (i:nat). i < len ==> Seq.index (sel h1 s) (s_idx+i) == Seq.index (sel h1 t) (t_idx+i)) /\ (forall (i:nat).{:pattern (Seq.index (sel h1 t) i)} (i < Seq.length (sel h1 t) /\ (i < t_idx \/ i >= t_idx + len)) ==> (Seq.index (sel h1 t) i == Seq.index (sel h0 t) i)) )) let blit #a s s_idx t t_idx len = blit_aux s s_idx t t_idx len 0
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 120, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Array.array a -> idx: Prims.nat -> len: Prims.nat -> FStar.ST.ST (FStar.Array.array a)
FStar.ST.ST
[]
[]
[ "FStar.Array.array", "Prims.nat", "Prims.unit", "Prims._assert", "FStar.Seq.Base.equal", "FStar.Seq.Base.slice", "FStar.Array.sel", "Prims.op_Addition", "FStar.Monotonic.Heap.heap", "FStar.ST.get", "FStar.Array.blit", "FStar.Array.create", "FStar.Array.index" ]
[]
false
true
false
false
false
let sub #a s idx len =
let h0 = ST.get () in let t = create len (index s 0) in blit s idx t 0 len; let h1 = ST.get () in assert (Seq.equal (Seq.slice (sel h0 s) idx (idx + len)) (sel h1 t)); t
false
FStar.Array.fst
FStar.Array.blit_aux
val blit_aux: #a:Type -> s:array a -> s_idx:nat -> t:array a -> t_idx:nat -> len:nat -> ctr:nat -> ST unit (requires (fun h -> (contains h s /\ contains h t /\ addr_of s <> addr_of t) /\ (Seq.length (sel h s) >= s_idx + len) /\ (Seq.length (sel h t) >= t_idx + len) /\ (ctr <= len) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) (s_idx+i) == Seq.index (sel h t) (t_idx+i)))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 t /\ addr_of s <> addr_of t) /\ (modifies (only t) h0 h1) /\ (Seq.length (sel h1 s) >= s_idx + len) /\ (Seq.length (sel h1 t) >= t_idx + len) /\ (Seq.length (sel h0 s) = Seq.length (sel h1 s)) /\ (Seq.length (sel h0 t) = Seq.length (sel h1 t)) /\ (forall (i:nat). i < len ==> Seq.index (sel h1 s) (s_idx+i) == Seq.index (sel h1 t) (t_idx+i)) /\ (forall (i:nat). (i < Seq.length (sel h1 t) /\ (i < t_idx \/ i >= t_idx + len)) ==> Seq.index (sel h1 t) i == Seq.index (sel h0 t) i) ))
val blit_aux: #a:Type -> s:array a -> s_idx:nat -> t:array a -> t_idx:nat -> len:nat -> ctr:nat -> ST unit (requires (fun h -> (contains h s /\ contains h t /\ addr_of s <> addr_of t) /\ (Seq.length (sel h s) >= s_idx + len) /\ (Seq.length (sel h t) >= t_idx + len) /\ (ctr <= len) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) (s_idx+i) == Seq.index (sel h t) (t_idx+i)))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 t /\ addr_of s <> addr_of t) /\ (modifies (only t) h0 h1) /\ (Seq.length (sel h1 s) >= s_idx + len) /\ (Seq.length (sel h1 t) >= t_idx + len) /\ (Seq.length (sel h0 s) = Seq.length (sel h1 s)) /\ (Seq.length (sel h0 t) = Seq.length (sel h1 t)) /\ (forall (i:nat). i < len ==> Seq.index (sel h1 s) (s_idx+i) == Seq.index (sel h1 t) (t_idx+i)) /\ (forall (i:nat). (i < Seq.length (sel h1 t) /\ (i < t_idx \/ i >= t_idx + len)) ==> Seq.index (sel h1 t) i == Seq.index (sel h0 t) i) ))
let rec blit_aux #a s s_idx t t_idx len ctr = match len - ctr with | 0 -> () | _ -> upd t (t_idx + ctr) (index s (s_idx + ctr)); blit_aux s s_idx t t_idx len (ctr+1)
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 45, "end_line": 116, "start_col": 0, "start_line": 112 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s let to_seq #a s = !s let of_list #a l = of_seq (Seq.seq_of_list l) let create #a n init = ST.alloc (Seq.create n init) let index #a x n = let s = to_seq x in Seq.index s n let upd #a x n v = let s = !x in let s' = Seq.upd s n v in x:= s' let length #a x = let s = !x in Seq.length s let op #a f x = let s = !x in let s' = f s in x := s' let swap #a x i j = let tmpi = index x i in let tmpj = index x j in upd x j tmpi; upd x i tmpj val copy_aux: #a:Type -> s:array a -> cpy:array a -> ctr:nat -> ST unit (requires (fun h -> (contains h s /\ contains h cpy /\ addr_of s <> addr_of cpy) /\ (Seq.length (sel h cpy) = Seq.length (sel h s)) /\ (ctr <= Seq.length (sel h cpy)) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 cpy /\ addr_of s <> addr_of cpy ) /\ (modifies (only cpy) h0 h1) /\ (Seq.equal (sel h1 cpy) (sel h1 s)))) let rec copy_aux #a s cpy ctr = match length cpy - ctr with | 0 -> () | _ -> upd cpy ctr (index s ctr); copy_aux s cpy (ctr+1) let copy #a s = let cpy = create (length s) (index s 0) in copy_aux s cpy 0; cpy private val blit_aux: #a:Type -> s:array a -> s_idx:nat -> t:array a -> t_idx:nat -> len:nat -> ctr:nat -> ST unit (requires (fun h -> (contains h s /\ contains h t /\ addr_of s <> addr_of t) /\ (Seq.length (sel h s) >= s_idx + len) /\ (Seq.length (sel h t) >= t_idx + len) /\ (ctr <= len) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) (s_idx+i) == Seq.index (sel h t) (t_idx+i)))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 t /\ addr_of s <> addr_of t) /\ (modifies (only t) h0 h1) /\ (Seq.length (sel h1 s) >= s_idx + len) /\ (Seq.length (sel h1 t) >= t_idx + len) /\ (Seq.length (sel h0 s) = Seq.length (sel h1 s)) /\ (Seq.length (sel h0 t) = Seq.length (sel h1 t)) /\ (forall (i:nat). i < len ==> Seq.index (sel h1 s) (s_idx+i) == Seq.index (sel h1 t) (t_idx+i)) /\ (forall (i:nat). (i < Seq.length (sel h1 t) /\ (i < t_idx \/ i >= t_idx + len)) ==> Seq.index (sel h1 t) i == Seq.index (sel h0 t) i) ))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 60, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Array.array a -> s_idx: Prims.nat -> t: FStar.Array.array a -> t_idx: Prims.nat -> len: Prims.nat -> ctr: Prims.nat -> FStar.ST.ST Prims.unit
FStar.ST.ST
[]
[]
[ "FStar.Array.array", "Prims.nat", "Prims.op_Subtraction", "Prims.unit", "Prims.int", "FStar.Array.blit_aux", "Prims.op_Addition", "FStar.Array.upd", "FStar.Array.index" ]
[ "recursion" ]
false
true
false
false
false
let rec blit_aux #a s s_idx t t_idx len ctr =
match len - ctr with | 0 -> () | _ -> upd t (t_idx + ctr) (index s (s_idx + ctr)); blit_aux s s_idx t t_idx len (ctr + 1)
false
Hacl.Impl.RSAPSS.Padding.fst
Hacl.Impl.RSAPSS.Padding.get_maskedDB
val get_maskedDB: a:Hash.hash_alg{S.hash_is_supported a} -> saltLen:salt_len_t a -> salt:lbuffer uint8 saltLen -> hLen:size_t{v hLen == Hash.hash_length a} -> m1Hash:lbuffer uint8 hLen -> emBits:em_len_t a saltLen -> dbLen:size_t{v dbLen == S.blocks (v emBits) 8 - Hash.hash_length a - 1} -> db_mask:lbuffer uint8 dbLen -> Stack unit (requires fun h -> live h salt /\ live h m1Hash /\ live h db_mask /\ disjoint m1Hash salt /\ disjoint m1Hash db_mask /\ disjoint db_mask salt /\ as_seq h db_mask == LSeq.create (v dbLen) (u8 0)) (ensures fun h0 _ h1 -> modifies (loc db_mask) h0 h1 /\ (let emLen = S.blocks (v emBits) 8 in let dbLen = emLen - Hash.hash_length a - 1 in let db = LSeq.create dbLen (u8 0) in let last_before_salt = dbLen - v saltLen - 1 in let db = LSeq.upd db last_before_salt (u8 1) in let db = LSeq.update_sub db (last_before_salt + 1) (v saltLen) (as_seq h0 salt) in let dbMask = S.mgf_hash a (v hLen) (as_seq h0 m1Hash) dbLen in let maskedDB = S.xor_bytes db dbMask in let maskedDB = S.db_zero maskedDB (v emBits) in as_seq h1 db_mask == maskedDB))
val get_maskedDB: a:Hash.hash_alg{S.hash_is_supported a} -> saltLen:salt_len_t a -> salt:lbuffer uint8 saltLen -> hLen:size_t{v hLen == Hash.hash_length a} -> m1Hash:lbuffer uint8 hLen -> emBits:em_len_t a saltLen -> dbLen:size_t{v dbLen == S.blocks (v emBits) 8 - Hash.hash_length a - 1} -> db_mask:lbuffer uint8 dbLen -> Stack unit (requires fun h -> live h salt /\ live h m1Hash /\ live h db_mask /\ disjoint m1Hash salt /\ disjoint m1Hash db_mask /\ disjoint db_mask salt /\ as_seq h db_mask == LSeq.create (v dbLen) (u8 0)) (ensures fun h0 _ h1 -> modifies (loc db_mask) h0 h1 /\ (let emLen = S.blocks (v emBits) 8 in let dbLen = emLen - Hash.hash_length a - 1 in let db = LSeq.create dbLen (u8 0) in let last_before_salt = dbLen - v saltLen - 1 in let db = LSeq.upd db last_before_salt (u8 1) in let db = LSeq.update_sub db (last_before_salt + 1) (v saltLen) (as_seq h0 salt) in let dbMask = S.mgf_hash a (v hLen) (as_seq h0 m1Hash) dbLen in let maskedDB = S.xor_bytes db dbMask in let maskedDB = S.db_zero maskedDB (v emBits) in as_seq h1 db_mask == maskedDB))
let get_maskedDB a saltLen salt hLen m1Hash emBits dbLen db = push_frame (); //db = [0x00;..; 0x00; 0x01; salt] let last_before_salt = dbLen -! saltLen -! 1ul in db.(last_before_salt) <- u8 1; update_sub db (last_before_salt +! 1ul) saltLen salt; let dbMask = create dbLen (u8 0) in assert_norm (Hash.hash_length a + 4 <= max_size_t /\ (Hash.hash_length a + 4) `less_than_max_input_length` a); mgf_hash a hLen m1Hash dbLen dbMask; xor_bytes dbLen db dbMask; db_zero dbLen db emBits; pop_frame()
{ "file_name": "code/rsapss/Hacl.Impl.RSAPSS.Padding.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 13, "end_line": 143, "start_col": 0, "start_line": 131 }
module Hacl.Impl.RSAPSS.Padding open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Impl.RSAPSS.MGF module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module Hash = Spec.Agile.Hash module S = Spec.RSAPSS module BD = Hacl.Bignum.Definitions #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let less_than_max_input_length = Spec.Hash.Definitions.less_than_max_input_length inline_for_extraction noextract let salt_len_t (a:Hash.fixed_len_alg) = saltLen:size_t{8 + Hash.hash_length a + v saltLen <= max_size_t /\ (8 + Hash.hash_length a + v saltLen) `less_than_max_input_length` a} inline_for_extraction noextract let msg_len_t (a:Hash.fixed_len_alg) = msgLen:size_t{v msgLen `less_than_max_input_length` a} inline_for_extraction noextract let em_len_t (a:Hash.fixed_len_alg) (saltLen:salt_len_t a) = emBits:size_t{0 < v emBits /\ Hash.hash_length a + v saltLen + 2 <= S.blocks (v emBits) 8} inline_for_extraction noextract val xor_bytes: len:size_t{v len > 0} -> b1:lbuffer uint8 len -> b2:lbuffer uint8 len -> Stack unit (requires fun h -> live h b1 /\ live h b2 /\ disjoint b1 b2) (ensures fun h0 _ h1 -> modifies (loc b1) h0 h1 /\ as_seq h1 b1 == S.xor_bytes (as_seq h0 b1) (as_seq h0 b2)) let xor_bytes len b1 b2 = map2T len b1 (fun x y -> x ^. y) b1 b2 inline_for_extraction noextract val db_zero: len:size_t{v len > 0} -> db:lbuffer uint8 len -> emBits:size_t -> Stack unit (requires fun h -> live h db) (ensures fun h0 _ h1 -> modifies (loc db) h0 h1 /\ as_seq h1 db == S.db_zero #(v len) (as_seq h0 db) (v emBits)) let db_zero len db emBits = let msBits = emBits %. 8ul in if msBits >. 0ul then db.(0ul) <- db.(0ul) &. (u8 0xff >>. (8ul -. msBits)) inline_for_extraction noextract val get_m1Hash: a:Hash.hash_alg{S.hash_is_supported a} -> saltLen:salt_len_t a -> salt:lbuffer uint8 saltLen -> msgLen:msg_len_t a -> msg:lbuffer uint8 msgLen -> hLen:size_t{v hLen == Hash.hash_length a} -> m1Hash:lbuffer uint8 hLen -> Stack unit (requires fun h -> live h salt /\ live h msg /\ live h m1Hash /\ disjoint msg salt /\ disjoint m1Hash msg /\ disjoint m1Hash salt) (ensures fun h0 _ h1 -> modifies (loc m1Hash) h0 h1 /\ (let mHash = Hash.hash a (as_seq h0 msg) in let m1Len = 8 + Hash.hash_length a + v saltLen in let m1 = LSeq.create m1Len (u8 0) in let m1 = LSeq.update_sub m1 8 (Hash.hash_length a) mHash in let m1 = LSeq.update_sub m1 (8 + Hash.hash_length a) (v saltLen) (as_seq h0 salt) in as_seq h1 m1Hash == Hash.hash a m1)) let get_m1Hash a saltLen salt msgLen msg hLen m1Hash = push_frame (); //m1 = [8 * 0x00; mHash; salt] let m1Len = 8ul +! hLen +! saltLen in let m1 = create m1Len (u8 0) in let h0 = ST.get () in update_sub_f h0 m1 8ul hLen (fun h -> Hash.hash a (as_seq h0 msg)) (fun _ -> hash a (sub m1 8ul hLen) msgLen msg); update_sub m1 (8ul +! hLen) saltLen salt; hash a m1Hash m1Len m1; pop_frame() inline_for_extraction noextract val get_maskedDB: a:Hash.hash_alg{S.hash_is_supported a} -> saltLen:salt_len_t a -> salt:lbuffer uint8 saltLen -> hLen:size_t{v hLen == Hash.hash_length a} -> m1Hash:lbuffer uint8 hLen -> emBits:em_len_t a saltLen -> dbLen:size_t{v dbLen == S.blocks (v emBits) 8 - Hash.hash_length a - 1} -> db_mask:lbuffer uint8 dbLen -> Stack unit (requires fun h -> live h salt /\ live h m1Hash /\ live h db_mask /\ disjoint m1Hash salt /\ disjoint m1Hash db_mask /\ disjoint db_mask salt /\ as_seq h db_mask == LSeq.create (v dbLen) (u8 0)) (ensures fun h0 _ h1 -> modifies (loc db_mask) h0 h1 /\ (let emLen = S.blocks (v emBits) 8 in let dbLen = emLen - Hash.hash_length a - 1 in let db = LSeq.create dbLen (u8 0) in let last_before_salt = dbLen - v saltLen - 1 in let db = LSeq.upd db last_before_salt (u8 1) in let db = LSeq.update_sub db (last_before_salt + 1) (v saltLen) (as_seq h0 salt) in let dbMask = S.mgf_hash a (v hLen) (as_seq h0 m1Hash) dbLen in let maskedDB = S.xor_bytes db dbMask in let maskedDB = S.db_zero maskedDB (v emBits) in as_seq h1 db_mask == maskedDB))
{ "checked_file": "/", "dependencies": [ "Spec.RSAPSS.fst.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.RSAPSS.MGF.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.RSAPSS.Padding.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Spec.RSAPSS", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.RSAPSS.MGF", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.RSAPSS", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.RSAPSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.hash_alg{Spec.RSAPSS.hash_is_supported a} -> saltLen: Hacl.Impl.RSAPSS.Padding.salt_len_t a -> salt: Lib.Buffer.lbuffer Lib.IntTypes.uint8 saltLen -> hLen: Lib.IntTypes.size_t{Lib.IntTypes.v hLen == Spec.Hash.Definitions.hash_length a} -> m1Hash: Lib.Buffer.lbuffer Lib.IntTypes.uint8 hLen -> emBits: Hacl.Impl.RSAPSS.Padding.em_len_t a saltLen -> dbLen: Lib.IntTypes.size_t { Lib.IntTypes.v dbLen == Spec.RSAPSS.blocks (Lib.IntTypes.v emBits) 8 - Spec.Hash.Definitions.hash_length a - 1 } -> db_mask: Lib.Buffer.lbuffer Lib.IntTypes.uint8 dbLen -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "Spec.Hash.Definitions.hash_alg", "Prims.b2t", "Spec.RSAPSS.hash_is_supported", "Hacl.Impl.RSAPSS.Padding.salt_len_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Lib.IntTypes.size_t", "Prims.eq2", "Prims.int", "Prims.l_or", "Lib.IntTypes.range", "Lib.IntTypes.U32", "Prims.l_and", "Prims.op_GreaterThanOrEqual", "Prims.op_LessThanOrEqual", "Lib.IntTypes.max_size_t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.PUB", "Spec.Hash.Definitions.hash_length", "Hacl.Impl.RSAPSS.Padding.em_len_t", "Prims.op_Subtraction", "Spec.RSAPSS.blocks", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Impl.RSAPSS.Padding.db_zero", "Hacl.Impl.RSAPSS.Padding.xor_bytes", "Hacl.Impl.RSAPSS.MGF.mgf_hash", "FStar.Pervasives.assert_norm", "Prims.op_Addition", "Hacl.Impl.RSAPSS.Padding.less_than_max_input_length", "Lib.Buffer.lbuffer_t", "Lib.Buffer.MUT", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.Buffer.create", "Lib.IntTypes.u8", "Lib.Buffer.update_sub", "Lib.IntTypes.op_Plus_Bang", "FStar.UInt32.__uint_to_t", "Lib.Buffer.op_Array_Assignment", "Lib.IntTypes.op_Subtraction_Bang", "FStar.HyperStack.ST.push_frame" ]
[]
false
true
false
false
false
let get_maskedDB a saltLen salt hLen m1Hash emBits dbLen db =
push_frame (); let last_before_salt = dbLen -! saltLen -! 1ul in db.(last_before_salt) <- u8 1; update_sub db (last_before_salt +! 1ul) saltLen salt; let dbMask = create dbLen (u8 0) in assert_norm (Hash.hash_length a + 4 <= max_size_t /\ (Hash.hash_length a + 4) `less_than_max_input_length` a); mgf_hash a hLen m1Hash dbLen dbMask; xor_bytes dbLen db dbMask; db_zero dbLen db emBits; pop_frame ()
false
LowParse.SLow.Option.fst
LowParse.SLow.Option.serialize32_option
val serialize32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (#s: serializer p) (s32: serializer32 s) (u: squash (k.parser_kind_low > 0)) : Tot (serializer32 (serialize_option s u))
val serialize32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (#s: serializer p) (s32: serializer32 s) (u: squash (k.parser_kind_low > 0)) : Tot (serializer32 (serialize_option s u))
let serialize32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (#s: serializer p) (s32: serializer32 s) (u: squash (k.parser_kind_low > 0)) : Tot (serializer32 (serialize_option s u)) = fun input -> ((match input with | None -> [@inline_let] let res = B32.empty_bytes in assert (B32.reveal res `Seq.equal` Seq.empty); res | Some y -> s32 y) <: (y: B32.bytes { serializer32_correct (serialize_option s u) input y } ))
{ "file_name": "src/lowparse/LowParse.SLow.Option.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 96, "end_line": 22, "start_col": 0, "start_line": 15 }
module LowParse.SLow.Option include LowParse.Spec.Option include LowParse.SLow.Base module U32 = FStar.UInt32 module B32 = FStar.Bytes inline_for_extraction let parse32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (p32: parser32 p) : Tot (parser32 (parse_option p)) = fun input -> ((match p32 input with | Some (x, consumed) -> Some (Some x, consumed) | _ -> Some (None, 0ul)) <: (y: option (option t * U32.t) { parser32_correct (parse_option p) input y } ))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.Option.fst.checked", "LowParse.SLow.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Bytes.fsti.checked" ], "interface_file": false, "source_file": "LowParse.SLow.Option.fst" }
[ { "abbrev": true, "full_module": "FStar.Bytes", "short_module": "B32" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.SLow.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Option", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s32: LowParse.SLow.Base.serializer32 s -> u25: Prims.squash (Mkparser_kind'?.parser_kind_low k > 0) -> LowParse.SLow.Base.serializer32 (LowParse.Spec.Option.serialize_option s u25)
Prims.Tot
[ "total" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.SLow.Base.serializer32", "Prims.squash", "Prims.b2t", "Prims.op_GreaterThan", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_low", "FStar.Pervasives.Native.option", "Prims.unit", "Prims._assert", "FStar.Seq.Base.equal", "FStar.Bytes.byte", "FStar.Bytes.reveal", "FStar.Seq.Base.empty", "FStar.Bytes.lbytes", "FStar.Bytes.empty_bytes", "FStar.Bytes.bytes", "LowParse.SLow.Base.serializer32_correct", "LowParse.Spec.Option.parse_option_kind", "LowParse.Spec.Option.parse_option", "LowParse.Spec.Option.serialize_option", "LowParse.SLow.Base.bytes32" ]
[]
false
false
false
false
false
let serialize32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (#s: serializer p) (s32: serializer32 s) (u: squash (k.parser_kind_low > 0)) : Tot (serializer32 (serialize_option s u)) =
fun input -> ((match input with | None -> [@@ inline_let ]let res = B32.empty_bytes in assert ((B32.reveal res) `Seq.equal` Seq.empty); res | Some y -> s32 y) <: (y: B32.bytes{serializer32_correct (serialize_option s u) input y}))
false
FStar.Array.fst
FStar.Array.blit
val blit: #a:Type -> s:array a -> s_idx:nat -> t:array a -> t_idx:nat -> len:nat -> ST unit (requires (fun h -> (contains h s) /\ (contains h t) /\ (addr_of s <> addr_of t) /\ (Seq.length (sel h s) >= s_idx + len) /\ (Seq.length (sel h t) >= t_idx + len))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 t /\ addr_of s <> addr_of t) /\ (Seq.length (sel h1 s) >= s_idx + len) /\ (Seq.length (sel h1 t) >= t_idx + len) /\ (Seq.length (sel h0 s) = Seq.length (sel h1 s)) /\ (Seq.length (sel h0 t) = Seq.length (sel h1 t)) /\ (modifies (only t) h0 h1) /\ (forall (i:nat). i < len ==> Seq.index (sel h1 s) (s_idx+i) == Seq.index (sel h1 t) (t_idx+i)) /\ (forall (i:nat).{:pattern (Seq.index (sel h1 t) i)} (i < Seq.length (sel h1 t) /\ (i < t_idx \/ i >= t_idx + len)) ==> (Seq.index (sel h1 t) i == Seq.index (sel h0 t) i)) ))
val blit: #a:Type -> s:array a -> s_idx:nat -> t:array a -> t_idx:nat -> len:nat -> ST unit (requires (fun h -> (contains h s) /\ (contains h t) /\ (addr_of s <> addr_of t) /\ (Seq.length (sel h s) >= s_idx + len) /\ (Seq.length (sel h t) >= t_idx + len))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 t /\ addr_of s <> addr_of t) /\ (Seq.length (sel h1 s) >= s_idx + len) /\ (Seq.length (sel h1 t) >= t_idx + len) /\ (Seq.length (sel h0 s) = Seq.length (sel h1 s)) /\ (Seq.length (sel h0 t) = Seq.length (sel h1 t)) /\ (modifies (only t) h0 h1) /\ (forall (i:nat). i < len ==> Seq.index (sel h1 s) (s_idx+i) == Seq.index (sel h1 t) (t_idx+i)) /\ (forall (i:nat).{:pattern (Seq.index (sel h1 t) i)} (i < Seq.length (sel h1 t) /\ (i < t_idx \/ i >= t_idx + len)) ==> (Seq.index (sel h1 t) i == Seq.index (sel h0 t) i)) ))
let blit #a s s_idx t t_idx len = blit_aux s s_idx t t_idx len 0
{ "file_name": "ulib/legacy/FStar.Array.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 32, "end_line": 141, "start_col": 0, "start_line": 140 }
(* Copyright 2008-2014 Nikhil Swamy and Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) (** F* standard library mutable arrays module. @summary Mutable arrays *) module FStar.Array #set-options "--max_fuel 0 --initial_fuel 0 --initial_ifuel 0 --max_ifuel 0" open FStar.All open FStar.Seq open FStar.Ref let array a = ref (seq a) let as_ref #_ arr = arr let op_At_Bar #a s1 s2 = let s1' = !s1 in let s2' = !s2 in ST.alloc (Seq.append s1' s2') let of_seq #a s = ST.alloc s let to_seq #a s = !s let of_list #a l = of_seq (Seq.seq_of_list l) let create #a n init = ST.alloc (Seq.create n init) let index #a x n = let s = to_seq x in Seq.index s n let upd #a x n v = let s = !x in let s' = Seq.upd s n v in x:= s' let length #a x = let s = !x in Seq.length s let op #a f x = let s = !x in let s' = f s in x := s' let swap #a x i j = let tmpi = index x i in let tmpj = index x j in upd x j tmpi; upd x i tmpj val copy_aux: #a:Type -> s:array a -> cpy:array a -> ctr:nat -> ST unit (requires (fun h -> (contains h s /\ contains h cpy /\ addr_of s <> addr_of cpy) /\ (Seq.length (sel h cpy) = Seq.length (sel h s)) /\ (ctr <= Seq.length (sel h cpy)) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 cpy /\ addr_of s <> addr_of cpy ) /\ (modifies (only cpy) h0 h1) /\ (Seq.equal (sel h1 cpy) (sel h1 s)))) let rec copy_aux #a s cpy ctr = match length cpy - ctr with | 0 -> () | _ -> upd cpy ctr (index s ctr); copy_aux s cpy (ctr+1) let copy #a s = let cpy = create (length s) (index s 0) in copy_aux s cpy 0; cpy private val blit_aux: #a:Type -> s:array a -> s_idx:nat -> t:array a -> t_idx:nat -> len:nat -> ctr:nat -> ST unit (requires (fun h -> (contains h s /\ contains h t /\ addr_of s <> addr_of t) /\ (Seq.length (sel h s) >= s_idx + len) /\ (Seq.length (sel h t) >= t_idx + len) /\ (ctr <= len) /\ (forall (i:nat). i < ctr ==> Seq.index (sel h s) (s_idx+i) == Seq.index (sel h t) (t_idx+i)))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 t /\ addr_of s <> addr_of t) /\ (modifies (only t) h0 h1) /\ (Seq.length (sel h1 s) >= s_idx + len) /\ (Seq.length (sel h1 t) >= t_idx + len) /\ (Seq.length (sel h0 s) = Seq.length (sel h1 s)) /\ (Seq.length (sel h0 t) = Seq.length (sel h1 t)) /\ (forall (i:nat). i < len ==> Seq.index (sel h1 s) (s_idx+i) == Seq.index (sel h1 t) (t_idx+i)) /\ (forall (i:nat). (i < Seq.length (sel h1 t) /\ (i < t_idx \/ i >= t_idx + len)) ==> Seq.index (sel h1 t) i == Seq.index (sel h0 t) i) )) #set-options "--z3rlimit 60" let rec blit_aux #a s s_idx t t_idx len ctr = match len - ctr with | 0 -> () | _ -> upd t (t_idx + ctr) (index s (s_idx + ctr)); blit_aux s s_idx t t_idx len (ctr+1) #set-options "--z3rlimit 5" private val blit: #a:Type -> s:array a -> s_idx:nat -> t:array a -> t_idx:nat -> len:nat -> ST unit (requires (fun h -> (contains h s) /\ (contains h t) /\ (addr_of s <> addr_of t) /\ (Seq.length (sel h s) >= s_idx + len) /\ (Seq.length (sel h t) >= t_idx + len))) (ensures (fun h0 u h1 -> (contains h1 s /\ contains h1 t /\ addr_of s <> addr_of t) /\ (Seq.length (sel h1 s) >= s_idx + len) /\ (Seq.length (sel h1 t) >= t_idx + len) /\ (Seq.length (sel h0 s) = Seq.length (sel h1 s)) /\ (Seq.length (sel h0 t) = Seq.length (sel h1 t)) /\ (modifies (only t) h0 h1) /\ (forall (i:nat). i < len ==> Seq.index (sel h1 s) (s_idx+i) == Seq.index (sel h1 t) (t_idx+i)) /\ (forall (i:nat).{:pattern (Seq.index (sel h1 t) i)} (i < Seq.length (sel h1 t) /\ (i < t_idx \/ i >= t_idx + len)) ==>
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.ST.fst.checked", "FStar.Seq.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked" ], "interface_file": true, "source_file": "FStar.Array.fst" }
[ { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Array.array a -> s_idx: Prims.nat -> t: FStar.Array.array a -> t_idx: Prims.nat -> len: Prims.nat -> FStar.ST.ST Prims.unit
FStar.ST.ST
[]
[]
[ "FStar.Array.array", "Prims.nat", "FStar.Array.blit_aux", "Prims.unit" ]
[]
false
true
false
false
false
let blit #a s s_idx t t_idx len =
blit_aux s s_idx t t_idx len 0
false
Pulse.Class.PtsTo.fsti
Pulse.Class.PtsTo.full_default
val full_default: Prims.unit -> Tac unit
val full_default: Prims.unit -> Tac unit
let full_default () : Tac unit = exact (`full_perm)
{ "file_name": "share/steel/examples/pulse/class/Pulse.Class.PtsTo.fsti", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 51, "end_line": 10, "start_col": 0, "start_line": 10 }
module Pulse.Class.PtsTo open Pulse.Lib.Pervasives open FStar.Tactics.V2 (* NOTE: this class is not very useful unless we either inline these methods early in the typechecking process, or we make the pulse checker normalize (and unfold) the contexts. *)
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Reference.fsti.checked", "Pulse.Lib.Pervasives.fst.checked", "Pulse.Lib.HigherReference.fsti.checked", "Pulse.Lib.GhostReference.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Tactics.Typeclasses.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Class.PtsTo.fsti" }
[ { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Class", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Class", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.exact" ]
[]
false
true
false
false
false
let full_default () : Tac unit =
exact (`full_perm)
false
LowParse.Spec.VLGen.fst
LowParse.Spec.VLGen.parse_vlgen_weak_eq_parse_vlgen
val parse_vlgen_weak_eq_parse_vlgen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (requires (parse_vlgen_precond min max k)) (ensures (parse (parse_vlgen_weak min max pk p) input == parse (parse_vlgen min max pk s) input))
val parse_vlgen_weak_eq_parse_vlgen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (requires (parse_vlgen_precond min max k)) (ensures (parse (parse_vlgen_weak min max pk p) input == parse (parse_vlgen min max pk s) input))
let parse_vlgen_weak_eq_parse_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (requires (parse_vlgen_precond min max k)) (ensures ( parse (parse_vlgen_weak min max pk p) input == parse (parse_vlgen min max pk s) input )) = parse_vlgen_weak_unfold min max pk p input; parse_vlgen_unfold min max pk s input
{ "file_name": "src/lowparse/LowParse.Spec.VLGen.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 39, "end_line": 573, "start_col": 0, "start_line": 556 }
module LowParse.Spec.VLGen include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLData // for parse_bounded_vldata_strong_t (* TODO: this module should deprecate and replace LowParse.Spec.VLData *) module U32 = FStar.UInt32 module Seq = FStar.Seq let tag_of_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : GTot (bounded_int32 min max) = U32.uint_to_t (Seq.length (serialize s x)) inline_for_extraction let synth_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: parse_fldata_strong_t s (U32.v sz)) : Tot (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) = x inline_for_extraction let parse_bounded_vlgen_payload_kind (min: nat) (max: nat { min <= max } ) (k: parser_kind) : Tot parser_kind = [@inline_let] let kmin = k.parser_kind_low in [@inline_let] let min' = if kmin > min then kmin else min in [@inline_let] let max' = match k.parser_kind_high with | None -> max | Some kmax -> if kmax < max then kmax else max in [@inline_let] let max' = if max' < min' then min' else max' in strong_parser_kind min' max' ( match k.parser_kind_metadata with | Some ParserKindMetadataFail -> Some ParserKindMetadataFail | _ -> None ) let parse_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) else weaken (parse_bounded_vlgen_payload_kind min max k) (parse_fldata_strong s (U32.v sz) `parse_synth` synth_bounded_vlgen_payload min max s sz) let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed) )) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input inline_for_extraction let parse_bounded_vlgen_kind (sk: parser_kind) (min: nat) (max: nat { min <= max } ) (k: parser_kind) = and_then_kind sk (parse_bounded_vlgen_payload_kind min max k) let parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (parser (parse_bounded_vlgen_kind sk min max k) (parse_bounded_vldata_strong_t min max s)) = parse_tagged_union pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) let parse_bounded_vlgen_unfold_aux (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1 let parse_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1; if Seq.length input < sz + U32.v len then () else Seq.slice_slice input sz (Seq.length input) 0 (U32.v len) inline_for_extraction let synth_vlgen (min: nat) (max: nat) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : Tot t = x let parse_vlgen_precond (min: nat) (max: nat { min <= max } ) (k: parser_kind) : GTot bool = match k.parser_kind_high with | None -> false | Some kmax -> min <= k.parser_kind_low && kmax <= max let parse_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (parser (parse_bounded_vlgen_kind sk min max k) t) = parse_bounded_vlgen min max pk s `parse_synth` synth_vlgen min max s let parse_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: bytes) : Lemma (let res = parse (parse_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) input; parse_bounded_vlgen_unfold min max pk s input inline_for_extraction let synth_bounded_vlgen_payload_recip (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Tot (parse_fldata_strong_t s (U32.v sz)) = x let serialize_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (serializer (parse_bounded_vlgen_payload min max s sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_serializer (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) (fun _ -> ()) else serialize_weaken (parse_bounded_vlgen_payload_kind min max k) (serialize_synth (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () ) let serialize_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Lemma (serialize (serialize_bounded_vlgen_payload min max s sz) input == serialize s input) = serialize_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () input let serialize_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (serializer (parse_bounded_vlgen min max pk s)) = serialize_tagged_union ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) let serialize_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: parse_bounded_vldata_strong_t min max s) : Lemma (serialize (serialize_bounded_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_tagged_union_eq ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) input; let tg : bounded_int32 min max = tag_of_bounded_vlgen_payload min max s input in serialize_bounded_vlgen_payload_unfold min max s tg input inline_for_extraction let synth_vlgen_recip (min: nat) (max: nat { min <= max } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k } ) (x: t) : Tot (parse_bounded_vldata_strong_t min max s) = [@inline_let] let _ = let sl = Seq.length (serialize s x) in assert (min <= sl /\ sl <= max) in x let serialize_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (serializer (parse_vlgen min max pk s)) = serialize_synth (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) () let serialize_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: t) : Lemma (serialize (serialize_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) () input; serialize_bounded_vlgen_unfold min max ssk s input (* What if we are not sure the serializer exists? *) inline_for_extraction noextract let parse_vlgen_weak_payload_kind (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) : Tot parser_kind = strong_parser_kind min max None let parse_vlgen_weak_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (p: parser k t) (bound: bounded_int32 min max) : Tot (parser (parse_vlgen_weak_payload_kind min max) t) = weaken (parse_vlgen_weak_payload_kind min max) (parse_fldata p (U32.v bound)) let parse_vlgen_weak_payload_and_then_cases_injective (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (p: parser k t) : Lemma (and_then_cases_injective (parse_vlgen_weak_payload min max p)) = and_then_cases_injective_intro (parse_vlgen_weak_payload min max p) (fun (x1 x2: bounded_int32 min max) b1 b2 -> parse_injective p (Seq.slice b1 0 (U32.v x1)) (Seq.slice b2 0 (U32.v x2)) ) inline_for_extraction noextract let parse_vlgen_weak_kind (kl: parser_kind) (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) : Tot parser_kind = and_then_kind kl (parse_vlgen_weak_payload_kind min max) let parse_vlgen_weak (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (parser (parse_vlgen_weak_kind sk min max) t) = parse_vlgen_weak_payload_and_then_cases_injective min max p; pk `and_then` parse_vlgen_weak_payload min max p let parse_vlgen_weak_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (let res = parse (parse_vlgen_weak min max pk p) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_vlgen_weak_payload_and_then_cases_injective min max p; and_then_eq pk (parse_vlgen_weak_payload min max p) input let parse_vlgen_weak_eq_parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (match parse (parse_vlgen_weak min max pk p) input, parse (parse_bounded_vlgen min max pk s) input with | None, None -> True | Some (res1, consumed1), Some (res2, consumed2) -> res1 == (res2 <: t) /\ consumed1 == consumed2 | _ -> False) = parse_vlgen_weak_unfold min max pk p input; parse_bounded_vlgen_unfold min max pk s input
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLData.fsti.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.VLGen.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLData", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> pk: LowParse.Spec.Base.parser sk (LowParse.Spec.BoundedInt.bounded_int32 min max) -> s: LowParse.Spec.Base.serializer p -> input: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (requires LowParse.Spec.VLGen.parse_vlgen_precond min max k) (ensures LowParse.Spec.Base.parse (LowParse.Spec.VLGen.parse_vlgen_weak min max pk p) input == LowParse.Spec.Base.parse (LowParse.Spec.VLGen.parse_vlgen min max pk s) input)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.serializer", "LowParse.Bytes.bytes", "LowParse.Spec.VLGen.parse_vlgen_unfold", "Prims.unit", "LowParse.Spec.VLGen.parse_vlgen_weak_unfold", "LowParse.Spec.VLGen.parse_vlgen_precond", "Prims.squash", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.Base.consumed_length", "LowParse.Spec.Base.parse", "LowParse.Spec.VLGen.parse_vlgen_weak", "LowParse.Spec.VLGen.parse_vlgen", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let parse_vlgen_weak_eq_parse_vlgen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (requires (parse_vlgen_precond min max k)) (ensures (parse (parse_vlgen_weak min max pk p) input == parse (parse_vlgen min max pk s) input)) =
parse_vlgen_weak_unfold min max pk p input; parse_vlgen_unfold min max pk s input
false
LowParse.SLow.Option.fst
LowParse.SLow.Option.size32_option
val size32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (#s: serializer p) (s32: size32 s) (u: squash (k.parser_kind_low > 0)) : Tot (size32 (serialize_option s u))
val size32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (#s: serializer p) (s32: size32 s) (u: squash (k.parser_kind_low > 0)) : Tot (size32 (serialize_option s u))
let size32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (#s: serializer p) (s32: size32 s) (u: squash (k.parser_kind_low > 0)) : Tot (size32 (serialize_option s u)) = fun input -> ((match input with | None -> 0ul | Some y -> s32 y) <: (y: U32.t { size32_postcond (serialize_option s u) input y } ))
{ "file_name": "src/lowparse/LowParse.SLow.Option.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 87, "end_line": 28, "start_col": 0, "start_line": 25 }
module LowParse.SLow.Option include LowParse.Spec.Option include LowParse.SLow.Base module U32 = FStar.UInt32 module B32 = FStar.Bytes inline_for_extraction let parse32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (p32: parser32 p) : Tot (parser32 (parse_option p)) = fun input -> ((match p32 input with | Some (x, consumed) -> Some (Some x, consumed) | _ -> Some (None, 0ul)) <: (y: option (option t * U32.t) { parser32_correct (parse_option p) input y } )) inline_for_extraction let serialize32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (#s: serializer p) (s32: serializer32 s) (u: squash (k.parser_kind_low > 0)) : Tot (serializer32 (serialize_option s u)) = fun input -> ((match input with | None -> [@inline_let] let res = B32.empty_bytes in assert (B32.reveal res `Seq.equal` Seq.empty); res | Some y -> s32 y) <: (y: B32.bytes { serializer32_correct (serialize_option s u) input y } ))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.Option.fst.checked", "LowParse.SLow.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Bytes.fsti.checked" ], "interface_file": false, "source_file": "LowParse.SLow.Option.fst" }
[ { "abbrev": true, "full_module": "FStar.Bytes", "short_module": "B32" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.SLow.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Option", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s32: LowParse.SLow.Base.size32 s -> u37: Prims.squash (Mkparser_kind'?.parser_kind_low k > 0) -> LowParse.SLow.Base.size32 (LowParse.Spec.Option.serialize_option s u37)
Prims.Tot
[ "total" ]
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.SLow.Base.size32", "Prims.squash", "Prims.b2t", "Prims.op_GreaterThan", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_low", "FStar.Pervasives.Native.option", "FStar.UInt32.__uint_to_t", "FStar.UInt32.t", "LowParse.SLow.Base.size32_postcond", "LowParse.Spec.Option.parse_option_kind", "LowParse.Spec.Option.parse_option", "LowParse.Spec.Option.serialize_option" ]
[]
false
false
false
false
false
let size32_option (#k: parser_kind) (#t: Type) (#p: parser k t) (#s: serializer p) (s32: size32 s) (u: squash (k.parser_kind_low > 0)) : Tot (size32 (serialize_option s u)) =
fun input -> ((match input with | None -> 0ul | Some y -> s32 y) <: (y: U32.t{size32_postcond (serialize_option s u) input y}))
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque_aux
val ws_opaque_aux : a: Spec.Hash.Definitions.sha2_alg -> b: Spec.SHA2.block_w a -> t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a} -> Spec.Hash.Definitions.word a
let ws_opaque_aux = ws
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 29, "end_line": 38, "start_col": 7, "start_line": 38 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = ()
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.sha2_alg -> b: Spec.SHA2.block_w a -> t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a} -> Spec.Hash.Definitions.word a
Prims.Tot
[ "total" ]
[]
[ "Spec.SHA2.Lemmas.ws" ]
[]
false
false
false
false
false
let ws_opaque_aux =
ws
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
val word_to_nat32 (x:word) : nat32
val word_to_nat32 (x:word) : nat32
let word_to_nat32 = vv
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 54, "start_col": 0, "start_line": 54 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Vale.SHA.PPC64LE.SHA_helpers.word -> Vale.Def.Words_s.nat32
Prims.Tot
[ "total" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.vv" ]
[]
false
false
false
true
false
let word_to_nat32 =
vv
false
Pulse.Class.PtsTo.fsti
Pulse.Class.PtsTo.pts_to_hr
[@@ FStar.Tactics.Typeclasses.tcinstance] val pts_to_hr (a: Type) : pointer (Pulse.Lib.HigherReference.ref a) a
[@@ FStar.Tactics.Typeclasses.tcinstance] val pts_to_hr (a: Type) : pointer (Pulse.Lib.HigherReference.ref a) a
instance pts_to_hr (a:Type) : pointer (Pulse.Lib.HigherReference.ref a) a = { pts_to = (fun r v -> Pulse.Lib.HigherReference.pts_to r v); }
{ "file_name": "share/steel/examples/pulse/class/Pulse.Class.PtsTo.fsti", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 1, "end_line": 26, "start_col": 0, "start_line": 24 }
module Pulse.Class.PtsTo open Pulse.Lib.Pervasives open FStar.Tactics.V2 (* NOTE: this class is not very useful unless we either inline these methods early in the typechecking process, or we make the pulse checker normalize (and unfold) the contexts. *) let full_default () : Tac unit = exact (`full_perm) class pointer (r v : Type) = { pts_to : r -> (#[full_default()] f : perm) -> v -> vprop; } instance pts_to_r (a:Type) : pointer (ref a) a = { pts_to = (fun r v -> Pulse.Lib.Reference.pts_to r v); } instance pts_to_gr (a:Type) : pointer (Pulse.Lib.GhostReference.ref a) a = { pts_to = (fun r v -> Pulse.Lib.GhostReference.pts_to r v); }
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Reference.fsti.checked", "Pulse.Lib.Pervasives.fst.checked", "Pulse.Lib.HigherReference.fsti.checked", "Pulse.Lib.GhostReference.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Tactics.Typeclasses.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Class.PtsTo.fsti" }
[ { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Class", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Class", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> Pulse.Class.PtsTo.pointer (Pulse.Lib.HigherReference.ref a) a
Prims.Tot
[ "total" ]
[]
[ "Pulse.Class.PtsTo.Mkpointer", "Pulse.Lib.HigherReference.ref", "PulseCore.FractionalPermission.perm", "Pulse.Lib.HigherReference.pts_to", "PulseCore.FractionalPermission.full_perm", "Pulse.Lib.Core.vprop", "Pulse.Class.PtsTo.pointer" ]
[]
false
false
false
true
false
[@@ FStar.Tactics.Typeclasses.tcinstance] let pts_to_hr (a: Type) : pointer (Pulse.Lib.HigherReference.ref a) a =
{ pts_to = (fun r v -> Pulse.Lib.HigherReference.pts_to r v) }
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.shuffle_core_opaque_aux
val shuffle_core_opaque_aux : a: Spec.Hash.Definitions.sha2_alg -> block: Spec.SHA2.block_w a -> hash: Spec.Hash.Definitions.words_state a -> t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a} -> Spec.Hash.Definitions.words_state a
let shuffle_core_opaque_aux = shuffle_core
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 49, "end_line": 42, "start_col": 7, "start_line": 42 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t)
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.sha2_alg -> block: Spec.SHA2.block_w a -> hash: Spec.Hash.Definitions.words_state a -> t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a} -> Spec.Hash.Definitions.words_state a
Prims.Tot
[ "total" ]
[]
[ "Spec.SHA2.Lemmas.shuffle_core" ]
[]
false
false
false
false
false
let shuffle_core_opaque_aux =
shuffle_core
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.word
val word:Type0
val word:Type0
let word = Lib.IntTypes.uint32
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 30, "start_col": 0, "start_line": 30 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.uint32" ]
[]
false
false
false
true
true
let word =
Lib.IntTypes.uint32
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.update_multi_opaque_aux
val update_multi_opaque_aux : a: Spec.Hash.Definitions.hash_alg -> hash: Spec.Hash.Definitions.words_state a -> prev: Spec.Hash.Definitions.extra_state a -> blocks: Spec.Hash.Definitions.bytes_blocks a -> Prims.Pure (Spec.Hash.Definitions.words_state a)
let update_multi_opaque_aux = opaque_make update_multi
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 73, "end_line": 46, "start_col": 19, "start_line": 46 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.hash_alg -> hash: Spec.Hash.Definitions.words_state a -> prev: Spec.Hash.Definitions.extra_state a -> blocks: Spec.Hash.Definitions.bytes_blocks a -> Prims.Pure (Spec.Hash.Definitions.words_state a)
Prims.Pure
[]
[]
[ "Vale.Def.Opaque_s.opaque_make", "Spec.Hash.Definitions.hash_alg", "Spec.Hash.Definitions.words_state", "Spec.Hash.Definitions.extra_state", "Spec.Hash.Definitions.bytes_blocks", "Prims.b2t", "Spec.Agile.Hash.update_multi_pre", "Prims.l_True", "Spec.Agile.Hash.update_multi" ]
[]
false
false
false
false
false
let update_multi_opaque_aux =
opaque_make update_multi
false
Pulse.Class.PtsTo.fsti
Pulse.Class.PtsTo.pts_to_gr
[@@ FStar.Tactics.Typeclasses.tcinstance] val pts_to_gr (a: Type) : pointer (Pulse.Lib.GhostReference.ref a) a
[@@ FStar.Tactics.Typeclasses.tcinstance] val pts_to_gr (a: Type) : pointer (Pulse.Lib.GhostReference.ref a) a
instance pts_to_gr (a:Type) : pointer (Pulse.Lib.GhostReference.ref a) a = { pts_to = (fun r v -> Pulse.Lib.GhostReference.pts_to r v); }
{ "file_name": "share/steel/examples/pulse/class/Pulse.Class.PtsTo.fsti", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 1, "end_line": 22, "start_col": 0, "start_line": 20 }
module Pulse.Class.PtsTo open Pulse.Lib.Pervasives open FStar.Tactics.V2 (* NOTE: this class is not very useful unless we either inline these methods early in the typechecking process, or we make the pulse checker normalize (and unfold) the contexts. *) let full_default () : Tac unit = exact (`full_perm) class pointer (r v : Type) = { pts_to : r -> (#[full_default()] f : perm) -> v -> vprop; } instance pts_to_r (a:Type) : pointer (ref a) a = { pts_to = (fun r v -> Pulse.Lib.Reference.pts_to r v); }
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Reference.fsti.checked", "Pulse.Lib.Pervasives.fst.checked", "Pulse.Lib.HigherReference.fsti.checked", "Pulse.Lib.GhostReference.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Tactics.Typeclasses.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Class.PtsTo.fsti" }
[ { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Class", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Class", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type0 -> Pulse.Class.PtsTo.pointer (Pulse.Lib.GhostReference.ref a) a
Prims.Tot
[ "total" ]
[]
[ "Pulse.Class.PtsTo.Mkpointer", "Pulse.Lib.GhostReference.ref", "PulseCore.FractionalPermission.perm", "Pulse.Lib.GhostReference.pts_to", "PulseCore.FractionalPermission.full_perm", "Pulse.Lib.Core.vprop", "Pulse.Class.PtsTo.pointer" ]
[]
false
false
false
true
false
[@@ FStar.Tactics.Typeclasses.tcinstance] let pts_to_gr (a: Type) : pointer (Pulse.Lib.GhostReference.ref a) a =
{ pts_to = (fun r v -> Pulse.Lib.GhostReference.pts_to r v) }
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.update_multi_reveal
val update_multi_reveal : _: Prims.unit -> FStar.Pervasives.Lemma (ensures Vale.SHA.PPC64LE.SHA_helpers.update_multi_opaque_aux == Spec.Agile.Hash.update_multi)
let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 118, "end_line": 47, "start_col": 12, "start_line": 47 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Pervasives.Lemma (ensures Vale.SHA.PPC64LE.SHA_helpers.update_multi_opaque_aux == Spec.Agile.Hash.update_multi)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Opaque_s.opaque_revealer", "Spec.Hash.Definitions.hash_alg", "Spec.Hash.Definitions.words_state", "Spec.Hash.Definitions.extra_state", "Spec.Hash.Definitions.bytes_blocks", "Prims.b2t", "Spec.Agile.Hash.update_multi_pre", "Prims.l_True", "Vale.SHA.PPC64LE.SHA_helpers.update_multi_opaque_aux", "Spec.Agile.Hash.update_multi" ]
[]
true
false
true
false
false
let update_multi_reveal =
opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi
false
Pulse.Class.PtsTo.fsti
Pulse.Class.PtsTo.pts_to_r
[@@ FStar.Tactics.Typeclasses.tcinstance] val pts_to_r (a: Type) : pointer (ref a) a
[@@ FStar.Tactics.Typeclasses.tcinstance] val pts_to_r (a: Type) : pointer (ref a) a
instance pts_to_r (a:Type) : pointer (ref a) a = { pts_to = (fun r v -> Pulse.Lib.Reference.pts_to r v); }
{ "file_name": "share/steel/examples/pulse/class/Pulse.Class.PtsTo.fsti", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 1, "end_line": 18, "start_col": 0, "start_line": 16 }
module Pulse.Class.PtsTo open Pulse.Lib.Pervasives open FStar.Tactics.V2 (* NOTE: this class is not very useful unless we either inline these methods early in the typechecking process, or we make the pulse checker normalize (and unfold) the contexts. *) let full_default () : Tac unit = exact (`full_perm) class pointer (r v : Type) = { pts_to : r -> (#[full_default()] f : perm) -> v -> vprop; }
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Reference.fsti.checked", "Pulse.Lib.Pervasives.fst.checked", "Pulse.Lib.HigherReference.fsti.checked", "Pulse.Lib.GhostReference.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Tactics.Typeclasses.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Class.PtsTo.fsti" }
[ { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Class", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Class", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type0 -> Pulse.Class.PtsTo.pointer (Pulse.Lib.Reference.ref a) a
Prims.Tot
[ "total" ]
[]
[ "Pulse.Class.PtsTo.Mkpointer", "Pulse.Lib.Reference.ref", "PulseCore.FractionalPermission.perm", "Pulse.Lib.Reference.pts_to", "PulseCore.FractionalPermission.full_perm", "Pulse.Lib.Core.vprop", "Pulse.Class.PtsTo.pointer" ]
[]
false
false
false
true
false
[@@ FStar.Tactics.Typeclasses.tcinstance] let pts_to_r (a: Type) : pointer (ref a) a =
{ pts_to = (fun r v -> Pulse.Lib.Reference.pts_to r v) }
false
LowParse.Spec.VLGen.fst
LowParse.Spec.VLGen.parse_bounded_vlgen_payload_unfold
val parse_bounded_vlgen_payload_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed)))
val parse_bounded_vlgen_payload_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed)))
let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed) )) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input
{ "file_name": "src/lowparse/LowParse.Spec.VLGen.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 11, "end_line": 109, "start_col": 0, "start_line": 82 }
module LowParse.Spec.VLGen include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLData // for parse_bounded_vldata_strong_t (* TODO: this module should deprecate and replace LowParse.Spec.VLData *) module U32 = FStar.UInt32 module Seq = FStar.Seq let tag_of_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : GTot (bounded_int32 min max) = U32.uint_to_t (Seq.length (serialize s x)) inline_for_extraction let synth_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: parse_fldata_strong_t s (U32.v sz)) : Tot (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) = x inline_for_extraction let parse_bounded_vlgen_payload_kind (min: nat) (max: nat { min <= max } ) (k: parser_kind) : Tot parser_kind = [@inline_let] let kmin = k.parser_kind_low in [@inline_let] let min' = if kmin > min then kmin else min in [@inline_let] let max' = match k.parser_kind_high with | None -> max | Some kmax -> if kmax < max then kmax else max in [@inline_let] let max' = if max' < min' then min' else max' in strong_parser_kind min' max' ( match k.parser_kind_metadata with | Some ParserKindMetadataFail -> Some ParserKindMetadataFail | _ -> None ) let parse_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) else weaken (parse_bounded_vlgen_payload_kind min max k) (parse_fldata_strong s (U32.v sz) `parse_synth` synth_bounded_vlgen_payload min max s sz)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLData.fsti.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.VLGen.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLData", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> s: LowParse.Spec.Base.serializer p -> sz: LowParse.Spec.BoundedInt.bounded_int32 min max -> input: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Base.parse (LowParse.Spec.VLGen.parse_bounded_vlgen_payload min max s sz) input == (match LowParse.Spec.Base.parse (LowParse.Spec.FLData.parse_fldata_strong s (FStar.UInt32.v sz)) input with | FStar.Pervasives.Native.None #_ -> FStar.Pervasives.Native.None | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x consumed) -> FStar.Pervasives.Native.Some (x, consumed)))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Bytes.bytes", "Prims.bool", "LowParse.Spec.Combinators.parse_synth_eq", "LowParse.Spec.FLData.parse_fldata_kind", "FStar.UInt32.v", "LowParse.Spec.FLData.parse_fldata_strong_t", "LowParse.Spec.Base.refine_with_tag", "LowParse.Spec.VLData.parse_bounded_vldata_strong_t", "LowParse.Spec.VLGen.tag_of_bounded_vlgen_payload", "LowParse.Spec.FLData.parse_fldata_strong", "LowParse.Spec.VLGen.synth_bounded_vlgen_payload", "Prims.unit", "Prims.op_BarBar", "Prims.op_GreaterThan", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_low", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_high", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.Base.consumed_length", "LowParse.Spec.Base.parse", "LowParse.Spec.VLGen.parse_bounded_vlgen_payload", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.Mktuple2", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
false
false
true
false
false
let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed))) =
let bounds_off = k.parser_kind_low > U32.v sz || (match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.shuffle_opaque
val shuffle_opaque : a: Spec.Hash.Definitions.sha2_alg -> hash: Spec.Hash.Definitions.words_state a -> block: Spec.SHA2.block_w a -> Spec.Hash.Definitions.words_state a
let shuffle_opaque = shuffle
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 35, "end_line": 132, "start_col": 7, "start_line": 132 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); ()
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.sha2_alg -> hash: Spec.Hash.Definitions.words_state a -> block: Spec.SHA2.block_w a -> Spec.Hash.Definitions.words_state a
Prims.Tot
[ "total" ]
[]
[ "Spec.SHA2.shuffle" ]
[]
false
false
false
false
false
let shuffle_opaque =
shuffle
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.nat32_to_word
val nat32_to_word (x:nat32) : word
val nat32_to_word (x:nat32) : word
let nat32_to_word = to_uint32
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 29, "end_line": 55, "start_col": 0, "start_line": 55 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Vale.Def.Words_s.nat32 -> Vale.SHA.PPC64LE.SHA_helpers.word
Prims.Tot
[ "total" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.to_uint32" ]
[]
false
false
false
true
false
let nat32_to_word =
to_uint32
false
LowParse.Spec.VLGen.fst
LowParse.Spec.VLGen.parse_bounded_vlgen_unfold_aux
val parse_bounded_vlgen_unfold_aux (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None)
val parse_bounded_vlgen_unfold_aux (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None)
let parse_bounded_vlgen_unfold_aux (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1
{ "file_name": "src/lowparse/LowParse.Spec.VLGen.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 59, "end_line": 167, "start_col": 0, "start_line": 134 }
module LowParse.Spec.VLGen include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLData // for parse_bounded_vldata_strong_t (* TODO: this module should deprecate and replace LowParse.Spec.VLData *) module U32 = FStar.UInt32 module Seq = FStar.Seq let tag_of_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : GTot (bounded_int32 min max) = U32.uint_to_t (Seq.length (serialize s x)) inline_for_extraction let synth_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: parse_fldata_strong_t s (U32.v sz)) : Tot (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) = x inline_for_extraction let parse_bounded_vlgen_payload_kind (min: nat) (max: nat { min <= max } ) (k: parser_kind) : Tot parser_kind = [@inline_let] let kmin = k.parser_kind_low in [@inline_let] let min' = if kmin > min then kmin else min in [@inline_let] let max' = match k.parser_kind_high with | None -> max | Some kmax -> if kmax < max then kmax else max in [@inline_let] let max' = if max' < min' then min' else max' in strong_parser_kind min' max' ( match k.parser_kind_metadata with | Some ParserKindMetadataFail -> Some ParserKindMetadataFail | _ -> None ) let parse_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) else weaken (parse_bounded_vlgen_payload_kind min max k) (parse_fldata_strong s (U32.v sz) `parse_synth` synth_bounded_vlgen_payload min max s sz) let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed) )) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input inline_for_extraction let parse_bounded_vlgen_kind (sk: parser_kind) (min: nat) (max: nat { min <= max } ) (k: parser_kind) = and_then_kind sk (parse_bounded_vlgen_payload_kind min max k) let parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (parser (parse_bounded_vlgen_kind sk min max k) (parse_bounded_vldata_strong_t min max s)) = parse_tagged_union pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLData.fsti.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.VLGen.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLData", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> pk: LowParse.Spec.Base.parser sk (LowParse.Spec.BoundedInt.bounded_int32 min max) -> s: LowParse.Spec.Base.serializer p -> input: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (ensures (let res = LowParse.Spec.Base.parse (LowParse.Spec.VLGen.parse_bounded_vlgen min max pk s) input in (match LowParse.Spec.Base.parse pk input with | FStar.Pervasives.Native.None #_ -> res == FStar.Pervasives.Native.None | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ len sz) -> let input' = FStar.Seq.Base.slice input sz (FStar.Seq.Base.length input) in (match LowParse.Spec.Base.parse (LowParse.Spec.FLData.parse_fldata_strong s (FStar.UInt32.v len)) input' with | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x _) -> FStar.Seq.Base.length (LowParse.Spec.Base.serialize s x) = FStar.UInt32.v len /\ res == FStar.Pervasives.Native.Some (x, sz + FStar.UInt32.v len) | _ -> res == FStar.Pervasives.Native.None) <: Type0) <: Type0))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.serializer", "LowParse.Bytes.bytes", "LowParse.Spec.Base.parse", "LowParse.Spec.Base.consumed_length", "LowParse.Spec.VLGen.parse_bounded_vlgen_payload_unfold", "FStar.Seq.Base.seq", "LowParse.Bytes.byte", "FStar.Seq.Base.slice", "FStar.Seq.Base.length", "Prims.unit", "LowParse.Spec.Combinators.parse_tagged_union_eq", "LowParse.Spec.VLData.parse_bounded_vldata_strong_t", "LowParse.Spec.VLGen.tag_of_bounded_vlgen_payload", "LowParse.Spec.VLGen.parse_bounded_vlgen_payload_kind", "LowParse.Spec.VLGen.parse_bounded_vlgen_payload", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.None", "LowParse.Spec.FLData.parse_fldata_strong_t", "FStar.UInt32.v", "LowParse.Spec.FLData.parse_fldata_strong", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "FStar.UInt.size", "FStar.UInt32.n", "LowParse.Spec.Base.serialize", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.Mktuple2", "Prims.op_Addition", "LowParse.Spec.VLGen.parse_bounded_vlgen", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
false
false
true
false
false
let parse_bounded_vlgen_unfold_aux (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None) =
parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1
false
LowParse.Spec.VLGen.fst
LowParse.Spec.VLGen.parse_bounded_vlgen_unfold
val parse_bounded_vlgen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None)
val parse_bounded_vlgen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None)
let parse_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1; if Seq.length input < sz + U32.v len then () else Seq.slice_slice input sz (Seq.length input) 0 (U32.v len)
{ "file_name": "src/lowparse/LowParse.Spec.VLGen.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 66, "end_line": 211, "start_col": 0, "start_line": 169 }
module LowParse.Spec.VLGen include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLData // for parse_bounded_vldata_strong_t (* TODO: this module should deprecate and replace LowParse.Spec.VLData *) module U32 = FStar.UInt32 module Seq = FStar.Seq let tag_of_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : GTot (bounded_int32 min max) = U32.uint_to_t (Seq.length (serialize s x)) inline_for_extraction let synth_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: parse_fldata_strong_t s (U32.v sz)) : Tot (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) = x inline_for_extraction let parse_bounded_vlgen_payload_kind (min: nat) (max: nat { min <= max } ) (k: parser_kind) : Tot parser_kind = [@inline_let] let kmin = k.parser_kind_low in [@inline_let] let min' = if kmin > min then kmin else min in [@inline_let] let max' = match k.parser_kind_high with | None -> max | Some kmax -> if kmax < max then kmax else max in [@inline_let] let max' = if max' < min' then min' else max' in strong_parser_kind min' max' ( match k.parser_kind_metadata with | Some ParserKindMetadataFail -> Some ParserKindMetadataFail | _ -> None ) let parse_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) else weaken (parse_bounded_vlgen_payload_kind min max k) (parse_fldata_strong s (U32.v sz) `parse_synth` synth_bounded_vlgen_payload min max s sz) let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed) )) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input inline_for_extraction let parse_bounded_vlgen_kind (sk: parser_kind) (min: nat) (max: nat { min <= max } ) (k: parser_kind) = and_then_kind sk (parse_bounded_vlgen_payload_kind min max k) let parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (parser (parse_bounded_vlgen_kind sk min max k) (parse_bounded_vldata_strong_t min max s)) = parse_tagged_union pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) let parse_bounded_vlgen_unfold_aux (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLData.fsti.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.VLGen.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLData", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> pk: LowParse.Spec.Base.parser sk (LowParse.Spec.BoundedInt.bounded_int32 min max) -> s: LowParse.Spec.Base.serializer p -> input: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (ensures (let res = LowParse.Spec.Base.parse (LowParse.Spec.VLGen.parse_bounded_vlgen min max pk s) input in (match LowParse.Spec.Base.parse pk input with | FStar.Pervasives.Native.None #_ -> res == FStar.Pervasives.Native.None | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ len sz) -> (match FStar.Seq.Base.length input < sz + FStar.UInt32.v len with | true -> res == FStar.Pervasives.Native.None | _ -> let input' = FStar.Seq.Base.slice input sz (sz + FStar.UInt32.v len) in (match LowParse.Spec.Base.parse p input' with | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x consumed_x) -> (match consumed_x = FStar.UInt32.v len with | true -> FStar.Seq.Base.length (LowParse.Spec.Base.serialize s x) = FStar.UInt32.v len /\ res == FStar.Pervasives.Native.Some (x, sz + FStar.UInt32.v len) | _ -> res == FStar.Pervasives.Native.None) <: Type0 | _ -> res == FStar.Pervasives.Native.None) <: Type0) <: Type0) <: Type0))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.serializer", "LowParse.Bytes.bytes", "LowParse.Spec.Base.parse", "LowParse.Spec.Base.consumed_length", "FStar.Seq.Base.length", "LowParse.Bytes.byte", "Prims.op_Addition", "FStar.UInt32.v", "Prims.bool", "FStar.Seq.Properties.slice_slice", "Prims.unit", "LowParse.Spec.VLGen.parse_bounded_vlgen_payload_unfold", "FStar.Seq.Base.seq", "FStar.Seq.Base.slice", "LowParse.Spec.Combinators.parse_tagged_union_eq", "LowParse.Spec.VLData.parse_bounded_vldata_strong_t", "LowParse.Spec.VLGen.tag_of_bounded_vlgen_payload", "LowParse.Spec.VLGen.parse_bounded_vlgen_payload_kind", "LowParse.Spec.VLGen.parse_bounded_vlgen_payload", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.None", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "FStar.UInt.size", "FStar.UInt32.n", "LowParse.Spec.Base.serialize", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.Mktuple2", "LowParse.Spec.VLGen.parse_bounded_vlgen", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
false
false
true
false
false
let parse_bounded_vlgen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None) =
parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1; if Seq.length input < sz + U32.v len then () else Seq.slice_slice input sz (Seq.length input) 0 (U32.v len)
false
LowParse.Spec.VLGen.fst
LowParse.Spec.VLGen.parse_vlgen_weak_unfold
val parse_vlgen_weak_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (let res = parse (parse_vlgen_weak min max pk p) input in match parse pk input with | None -> res == None | Some (len, sz) -> if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then res == Some (x, sz + U32.v len) else res == None | _ -> res == None)
val parse_vlgen_weak_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (let res = parse (parse_vlgen_weak min max pk p) input in match parse pk input with | None -> res == None | Some (len, sz) -> if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then res == Some (x, sz + U32.v len) else res == None | _ -> res == None)
let parse_vlgen_weak_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (let res = parse (parse_vlgen_weak min max pk p) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_vlgen_weak_payload_and_then_cases_injective min max p; and_then_eq pk (parse_vlgen_weak_payload min max p) input
{ "file_name": "src/lowparse/LowParse.Spec.VLGen.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 59, "end_line": 533, "start_col": 0, "start_line": 503 }
module LowParse.Spec.VLGen include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLData // for parse_bounded_vldata_strong_t (* TODO: this module should deprecate and replace LowParse.Spec.VLData *) module U32 = FStar.UInt32 module Seq = FStar.Seq let tag_of_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : GTot (bounded_int32 min max) = U32.uint_to_t (Seq.length (serialize s x)) inline_for_extraction let synth_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: parse_fldata_strong_t s (U32.v sz)) : Tot (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) = x inline_for_extraction let parse_bounded_vlgen_payload_kind (min: nat) (max: nat { min <= max } ) (k: parser_kind) : Tot parser_kind = [@inline_let] let kmin = k.parser_kind_low in [@inline_let] let min' = if kmin > min then kmin else min in [@inline_let] let max' = match k.parser_kind_high with | None -> max | Some kmax -> if kmax < max then kmax else max in [@inline_let] let max' = if max' < min' then min' else max' in strong_parser_kind min' max' ( match k.parser_kind_metadata with | Some ParserKindMetadataFail -> Some ParserKindMetadataFail | _ -> None ) let parse_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_parser (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) else weaken (parse_bounded_vlgen_payload_kind min max k) (parse_fldata_strong s (U32.v sz) `parse_synth` synth_bounded_vlgen_payload min max s sz) let parse_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: bytes) : Lemma (parse (parse_bounded_vlgen_payload min max s sz) input == (match parse (parse_fldata_strong s (U32.v sz)) input with | None -> None | Some (x, consumed) -> Some (x, consumed) )) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) input inline_for_extraction let parse_bounded_vlgen_kind (sk: parser_kind) (min: nat) (max: nat { min <= max } ) (k: parser_kind) = and_then_kind sk (parse_bounded_vlgen_payload_kind min max k) let parse_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (parser (parse_bounded_vlgen_kind sk min max k) (parse_bounded_vldata_strong_t min max s)) = parse_tagged_union pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) let parse_bounded_vlgen_unfold_aux (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin let input' = Seq.slice input sz (Seq.length input) in match parse (parse_fldata_strong s (U32.v len)) input' with | Some (x, consumed_x) -> Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1 let parse_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: bytes) : Lemma (let res = parse (parse_bounded_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_tagged_union_eq pk (tag_of_bounded_vlgen_payload min max s) (parse_bounded_vlgen_payload min max s) input; match parse pk input with | None -> () | Some (len, sz) -> let input1 = Seq.slice input sz (Seq.length input) in parse_bounded_vlgen_payload_unfold min max s len input1; if Seq.length input < sz + U32.v len then () else Seq.slice_slice input sz (Seq.length input) 0 (U32.v len) inline_for_extraction let synth_vlgen (min: nat) (max: nat) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: parse_bounded_vldata_strong_t min max s) : Tot t = x let parse_vlgen_precond (min: nat) (max: nat { min <= max } ) (k: parser_kind) : GTot bool = match k.parser_kind_high with | None -> false | Some kmax -> min <= k.parser_kind_low && kmax <= max let parse_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (parser (parse_bounded_vlgen_kind sk min max k) t) = parse_bounded_vlgen min max pk s `parse_synth` synth_vlgen min max s let parse_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: bytes) : Lemma (let res = parse (parse_vlgen min max pk s) input in match parse pk input with | None -> res == None | Some (len, sz) -> begin if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then Seq.length (serialize s x) = U32.v len /\ res == Some (x, sz + U32.v len) else res == None | _ -> res == None end ) = parse_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) input; parse_bounded_vlgen_unfold min max pk s input inline_for_extraction let synth_bounded_vlgen_payload_recip (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (x: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Tot (parse_fldata_strong_t s (U32.v sz)) = x let serialize_bounded_vlgen_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) : Tot (serializer (parse_bounded_vlgen_payload min max s sz)) = let bounds_off = k.parser_kind_low > U32.v sz || ( match k.parser_kind_high with | None -> false | Some kmax -> kmax < U32.v sz ) in if bounds_off then fail_serializer (parse_bounded_vlgen_payload_kind min max k) (refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) (fun _ -> ()) else serialize_weaken (parse_bounded_vlgen_payload_kind min max k) (serialize_synth (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () ) let serialize_bounded_vlgen_payload_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: bounded_int32 min max) (input: refine_with_tag (tag_of_bounded_vlgen_payload min max s) sz) : Lemma (serialize (serialize_bounded_vlgen_payload min max s sz) input == serialize s input) = serialize_synth_eq (parse_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload min max s sz) (serialize_fldata_strong s (U32.v sz)) (synth_bounded_vlgen_payload_recip min max s sz) () input let serialize_bounded_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) : Tot (serializer (parse_bounded_vlgen min max pk s)) = serialize_tagged_union ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) let serialize_bounded_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (input: parse_bounded_vldata_strong_t min max s) : Lemma (serialize (serialize_bounded_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_tagged_union_eq ssk (tag_of_bounded_vlgen_payload min max s) (serialize_bounded_vlgen_payload min max s) input; let tg : bounded_int32 min max = tag_of_bounded_vlgen_payload min max s input in serialize_bounded_vlgen_payload_unfold min max s tg input inline_for_extraction let synth_vlgen_recip (min: nat) (max: nat { min <= max } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k } ) (x: t) : Tot (parse_bounded_vldata_strong_t min max s) = [@inline_let] let _ = let sl = Seq.length (serialize s x) in assert (min <= sl /\ sl <= max) in x let serialize_vlgen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) : Tot (serializer (parse_vlgen min max pk s)) = serialize_synth (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) () let serialize_vlgen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (#pk: parser sk (bounded_int32 min max)) (ssk: serializer pk { sk.parser_kind_subkind == Some ParserStrong } ) (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p { parse_vlgen_precond min max k }) (input: t) : Lemma (serialize (serialize_vlgen min max ssk s) input == ( let sp = serialize s input in serialize ssk (U32.uint_to_t (Seq.length sp)) `Seq.append` sp )) = serialize_synth_eq (parse_bounded_vlgen min max pk s) (synth_vlgen min max s) (serialize_bounded_vlgen min max ssk s) (synth_vlgen_recip min max s) () input; serialize_bounded_vlgen_unfold min max ssk s input (* What if we are not sure the serializer exists? *) inline_for_extraction noextract let parse_vlgen_weak_payload_kind (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) : Tot parser_kind = strong_parser_kind min max None let parse_vlgen_weak_payload (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (p: parser k t) (bound: bounded_int32 min max) : Tot (parser (parse_vlgen_weak_payload_kind min max) t) = weaken (parse_vlgen_weak_payload_kind min max) (parse_fldata p (U32.v bound)) let parse_vlgen_weak_payload_and_then_cases_injective (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#k: parser_kind) (#t: Type) (p: parser k t) : Lemma (and_then_cases_injective (parse_vlgen_weak_payload min max p)) = and_then_cases_injective_intro (parse_vlgen_weak_payload min max p) (fun (x1 x2: bounded_int32 min max) b1 b2 -> parse_injective p (Seq.slice b1 0 (U32.v x1)) (Seq.slice b2 0 (U32.v x2)) ) inline_for_extraction noextract let parse_vlgen_weak_kind (kl: parser_kind) (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) : Tot parser_kind = and_then_kind kl (parse_vlgen_weak_payload_kind min max) let parse_vlgen_weak (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) : Tot (parser (parse_vlgen_weak_kind sk min max) t) = parse_vlgen_weak_payload_and_then_cases_injective min max p; pk `and_then` parse_vlgen_weak_payload min max p
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLData.fsti.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.VLGen.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLData", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> pk: LowParse.Spec.Base.parser sk (LowParse.Spec.BoundedInt.bounded_int32 min max) -> p: LowParse.Spec.Base.parser k t -> input: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (ensures (let res = LowParse.Spec.Base.parse (LowParse.Spec.VLGen.parse_vlgen_weak min max pk p) input in (match LowParse.Spec.Base.parse pk input with | FStar.Pervasives.Native.None #_ -> res == FStar.Pervasives.Native.None | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ len sz) -> (match FStar.Seq.Base.length input < sz + FStar.UInt32.v len with | true -> res == FStar.Pervasives.Native.None | _ -> let input' = FStar.Seq.Base.slice input sz (sz + FStar.UInt32.v len) in (match LowParse.Spec.Base.parse p input' with | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x consumed_x) -> (match consumed_x = FStar.UInt32.v len with | true -> res == FStar.Pervasives.Native.Some (x, sz + FStar.UInt32.v len) | _ -> res == FStar.Pervasives.Native.None) <: Type0 | _ -> res == FStar.Pervasives.Native.None) <: Type0) <: Type0) <: Type0))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Bytes.bytes", "LowParse.Spec.Combinators.and_then_eq", "LowParse.Spec.VLGen.parse_vlgen_weak_payload_kind", "LowParse.Spec.VLGen.parse_vlgen_weak_payload", "Prims.unit", "LowParse.Spec.VLGen.parse_vlgen_weak_payload_and_then_cases_injective", "Prims.l_True", "Prims.squash", "LowParse.Spec.Base.parse", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.Base.consumed_length", "FStar.Pervasives.Native.None", "FStar.Seq.Base.length", "LowParse.Bytes.byte", "Prims.op_Addition", "FStar.UInt32.v", "Prims.bool", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "FStar.UInt.size", "FStar.UInt32.n", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.Mktuple2", "FStar.Seq.Base.seq", "FStar.Seq.Base.slice", "LowParse.Spec.VLGen.parse_vlgen_weak", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let parse_vlgen_weak_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#sk: parser_kind) (pk: parser sk (bounded_int32 min max)) (#k: parser_kind) (#t: Type) (p: parser k t) (input: bytes) : Lemma (let res = parse (parse_vlgen_weak min max pk p) input in match parse pk input with | None -> res == None | Some (len, sz) -> if Seq.length input < sz + U32.v len then res == None else let input' = Seq.slice input sz (sz + U32.v len) in match parse p input' with | Some (x, consumed_x) -> if consumed_x = U32.v len then res == Some (x, sz + U32.v len) else res == None | _ -> res == None) =
parse_vlgen_weak_payload_and_then_cases_injective min max p; and_then_eq pk (parse_vlgen_weak_payload min max p) input
false
FStar.Int128.fsti
FStar.Int128.eq
val eq (a b: t) : Tot bool
val eq (a b: t) : Tot bool
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 114, "start_col": 0, "start_line": 114 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int128.t", "FStar.Int.eq", "FStar.Int128.n", "FStar.Int128.v", "Prims.bool" ]
[]
false
false
false
true
false
let eq (a b: t) : Tot bool =
eq #n (v a) (v b)
false
FStar.Int128.fsti
FStar.Int128.n
val n : Prims.int
let n = 128
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 18, "end_line": 20, "start_col": 7, "start_line": 20 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.int
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
true
false
let n =
128
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.k
val k : (s:seq word {length s = size_k_w_256})
val k : (s:seq word {length s = size_k_w_256})
let k = (Spec.SHA2.k0 SHA2_256)
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 31, "end_line": 31, "start_col": 0, "start_line": 31 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Seq.Base.seq Vale.SHA.PPC64LE.SHA_helpers.word {FStar.Seq.Base.length s = Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256}
Prims.Tot
[ "total" ]
[]
[ "Spec.SHA2.k0", "Spec.Hash.Definitions.SHA2_256" ]
[]
false
false
false
false
false
let k =
(Spec.SHA2.k0 SHA2_256)
false
FStar.Int128.fsti
FStar.Int128.gt
val gt (a b: t) : Tot bool
val gt (a b: t) : Tot bool
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 115, "start_col": 0, "start_line": 115 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int128.t", "FStar.Int.gt", "FStar.Int128.n", "FStar.Int128.v", "Prims.bool" ]
[]
false
false
false
true
false
let gt (a b: t) : Tot bool =
gt #n (v a) (v b)
false
FStar.Int128.fsti
FStar.Int128.gte
val gte (a b: t) : Tot bool
val gte (a b: t) : Tot bool
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 51, "end_line": 116, "start_col": 0, "start_line": 116 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int128.t", "FStar.Int.gte", "FStar.Int128.n", "FStar.Int128.v", "Prims.bool" ]
[]
false
false
false
true
false
let gte (a b: t) : Tot bool =
gte #n (v a) (v b)
false
FStar.Int128.fsti
FStar.Int128.lt
val lt (a b: t) : Tot bool
val lt (a b: t) : Tot bool
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 117, "start_col": 0, "start_line": 117 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int128.t", "FStar.Int.lt", "FStar.Int128.n", "FStar.Int128.v", "Prims.bool" ]
[]
false
false
false
true
false
let lt (a b: t) : Tot bool =
lt #n (v a) (v b)
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.lemma_add_wrap_is_add_mod
val lemma_add_wrap_is_add_mod (n0 n1: nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1)))
val lemma_add_wrap_is_add_mod (n0 n1: nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1)))
let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); ()
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 4, "end_line": 130, "start_col": 0, "start_line": 126 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; ()
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n0: Vale.Def.Words_s.nat32 -> n1: Vale.Def.Words_s.nat32 -> FStar.Pervasives.Lemma (ensures Vale.Def.Types_s.add_wrap n0 n1 == Vale.SHA.PPC64LE.SHA_helpers.vv (FStar.UInt32.add_mod (Vale.SHA.PPC64LE.SHA_helpers.to_uint32 n0 ) (Vale.SHA.PPC64LE.SHA_helpers.to_uint32 n1)))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Words_s.nat32", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "Prims.pow2", "Vale.Def.Words_s.pow2_32", "Prims.l_True", "Prims.squash", "Vale.Def.Words_s.natN", "Vale.Def.Types_s.add_wrap", "Vale.SHA.PPC64LE.SHA_helpers.vv", "FStar.UInt32.add_mod", "Vale.SHA.PPC64LE.SHA_helpers.to_uint32", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_add_wrap_is_add_mod (n0 n1: nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) =
assert_norm (pow2 32 == pow2_32); ()
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash_reveal
val make_ordered_hash_reveal : _: Prims.unit -> FStar.Pervasives.Lemma (ensures Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash == Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash_def)
let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 120, "end_line": 85, "start_col": 12, "start_line": 85 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Pervasives.Lemma (ensures Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash == Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash_def)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Opaque_s.opaque_revealer", "Vale.Def.Types_s.quad32", "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Prims.l_True", "Prims.l_and", "Prims.eq2", "Prims.int", "FStar.Seq.Base.length", "Vale.SHA.PPC64LE.SHA_helpers.word", "Spec.SHA2.op_String_Access", "Vale.SHA.PPC64LE.SHA_helpers.nat32_to_word", "Vale.Def.Words_s.__proj__Mkfour__item__lo0", "Vale.Def.Types_s.nat32", "Vale.Def.Words_s.__proj__Mkfour__item__lo1", "Vale.Def.Words_s.__proj__Mkfour__item__hi2", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash", "Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash_def" ]
[]
true
false
true
false
false
let make_ordered_hash_reveal =
opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.vv
val vv (u: Lib.IntTypes.uint32) : nat32
val vv (u: Lib.IntTypes.uint32) : nat32
let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 57, "end_line": 28, "start_col": 0, "start_line": 28 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
u8: Lib.IntTypes.uint32 -> Vale.Def.Words_s.nat32
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.uint32", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Vale.Def.Words_s.nat32" ]
[]
false
false
false
true
false
let vv (u: Lib.IntTypes.uint32) : nat32 =
Lib.IntTypes.v u
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.to_uint32
val to_uint32 (n: nat32) : Lib.IntTypes.uint32
val to_uint32 (n: nat32) : Lib.IntTypes.uint32
let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 66, "end_line": 29, "start_col": 0, "start_line": 29 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Vale.Def.Words_s.nat32 -> Lib.IntTypes.uint32
Prims.Tot
[ "total" ]
[]
[ "Vale.Def.Words_s.nat32", "Lib.IntTypes.u32", "Lib.IntTypes.uint32" ]
[]
false
false
false
true
false
let to_uint32 (n: nat32) : Lib.IntTypes.uint32 =
Lib.IntTypes.u32 n
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.sigma_0_0_partial_def
val sigma_0_0_partial_def (t:counter) (block:block_w) : nat32
val sigma_0_0_partial_def (t:counter) (block:block_w) : nat32
let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 8, "end_line": 204, "start_col": 0, "start_line": 199 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); ()
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3", "smt.arith.nl=true" ], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Vale.SHA.PPC64LE.SHA_helpers.counter -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w -> Vale.Def.Words_s.nat32
Prims.Tot
[ "total" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.counter", "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Prims.op_AmpAmp", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256", "Vale.SHA2.Wrapper.sigma256_0_0", "Vale.Def.Words_s.nat32", "Vale.SHA.PPC64LE.SHA_helpers.ws_opaque", "Prims.op_Subtraction", "Prims.bool" ]
[]
false
false
false
true
false
let sigma_0_0_partial_def (t: counter) (block: block_w) : nat32 =
if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t - 15) in sigma256_0_0 sigma0_in) else 0
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.update_multi_opaque
val update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256
val update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256
let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 49, "end_line": 49, "start_col": 0, "start_line": 48 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
hash: Vale.SHA.PPC64LE.SHA_helpers.hash256 -> blocks: Vale.SHA.PPC64LE.SHA_helpers.bytes_blocks -> Vale.SHA.PPC64LE.SHA_helpers.hash256
Prims.Tot
[ "total" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Vale.SHA.PPC64LE.SHA_helpers.bytes_blocks", "Vale.SHA.PPC64LE.SHA_helpers.update_multi_opaque_aux", "Spec.Hash.Definitions.SHA2_256" ]
[]
false
false
false
true
false
let update_multi_opaque (hash: hash256) (blocks: bytes_blocks) : hash256 =
update_multi_opaque_aux SHA2_256 hash () blocks
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.shuffle_core_opaque
val shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256
val shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256
let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 47, "end_line": 44, "start_col": 0, "start_line": 43 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t)
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
block: Vale.SHA.PPC64LE.SHA_helpers.block_w -> hash: Vale.SHA.PPC64LE.SHA_helpers.hash256 -> t: Vale.SHA.PPC64LE.SHA_helpers.counter{t < Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256} -> Vale.SHA.PPC64LE.SHA_helpers.hash256
Prims.Tot
[ "total" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Vale.SHA.PPC64LE.SHA_helpers.counter", "Prims.b2t", "Prims.op_LessThan", "Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256", "Vale.SHA.PPC64LE.SHA_helpers.shuffle_core_opaque_aux", "Spec.Hash.Definitions.SHA2_256" ]
[]
false
false
false
false
false
let shuffle_core_opaque (block: block_w) (hash: hash256) (t: counter{t < size_k_w_256}) : hash256 =
shuffle_core_opaque_aux SHA2_256 block hash t
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque
val ws_opaque (b:block_w) (t:counter{t < size_k_w_256}):nat32
val ws_opaque (b:block_w) (t:counter{t < size_k_w_256}):nat32
let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t)
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 33, "end_line": 40, "start_col": 0, "start_line": 39 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = ()
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Vale.SHA.PPC64LE.SHA_helpers.block_w -> t: Vale.SHA.PPC64LE.SHA_helpers.counter{t < Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256} -> Vale.Def.Words_s.nat32
Prims.Tot
[ "total" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Vale.SHA.PPC64LE.SHA_helpers.counter", "Prims.b2t", "Prims.op_LessThan", "Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256", "Vale.SHA.PPC64LE.SHA_helpers.vv", "Vale.SHA.PPC64LE.SHA_helpers.ws_opaque_aux", "Spec.Hash.Definitions.SHA2_256", "Vale.Def.Words_s.nat32" ]
[]
false
false
false
false
false
let ws_opaque (b: block_w) (t: counter{t < size_k_w_256}) : nat32 =
vv (ws_opaque_aux SHA2_256 b t)
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.update_block
val update_block (hash:hash256) (block:block_w): hash256
val update_block (hash:hash256) (block:block_w): hash256
let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 40, "end_line": 137, "start_col": 0, "start_line": 134 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
hash: Vale.SHA.PPC64LE.SHA_helpers.hash256 -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w -> Vale.SHA.PPC64LE.SHA_helpers.hash256
Prims.Tot
[ "total" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Spec.Loops.seq_map2", "Vale.SHA.PPC64LE.SHA_helpers.word", "Spec.Hash.Definitions.word", "Spec.Hash.Definitions.SHA2_256", "Lib.IntTypes.op_Plus_Dot", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Spec.Hash.Definitions.words_state", "Vale.SHA.PPC64LE.SHA_helpers.shuffle_opaque" ]
[]
false
false
false
true
false
let update_block (hash: hash256) (block: block_w) : Tot (hash256) =
let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.lemma_sha256_sigma3
val lemma_sha256_sigma3 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w_256 /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[4])) (ensures (sigma256_1_1 src.hi3 == sigma_1_1_partial t block hash_orig))
val lemma_sha256_sigma3 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w_256 /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[4])) (ensures (sigma256_1_1 src.hi3 == sigma_1_1_partial t block hash_orig))
let lemma_sha256_sigma3 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[4])) (ensures (sigma256_1_1 src.hi3 == sigma_1_1_partial t block hash_orig)) = sigma_1_1_partial_reveal (); ()
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 4, "end_line": 264, "start_col": 0, "start_line": 258 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma0_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[0]) in sigma256_1_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma2 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig)) = sigma_1_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_1_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma1_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[4]) in sigma256_1_1 sigma1_in) else 0
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
src: Vale.Def.Types_s.quad32 -> t: Vale.SHA.PPC64LE.SHA_helpers.counter -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w -> hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 -> FStar.Pervasives.Lemma (requires t < Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256 /\ Mkfour?.hi3 src == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale t block hash_orig).[ 4 ]) (ensures Vale.SHA2.Wrapper.sigma256_1_1 (Mkfour?.hi3 src) == Vale.SHA.PPC64LE.SHA_helpers.sigma_1_1_partial t block hash_orig)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Types_s.quad32", "Vale.SHA.PPC64LE.SHA_helpers.counter", "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Prims.unit", "Vale.SHA.PPC64LE.SHA_helpers.sigma_1_1_partial_reveal", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Spec.SHA2.size_k_w", "Spec.Hash.Definitions.SHA2_256", "Prims.eq2", "Vale.Def.Words_s.nat32", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Vale.Def.Types_s.nat32", "Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32", "Spec.SHA2.op_String_Access", "Vale.SHA.PPC64LE.SHA_helpers.word", "Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale", "Prims.squash", "Vale.SHA2.Wrapper.sigma256_1_1", "Vale.SHA.PPC64LE.SHA_helpers.sigma_1_1_partial", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_sha256_sigma3 (src: quad32) (t: counter) (block: block_w) (hash_orig: hash256) : Lemma (requires t < size_k_w (SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[ 4 ])) (ensures (sigma256_1_1 src.hi3 == sigma_1_1_partial t block hash_orig)) =
sigma_1_1_partial_reveal (); ()
false
FStar.Int128.fsti
FStar.Int128.op_Plus_Hat
val op_Plus_Hat : a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.Pure FStar.Int128.t
let op_Plus_Hat = add
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 28, "end_line": 121, "start_col": 7, "start_line": 121 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.Pure FStar.Int128.t
Prims.Pure
[]
[]
[ "FStar.Int128.add" ]
[]
false
false
false
false
false
let op_Plus_Hat =
add
false
FStar.Int128.fsti
FStar.Int128.op_Subtraction_Hat
val op_Subtraction_Hat : a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.Pure FStar.Int128.t
let op_Subtraction_Hat = sub
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 35, "end_line": 122, "start_col": 7, "start_line": 122 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.Pure FStar.Int128.t
Prims.Pure
[]
[]
[ "FStar.Int128.sub" ]
[]
false
false
false
false
false
let op_Subtraction_Hat =
sub
false
FStar.Int128.fsti
FStar.Int128.lte
val lte (a b: t) : Tot bool
val lte (a b: t) : Tot bool
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 51, "end_line": 118, "start_col": 0, "start_line": 118 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int128.t", "FStar.Int.lte", "FStar.Int128.n", "FStar.Int128.v", "Prims.bool" ]
[]
false
false
false
true
false
let lte (a b: t) : Tot bool =
lte #n (v a) (v b)
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.sigma_1_0_partial_def
val sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32
val sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32
let sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma0_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[0]) in sigma256_1_0 sigma0_in) else 0
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 8, "end_line": 238, "start_col": 0, "start_line": 233 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0"
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Vale.SHA.PPC64LE.SHA_helpers.counter -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w -> hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 -> Vale.Def.Words_s.nat32
Prims.Tot
[ "total" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.counter", "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Prims.op_LessThan", "Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256", "Vale.SHA2.Wrapper.sigma256_1_0", "Vale.Def.Words_s.nat32", "Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32", "Spec.SHA2.op_String_Access", "Vale.SHA.PPC64LE.SHA_helpers.word", "Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale", "Prims.bool" ]
[]
false
false
false
true
false
let sigma_1_0_partial_def (t: counter) (block: block_w) (hash_orig: hash256) : nat32 =
if t < size_k_w_256 then (let sigma0_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[ 0 ]) in sigma256_1_0 sigma0_in) else 0
false
FStar.Int128.fsti
FStar.Int128.op_Star_Hat
val op_Star_Hat : a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.Pure FStar.Int128.t
let op_Star_Hat = mul
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 28, "end_line": 123, "start_col": 7, "start_line": 123 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.Pure FStar.Int128.t
Prims.Pure
[]
[]
[ "FStar.Int128.mul" ]
[]
false
false
false
false
false
let op_Star_Hat =
mul
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.update_multi_transparent
val update_multi_transparent (hash:hash256) (blocks:bytes_blocks):hash256
val update_multi_transparent (hash:hash256) (blocks:bytes_blocks):hash256
let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 38, "end_line": 52, "start_col": 0, "start_line": 51 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
hash: Vale.SHA.PPC64LE.SHA_helpers.hash256 -> blocks: Vale.SHA.PPC64LE.SHA_helpers.bytes_blocks -> Vale.SHA.PPC64LE.SHA_helpers.hash256
Prims.Tot
[ "total" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Vale.SHA.PPC64LE.SHA_helpers.bytes_blocks", "Spec.Agile.Hash.update_multi", "Spec.Hash.Definitions.SHA2_256" ]
[]
false
false
false
true
false
let update_multi_transparent (hash: hash256) (blocks: bytes_blocks) =
update_multi SHA2_256 hash () blocks
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.lemma_sha256_sigma2
val lemma_sha256_sigma2 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w_256 /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig))
val lemma_sha256_sigma2 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w_256 /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig))
let lemma_sha256_sigma2 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig)) = sigma_1_0_partial_reveal (); ()
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 4, "end_line": 247, "start_col": 0, "start_line": 241 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma0_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[0]) in sigma256_1_0 sigma0_in) else 0
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
src: Vale.Def.Types_s.quad32 -> t: Vale.SHA.PPC64LE.SHA_helpers.counter -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w -> hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 -> FStar.Pervasives.Lemma (requires t < Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256 /\ Mkfour?.hi3 src == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale t block hash_orig).[ 0 ]) (ensures Vale.SHA2.Wrapper.sigma256_1_0 (Mkfour?.hi3 src) == Vale.SHA.PPC64LE.SHA_helpers.sigma_1_0_partial t block hash_orig)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Types_s.quad32", "Vale.SHA.PPC64LE.SHA_helpers.counter", "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Prims.unit", "Vale.SHA.PPC64LE.SHA_helpers.sigma_1_0_partial_reveal", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Spec.SHA2.size_k_w", "Spec.Hash.Definitions.SHA2_256", "Prims.eq2", "Vale.Def.Words_s.nat32", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Vale.Def.Types_s.nat32", "Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32", "Spec.SHA2.op_String_Access", "Vale.SHA.PPC64LE.SHA_helpers.word", "Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale", "Prims.squash", "Vale.SHA2.Wrapper.sigma256_1_0", "Vale.SHA.PPC64LE.SHA_helpers.sigma_1_0_partial", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_sha256_sigma2 (src: quad32) (t: counter) (block: block_w) (hash_orig: hash256) : Lemma (requires t < size_k_w (SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[ 0 ])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig)) =
sigma_1_0_partial_reveal (); ()
false
FStar.Int128.fsti
FStar.Int128.op_Percent_Hat
val op_Percent_Hat : a: FStar.Int128.t -> b: FStar.Int128.t{FStar.Int128.v b <> 0} -> Prims.Pure FStar.Int128.t
let op_Percent_Hat = rem
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 31, "end_line": 125, "start_col": 7, "start_line": 125 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t{FStar.Int128.v b <> 0} -> Prims.Pure FStar.Int128.t
Prims.Pure
[]
[]
[ "FStar.Int128.rem" ]
[]
false
false
false
false
false
let op_Percent_Hat =
rem
false
FStar.Int128.fsti
FStar.Int128.op_Slash_Hat
val op_Slash_Hat : a: FStar.Int128.t -> b: FStar.Int128.t{FStar.Int128.v b <> 0} -> Prims.Pure FStar.Int128.t
let op_Slash_Hat = div
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 29, "end_line": 124, "start_col": 7, "start_line": 124 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t{FStar.Int128.v b <> 0} -> Prims.Pure FStar.Int128.t
Prims.Pure
[]
[]
[ "FStar.Int128.div" ]
[]
false
false
false
false
false
let op_Slash_Hat =
div
false
FStar.Int128.fsti
FStar.Int128.op_Amp_Hat
val op_Amp_Hat : x: FStar.Int128.t -> y: FStar.Int128.t -> Prims.Pure FStar.Int128.t
let op_Amp_Hat = logand
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 127, "start_col": 7, "start_line": 127 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.Int128.t -> y: FStar.Int128.t -> Prims.Pure FStar.Int128.t
Prims.Pure
[]
[]
[ "FStar.Int128.logand" ]
[]
false
false
false
false
false
let op_Amp_Hat =
logand
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash_def
val make_ordered_hash_def (abcd efgh: quad32) : (hash: words_state SHA2_256 { length hash == 8 /\ hash.[ 0 ] == to_uint32 abcd.lo0 /\ hash.[ 1 ] == to_uint32 abcd.lo1 /\ hash.[ 2 ] == to_uint32 abcd.hi2 /\ hash.[ 3 ] == to_uint32 abcd.hi3 /\ hash.[ 4 ] == to_uint32 efgh.lo0 /\ hash.[ 5 ] == to_uint32 efgh.lo1 /\ hash.[ 6 ] == to_uint32 efgh.hi2 /\ hash.[ 7 ] == to_uint32 efgh.hi3 })
val make_ordered_hash_def (abcd efgh: quad32) : (hash: words_state SHA2_256 { length hash == 8 /\ hash.[ 0 ] == to_uint32 abcd.lo0 /\ hash.[ 1 ] == to_uint32 abcd.lo1 /\ hash.[ 2 ] == to_uint32 abcd.hi2 /\ hash.[ 3 ] == to_uint32 abcd.hi3 /\ hash.[ 4 ] == to_uint32 efgh.lo0 /\ hash.[ 5 ] == to_uint32 efgh.lo1 /\ hash.[ 6 ] == to_uint32 efgh.hi2 /\ hash.[ 7 ] == to_uint32 efgh.hi3 })
let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 8, "end_line": 83, "start_col": 0, "start_line": 57 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Vale.Def.Types_s.quad32 -> efgh: Vale.Def.Types_s.quad32 -> hash: Spec.Hash.Definitions.words_state Spec.Hash.Definitions.SHA2_256 { FStar.Seq.Base.length hash == 8 /\ hash.[ 0 ] == Vale.SHA.PPC64LE.SHA_helpers.to_uint32 (Mkfour?.lo0 abcd) /\ hash.[ 1 ] == Vale.SHA.PPC64LE.SHA_helpers.to_uint32 (Mkfour?.lo1 abcd) /\ hash.[ 2 ] == Vale.SHA.PPC64LE.SHA_helpers.to_uint32 (Mkfour?.hi2 abcd) /\ hash.[ 3 ] == Vale.SHA.PPC64LE.SHA_helpers.to_uint32 (Mkfour?.hi3 abcd) /\ hash.[ 4 ] == Vale.SHA.PPC64LE.SHA_helpers.to_uint32 (Mkfour?.lo0 efgh) /\ hash.[ 5 ] == Vale.SHA.PPC64LE.SHA_helpers.to_uint32 (Mkfour?.lo1 efgh) /\ hash.[ 6 ] == Vale.SHA.PPC64LE.SHA_helpers.to_uint32 (Mkfour?.hi2 efgh) /\ hash.[ 7 ] == Vale.SHA.PPC64LE.SHA_helpers.to_uint32 (Mkfour?.hi3 efgh) }
Prims.Tot
[ "total" ]
[]
[ "Vale.Def.Types_s.quad32", "Prims.unit", "FStar.Seq.Properties.elim_of_list", "Spec.Hash.Definitions.word", "Spec.Hash.Definitions.SHA2_256", "Prims._assert", "Prims.eq2", "Prims.int", "FStar.Seq.Base.length", "FStar.Seq.Base.seq", "Prims.nat", "FStar.List.Tot.Base.length", "FStar.Seq.Base.seq_of_list", "FStar.Pervasives.assert_norm", "Prims.list", "Prims.Cons", "Prims.Nil", "Lib.IntTypes.int_t", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Vale.SHA.PPC64LE.SHA_helpers.to_uint32", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Vale.Def.Types_s.nat32", "Vale.Def.Words_s.__proj__Mkfour__item__hi2", "Vale.Def.Words_s.__proj__Mkfour__item__lo1", "Vale.Def.Words_s.__proj__Mkfour__item__lo0", "Spec.Hash.Definitions.words_state", "Prims.l_and", "FStar.UInt32.t", "Spec.SHA2.op_String_Access" ]
[]
false
false
false
false
false
let make_ordered_hash_def (abcd efgh: quad32) : (hash: words_state SHA2_256 { length hash == 8 /\ hash.[ 0 ] == to_uint32 abcd.lo0 /\ hash.[ 1 ] == to_uint32 abcd.lo1 /\ hash.[ 2 ] == to_uint32 abcd.hi2 /\ hash.[ 3 ] == to_uint32 abcd.hi3 /\ hash.[ 4 ] == to_uint32 efgh.lo0 /\ hash.[ 5 ] == to_uint32 efgh.lo1 /\ hash.[ 6 ] == to_uint32 efgh.hi2 /\ hash.[ 7 ] == to_uint32 efgh.hi3 }) =
let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash
false
FStar.Int128.fsti
FStar.Int128.op_Hat_Hat
val op_Hat_Hat : x: FStar.Int128.t -> y: FStar.Int128.t -> Prims.Pure FStar.Int128.t
let op_Hat_Hat = logxor
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 126, "start_col": 7, "start_line": 126 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.Int128.t -> y: FStar.Int128.t -> Prims.Pure FStar.Int128.t
Prims.Pure
[]
[]
[ "FStar.Int128.logxor" ]
[]
false
false
false
false
false
let op_Hat_Hat =
logxor
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.sigma_1_1_partial_def
val sigma_1_1_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32
val sigma_1_1_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32
let sigma_1_1_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma1_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[4]) in sigma256_1_1 sigma1_in) else 0
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 8, "end_line": 255, "start_col": 0, "start_line": 250 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma0_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[0]) in sigma256_1_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma2 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig)) = sigma_1_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0"
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Vale.SHA.PPC64LE.SHA_helpers.counter -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w -> hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 -> Vale.Def.Words_s.nat32
Prims.Tot
[ "total" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.counter", "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Prims.op_LessThan", "Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256", "Vale.SHA2.Wrapper.sigma256_1_1", "Vale.Def.Words_s.nat32", "Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32", "Spec.SHA2.op_String_Access", "Vale.SHA.PPC64LE.SHA_helpers.word", "Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale", "Prims.bool" ]
[]
false
false
false
true
false
let sigma_1_1_partial_def (t: counter) (block: block_w) (hash_orig: hash256) : nat32 =
if t < size_k_w_256 then (let sigma1_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[ 4 ]) in sigma256_1_1 sigma1_in) else 0
false
FStar.Int128.fsti
FStar.Int128.op_Less_Less_Hat
val op_Less_Less_Hat : a: FStar.Int128.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int128.t
let op_Less_Less_Hat = shift_left
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 40, "end_line": 129, "start_col": 7, "start_line": 129 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int128.t
Prims.Pure
[]
[]
[ "FStar.Int128.shift_left" ]
[]
false
false
false
false
false
let op_Less_Less_Hat =
shift_left
false
FStar.Int128.fsti
FStar.Int128.op_Bar_Hat
val op_Bar_Hat : x: FStar.Int128.t -> y: FStar.Int128.t -> Prims.Pure FStar.Int128.t
let op_Bar_Hat = logor
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 29, "end_line": 128, "start_col": 7, "start_line": 128 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.Int128.t -> y: FStar.Int128.t -> Prims.Pure FStar.Int128.t
Prims.Pure
[]
[]
[ "FStar.Int128.logor" ]
[]
false
false
false
false
false
let op_Bar_Hat =
logor
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.sigma_0_1_partial_def
val sigma_0_1_partial_def (t:counter) (block:block_w) : nat32
val sigma_0_1_partial_def (t:counter) (block:block_w) : nat32
let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 8, "end_line": 221, "start_col": 0, "start_line": 216 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0"
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Vale.SHA.PPC64LE.SHA_helpers.counter -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w -> Vale.Def.Words_s.nat32
Prims.Tot
[ "total" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.counter", "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Prims.op_AmpAmp", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256", "Vale.SHA2.Wrapper.sigma256_0_1", "Vale.Def.Words_s.nat32", "Vale.SHA.PPC64LE.SHA_helpers.ws_opaque", "Prims.op_Subtraction", "Prims.bool" ]
[]
false
false
false
true
false
let sigma_0_1_partial_def (t: counter) (block: block_w) : nat32 =
if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t - 2) in sigma256_0_1 sigma1_in) else 0
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash
val make_ordered_hash (abcd efgh:quad32): Pure (hash256) (requires True) (ensures fun hash -> length hash == 8 /\ hash.[0] == nat32_to_word abcd.lo0 /\ hash.[1] == nat32_to_word abcd.lo1 /\ hash.[2] == nat32_to_word abcd.hi2 /\ hash.[3] == nat32_to_word abcd.hi3 /\ hash.[4] == nat32_to_word efgh.lo0 /\ hash.[5] == nat32_to_word efgh.lo1 /\ hash.[6] == nat32_to_word efgh.hi2 /\ hash.[7] == nat32_to_word efgh.hi3 )
val make_ordered_hash (abcd efgh:quad32): Pure (hash256) (requires True) (ensures fun hash -> length hash == 8 /\ hash.[0] == nat32_to_word abcd.lo0 /\ hash.[1] == nat32_to_word abcd.lo1 /\ hash.[2] == nat32_to_word abcd.hi2 /\ hash.[3] == nat32_to_word abcd.hi3 /\ hash.[4] == nat32_to_word efgh.lo0 /\ hash.[5] == nat32_to_word efgh.lo1 /\ hash.[6] == nat32_to_word efgh.hi2 /\ hash.[7] == nat32_to_word efgh.hi3 )
let make_ordered_hash = opaque_make make_ordered_hash_def
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 76, "end_line": 84, "start_col": 19, "start_line": 84 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l;
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Vale.Def.Types_s.quad32 -> efgh: Vale.Def.Types_s.quad32 -> Prims.Pure Vale.SHA.PPC64LE.SHA_helpers.hash256
Prims.Pure
[]
[]
[ "Vale.Def.Opaque_s.opaque_make", "Vale.Def.Types_s.quad32", "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Prims.l_True", "Prims.l_and", "Prims.eq2", "Prims.int", "FStar.Seq.Base.length", "Vale.SHA.PPC64LE.SHA_helpers.word", "Spec.SHA2.op_String_Access", "Vale.SHA.PPC64LE.SHA_helpers.nat32_to_word", "Vale.Def.Words_s.__proj__Mkfour__item__lo0", "Vale.Def.Types_s.nat32", "Vale.Def.Words_s.__proj__Mkfour__item__lo1", "Vale.Def.Words_s.__proj__Mkfour__item__hi2", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash_def" ]
[]
false
false
false
false
false
let make_ordered_hash =
opaque_make make_ordered_hash_def
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.lemma_sha256_sigma0
val lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w_256 /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block))
val lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w_256 /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block))
let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); ()
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 4, "end_line": 213, "start_col": 0, "start_line": 207 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
src: Vale.Def.Types_s.quad32 -> t: Vale.SHA.PPC64LE.SHA_helpers.counter -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w -> FStar.Pervasives.Lemma (requires 16 <= t /\ t < Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256 /\ Mkfour?.hi3 src == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (t - 15)) (ensures Vale.SHA2.Wrapper.sigma256_0_0 (Mkfour?.hi3 src) == Vale.SHA.PPC64LE.SHA_helpers.sigma_0_0_partial t block)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Types_s.quad32", "Vale.SHA.PPC64LE.SHA_helpers.counter", "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Prims.unit", "Vale.SHA.PPC64LE.SHA_helpers.sigma_0_0_partial_reveal", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Spec.SHA2.size_k_w", "Spec.Hash.Definitions.SHA2_256", "Prims.eq2", "Vale.Def.Words_s.nat32", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Vale.Def.Types_s.nat32", "Vale.SHA.PPC64LE.SHA_helpers.ws_opaque", "Prims.op_Subtraction", "Prims.squash", "Vale.SHA2.Wrapper.sigma256_0_0", "Vale.SHA.PPC64LE.SHA_helpers.sigma_0_0_partial", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_sha256_sigma0 (src: quad32) (t: counter) (block: block_w) : Lemma (requires 16 <= t /\ t < size_k_w (SHA2_256) /\ src.hi3 == ws_opaque block (t - 15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) =
sigma_0_0_partial_reveal (); ()
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.update_multi_one
val update_multi_one (h: hash256) (b: bytes_blocks{length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b))
val update_multi_one (h: hash256) (b: bytes_blocks{length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b))
let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 151, "start_col": 0, "start_line": 149 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: Vale.SHA.PPC64LE.SHA_helpers.hash256 -> b: Vale.SHA.PPC64LE.SHA_helpers.bytes_blocks {FStar.Seq.Base.length b = Vale.SHA.PPC64LE.SHA_helpers.block_length} -> FStar.Pervasives.Lemma (ensures Spec.Agile.Hash.update_multi Spec.Hash.Definitions.SHA2_256 h () b == Spec.Agile.Hash.update Spec.Hash.Definitions.SHA2_256 h b)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Vale.SHA.PPC64LE.SHA_helpers.bytes_blocks", "Prims.b2t", "Prims.op_Equality", "Prims.int", "FStar.Seq.Base.length", "Vale.SHA.PPC64LE.SHA_helpers.byte", "Vale.SHA.PPC64LE.SHA_helpers.block_length", "Spec.Hash.Lemmas.update_multi_update", "Spec.Hash.Definitions.SHA2_256", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "Spec.Hash.Definitions.words_state", "Spec.Agile.Hash.update_multi", "Spec.Agile.Hash.update", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let update_multi_one (h: hash256) (b: bytes_blocks{length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) =
update_multi_update SHA2_256 h b
false
FStar.Int128.fsti
FStar.Int128.op_Greater_Greater_Greater_Hat
val op_Greater_Greater_Greater_Hat : a: FStar.Int128.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int128.t
let op_Greater_Greater_Greater_Hat = shift_arithmetic_right
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 66, "end_line": 131, "start_col": 7, "start_line": 131 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int128.t
Prims.Pure
[]
[]
[ "FStar.Int128.shift_arithmetic_right" ]
[]
false
false
false
false
false
let op_Greater_Greater_Greater_Hat =
shift_arithmetic_right
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.lemma_update_multi_opaque_vale_is_update_multi
val lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks)
val lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks)
let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); ()
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 4, "end_line": 197, "start_col": 0, "start_line": 192 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = ()
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3", "smt.arith.nl=true" ], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
hash: Vale.SHA.PPC64LE.SHA_helpers.hash256 -> blocks: Vale.SHA.PPC64LE.SHA_helpers.bytes -> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length blocks % 64 = 0) (ensures Vale.SHA.PPC64LE.SHA_helpers.update_multi_opaque_vale hash blocks == Vale.SHA.PPC64LE.SHA_helpers.update_multi_transparent hash blocks)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Vale.SHA.PPC64LE.SHA_helpers.bytes", "Prims.unit", "Vale.SHA.PPC64LE.SHA_helpers.update_multi_reveal", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.op_Modulus", "FStar.Seq.Base.length", "Vale.SHA.PPC64LE.SHA_helpers.byte", "Prims.squash", "Prims.eq2", "Vale.SHA.PPC64LE.SHA_helpers.update_multi_opaque_vale", "Vale.SHA.PPC64LE.SHA_helpers.update_multi_transparent", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_update_multi_opaque_vale_is_update_multi (hash: hash256) (blocks: bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) =
update_multi_reveal (); ()
false
FStar.Int128.fsti
FStar.Int128.op_Greater_Greater_Hat
val op_Greater_Greater_Hat : a: FStar.Int128.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int128.t
let op_Greater_Greater_Hat = shift_right
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 47, "end_line": 130, "start_col": 7, "start_line": 130 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int128.t
Prims.Pure
[]
[]
[ "FStar.Int128.shift_right" ]
[]
false
false
false
false
false
let op_Greater_Greater_Hat =
shift_right
false
FStar.Int128.fsti
FStar.Int128.op_Equals_Hat
val op_Equals_Hat : a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
let op_Equals_Hat = eq
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 29, "end_line": 132, "start_col": 7, "start_line": 132 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left unfold let op_Greater_Greater_Hat = shift_right
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int128.eq" ]
[]
false
false
false
true
false
let op_Equals_Hat =
eq
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_reveal
val make_seperated_hash_reveal : _: Prims.unit -> FStar.Pervasives.Lemma (ensures Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash == Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_def)
let make_seperated_hash_reveal = opaque_revealer (`%make_seperated_hash) make_seperated_hash make_seperated_hash_def
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 128, "end_line": 295, "start_col": 12, "start_line": 295 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma0_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[0]) in sigma256_1_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma2 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig)) = sigma_1_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_1_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma1_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[4]) in sigma256_1_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma3 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[4])) (ensures (sigma256_1_1 src.hi3 == sigma_1_1_partial t block hash_orig)) = sigma_1_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let make_seperated_hash_def (a b c d e f g h:nat32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a /\ hash.[1] == to_uint32 b /\ hash.[2] == to_uint32 c /\ hash.[3] == to_uint32 d /\ hash.[4] == to_uint32 e /\ hash.[5] == to_uint32 f /\ hash.[6] == to_uint32 g /\ hash.[7] == to_uint32 h }) = let a = to_uint32 a in let b = to_uint32 b in let c = to_uint32 c in let d = to_uint32 d in let e = to_uint32 e in let f = to_uint32 f in let g = to_uint32 g in let h = to_uint32 h in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Pervasives.Lemma (ensures Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash == Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_def)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Opaque_s.opaque_revealer", "Vale.Def.Words_s.nat32", "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Prims.l_True", "Prims.l_and", "Prims.eq2", "Prims.int", "FStar.Seq.Base.length", "Vale.SHA.PPC64LE.SHA_helpers.word", "Spec.SHA2.op_String_Access", "Vale.SHA.PPC64LE.SHA_helpers.nat32_to_word", "Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash", "Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_def" ]
[]
true
false
true
false
false
let make_seperated_hash_reveal =
opaque_revealer (`%make_seperated_hash) make_seperated_hash make_seperated_hash_def
false
FStar.Int128.fsti
FStar.Int128.op_Greater_Hat
val op_Greater_Hat : a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
let op_Greater_Hat = gt
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 133, "start_col": 7, "start_line": 133 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left unfold let op_Greater_Greater_Hat = shift_right unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int128.gt" ]
[]
false
false
false
true
false
let op_Greater_Hat =
gt
false
FStar.Int128.fsti
FStar.Int128.op_Greater_Equals_Hat
val op_Greater_Equals_Hat : a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
let op_Greater_Equals_Hat = gte
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 38, "end_line": 134, "start_col": 7, "start_line": 134 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left unfold let op_Greater_Greater_Hat = shift_right unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right unfold let op_Equals_Hat = eq
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int128.gte" ]
[]
false
false
false
true
false
let op_Greater_Equals_Hat =
gte
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.maj_256
val maj_256 (x y z:nat32):Pure(nat32) (requires True) (ensures fun a -> a == (iand32 x y) *^ ((iand32 x z) *^ (iand32 y z)))
val maj_256 (x y z:nat32):Pure(nat32) (requires True) (ensures fun a -> a == (iand32 x y) *^ ((iand32 x z) *^ (iand32 y z)))
let maj_256 = opaque_make maj_256_def
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 56, "end_line": 372, "start_col": 19, "start_line": 372 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma0_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[0]) in sigma256_1_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma2 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig)) = sigma_1_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_1_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma1_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[4]) in sigma256_1_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma3 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[4])) (ensures (sigma256_1_1 src.hi3 == sigma_1_1_partial t block hash_orig)) = sigma_1_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let make_seperated_hash_def (a b c d e f g h:nat32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a /\ hash.[1] == to_uint32 b /\ hash.[2] == to_uint32 c /\ hash.[3] == to_uint32 d /\ hash.[4] == to_uint32 e /\ hash.[5] == to_uint32 f /\ hash.[6] == to_uint32 g /\ hash.[7] == to_uint32 h }) = let a = to_uint32 a in let b = to_uint32 b in let c = to_uint32 c in let d = to_uint32 d in let e = to_uint32 e in let f = to_uint32 f in let g = to_uint32 g in let h = to_uint32 h in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_seperated_hash = opaque_make make_seperated_hash_def irreducible let make_seperated_hash_reveal = opaque_revealer (`%make_seperated_hash) make_seperated_hash make_seperated_hash_def let make_seperated_hash_quad32_def (a b c d e f g h:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a.hi3 /\ hash.[1] == to_uint32 b.hi3 /\ hash.[2] == to_uint32 c.hi3 /\ hash.[3] == to_uint32 d.hi3 /\ hash.[4] == to_uint32 e.hi3 /\ hash.[5] == to_uint32 f.hi3 /\ hash.[6] == to_uint32 g.hi3 /\ hash.[7] == to_uint32 h.hi3 }) = let a = to_uint32 a.hi3 in let b = to_uint32 b.hi3 in let c = to_uint32 c.hi3 in let d = to_uint32 d.hi3 in let e = to_uint32 e.hi3 in let f = to_uint32 f.hi3 in let g = to_uint32 g.hi3 in let h = to_uint32 h.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_seperated_hash_quad32 = opaque_make make_seperated_hash_quad32_def irreducible let make_seperated_hash_quad32_reveal = opaque_revealer (`%make_seperated_hash_quad32) make_seperated_hash_quad32 make_seperated_hash_quad32_def let lemma_make_seperated_hash (hash:hash256) (a b c d e f g h:quad32) : Lemma (requires length hash == 8 /\ a.hi3 == word_to_nat32 hash.[0] /\ b.hi3 == word_to_nat32 hash.[1] /\ c.hi3 == word_to_nat32 hash.[2] /\ d.hi3 == word_to_nat32 hash.[3] /\ e.hi3 == word_to_nat32 hash.[4] /\ f.hi3 == word_to_nat32 hash.[5] /\ g.hi3 == word_to_nat32 hash.[6] /\ h.hi3 == word_to_nat32 hash.[7]) (ensures hash == make_seperated_hash_quad32 a b c d e f g h) = assert (equal hash (make_seperated_hash_quad32 a b c d e f g h)) let lemma_vsel32 (a b c:nat32) : Lemma (ensures (isel32 a b c = (iand32 c a) *^ (iand32 (inot32 c) b))) = reveal_iand_all 32; reveal_inot_all 32; reveal_ixor_all 32; lemma_equal_nth 32 (isel32 a b c) ((iand32 c a) *^ (iand32 (inot32 c) b)) let ch_256_def (x y z:nat32) : (a:nat32 {a == (iand32 x y) *^ (iand32 (inot32 x) z)}) = reveal_iand_all 32; reveal_inot_all 32; reveal_ixor_all 32; ch256 x y z [@"opaque_to_smt"] let ch_256 = opaque_make ch_256_def irreducible let ch_256_reveal = opaque_revealer (`%ch_256) ch_256 ch_256_def let lemma_eq_maj_xvsel32 (a b c:nat32) : Lemma (ensures (isel32 c b (a *^ b) = (iand32 a b) *^ ((iand32 a c) *^ (iand32 b c)))) = reveal_iand_all 32; reveal_ixor_all 32; lemma_equal_nth 32 (isel32 c b (a *^ b)) ((iand32 a b) *^ ((iand32 a c) *^ (iand32 b c))) let maj_256_def (x y z:nat32) : (a:nat32 {a == (iand32 x y) *^ ((iand32 x z) *^ (iand32 y z))}) = reveal_iand_all 32; reveal_ixor_all 32;
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Vale.Def.Words_s.nat32 -> y: Vale.Def.Words_s.nat32 -> z: Vale.Def.Words_s.nat32 -> Prims.Pure Vale.Def.Words_s.nat32
Prims.Pure
[]
[]
[ "Vale.Def.Opaque_s.opaque_make", "Vale.Def.Words_s.nat32", "Prims.l_True", "Prims.eq2", "Vale.Arch.Types.op_Star_Hat", "Vale.Arch.Types.iand32", "Vale.SHA.PPC64LE.SHA_helpers.maj_256_def" ]
[]
false
false
false
false
false
let maj_256 =
opaque_make maj_256_def
false
FStar.Int128.fsti
FStar.Int128.op_Less_Hat
val op_Less_Hat : a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
let op_Less_Hat = lt
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 27, "end_line": 135, "start_col": 7, "start_line": 135 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left unfold let op_Greater_Greater_Hat = shift_right unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right unfold let op_Equals_Hat = eq unfold let op_Greater_Hat = gt
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int128.lt" ]
[]
false
false
false
true
false
let op_Less_Hat =
lt
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.maj_256_reveal
val maj_256_reveal : _: Prims.unit -> FStar.Pervasives.Lemma (ensures Vale.SHA.PPC64LE.SHA_helpers.maj_256 == Vale.SHA.PPC64LE.SHA_helpers.maj_256_def)
let maj_256_reveal = opaque_revealer (`%maj_256) maj_256 maj_256_def
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 80, "end_line": 373, "start_col": 12, "start_line": 373 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma0_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[0]) in sigma256_1_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma2 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig)) = sigma_1_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_1_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma1_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[4]) in sigma256_1_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma3 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[4])) (ensures (sigma256_1_1 src.hi3 == sigma_1_1_partial t block hash_orig)) = sigma_1_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let make_seperated_hash_def (a b c d e f g h:nat32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a /\ hash.[1] == to_uint32 b /\ hash.[2] == to_uint32 c /\ hash.[3] == to_uint32 d /\ hash.[4] == to_uint32 e /\ hash.[5] == to_uint32 f /\ hash.[6] == to_uint32 g /\ hash.[7] == to_uint32 h }) = let a = to_uint32 a in let b = to_uint32 b in let c = to_uint32 c in let d = to_uint32 d in let e = to_uint32 e in let f = to_uint32 f in let g = to_uint32 g in let h = to_uint32 h in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_seperated_hash = opaque_make make_seperated_hash_def irreducible let make_seperated_hash_reveal = opaque_revealer (`%make_seperated_hash) make_seperated_hash make_seperated_hash_def let make_seperated_hash_quad32_def (a b c d e f g h:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a.hi3 /\ hash.[1] == to_uint32 b.hi3 /\ hash.[2] == to_uint32 c.hi3 /\ hash.[3] == to_uint32 d.hi3 /\ hash.[4] == to_uint32 e.hi3 /\ hash.[5] == to_uint32 f.hi3 /\ hash.[6] == to_uint32 g.hi3 /\ hash.[7] == to_uint32 h.hi3 }) = let a = to_uint32 a.hi3 in let b = to_uint32 b.hi3 in let c = to_uint32 c.hi3 in let d = to_uint32 d.hi3 in let e = to_uint32 e.hi3 in let f = to_uint32 f.hi3 in let g = to_uint32 g.hi3 in let h = to_uint32 h.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_seperated_hash_quad32 = opaque_make make_seperated_hash_quad32_def irreducible let make_seperated_hash_quad32_reveal = opaque_revealer (`%make_seperated_hash_quad32) make_seperated_hash_quad32 make_seperated_hash_quad32_def let lemma_make_seperated_hash (hash:hash256) (a b c d e f g h:quad32) : Lemma (requires length hash == 8 /\ a.hi3 == word_to_nat32 hash.[0] /\ b.hi3 == word_to_nat32 hash.[1] /\ c.hi3 == word_to_nat32 hash.[2] /\ d.hi3 == word_to_nat32 hash.[3] /\ e.hi3 == word_to_nat32 hash.[4] /\ f.hi3 == word_to_nat32 hash.[5] /\ g.hi3 == word_to_nat32 hash.[6] /\ h.hi3 == word_to_nat32 hash.[7]) (ensures hash == make_seperated_hash_quad32 a b c d e f g h) = assert (equal hash (make_seperated_hash_quad32 a b c d e f g h)) let lemma_vsel32 (a b c:nat32) : Lemma (ensures (isel32 a b c = (iand32 c a) *^ (iand32 (inot32 c) b))) = reveal_iand_all 32; reveal_inot_all 32; reveal_ixor_all 32; lemma_equal_nth 32 (isel32 a b c) ((iand32 c a) *^ (iand32 (inot32 c) b)) let ch_256_def (x y z:nat32) : (a:nat32 {a == (iand32 x y) *^ (iand32 (inot32 x) z)}) = reveal_iand_all 32; reveal_inot_all 32; reveal_ixor_all 32; ch256 x y z [@"opaque_to_smt"] let ch_256 = opaque_make ch_256_def irreducible let ch_256_reveal = opaque_revealer (`%ch_256) ch_256 ch_256_def let lemma_eq_maj_xvsel32 (a b c:nat32) : Lemma (ensures (isel32 c b (a *^ b) = (iand32 a b) *^ ((iand32 a c) *^ (iand32 b c)))) = reveal_iand_all 32; reveal_ixor_all 32; lemma_equal_nth 32 (isel32 c b (a *^ b)) ((iand32 a b) *^ ((iand32 a c) *^ (iand32 b c))) let maj_256_def (x y z:nat32) : (a:nat32 {a == (iand32 x y) *^ ((iand32 x z) *^ (iand32 y z))}) = reveal_iand_all 32; reveal_ixor_all 32; maj256 x y z
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Pervasives.Lemma (ensures Vale.SHA.PPC64LE.SHA_helpers.maj_256 == Vale.SHA.PPC64LE.SHA_helpers.maj_256_def)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Opaque_s.opaque_revealer", "Vale.Def.Words_s.nat32", "Prims.l_True", "Prims.eq2", "Vale.Arch.Types.op_Star_Hat", "Vale.Arch.Types.iand32", "Vale.SHA.PPC64LE.SHA_helpers.maj_256", "Vale.SHA.PPC64LE.SHA_helpers.maj_256_def" ]
[]
true
false
true
false
false
let maj_256_reveal =
opaque_revealer (`%maj_256) maj_256 maj_256_def
false
FStar.Int128.fsti
FStar.Int128.op_Less_Equals_Hat
val op_Less_Equals_Hat : a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
let op_Less_Equals_Hat = lte
{ "file_name": "ulib/FStar.Int128.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 35, "end_line": 136, "start_col": 7, "start_line": 136 }
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int128 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 128 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left unfold let op_Greater_Greater_Hat = shift_right unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right unfold let op_Equals_Hat = eq unfold let op_Greater_Hat = gt unfold let op_Greater_Equals_Hat = gte
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int64.fsti.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int128.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Int128.lte" ]
[]
false
false
false
true
false
let op_Less_Equals_Hat =
lte
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.ch_256
val ch_256 (x y z:nat32):Pure(nat32) (requires True) (ensures fun a -> a == (iand32 x y) *^ (iand32 (inot32 x) z))
val ch_256 (x y z:nat32):Pure(nat32) (requires True) (ensures fun a -> a == (iand32 x y) *^ (iand32 (inot32 x) z))
let ch_256 = opaque_make ch_256_def
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 54, "end_line": 356, "start_col": 19, "start_line": 356 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma0_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[0]) in sigma256_1_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma2 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig)) = sigma_1_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_1_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma1_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[4]) in sigma256_1_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma3 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[4])) (ensures (sigma256_1_1 src.hi3 == sigma_1_1_partial t block hash_orig)) = sigma_1_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let make_seperated_hash_def (a b c d e f g h:nat32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a /\ hash.[1] == to_uint32 b /\ hash.[2] == to_uint32 c /\ hash.[3] == to_uint32 d /\ hash.[4] == to_uint32 e /\ hash.[5] == to_uint32 f /\ hash.[6] == to_uint32 g /\ hash.[7] == to_uint32 h }) = let a = to_uint32 a in let b = to_uint32 b in let c = to_uint32 c in let d = to_uint32 d in let e = to_uint32 e in let f = to_uint32 f in let g = to_uint32 g in let h = to_uint32 h in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_seperated_hash = opaque_make make_seperated_hash_def irreducible let make_seperated_hash_reveal = opaque_revealer (`%make_seperated_hash) make_seperated_hash make_seperated_hash_def let make_seperated_hash_quad32_def (a b c d e f g h:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a.hi3 /\ hash.[1] == to_uint32 b.hi3 /\ hash.[2] == to_uint32 c.hi3 /\ hash.[3] == to_uint32 d.hi3 /\ hash.[4] == to_uint32 e.hi3 /\ hash.[5] == to_uint32 f.hi3 /\ hash.[6] == to_uint32 g.hi3 /\ hash.[7] == to_uint32 h.hi3 }) = let a = to_uint32 a.hi3 in let b = to_uint32 b.hi3 in let c = to_uint32 c.hi3 in let d = to_uint32 d.hi3 in let e = to_uint32 e.hi3 in let f = to_uint32 f.hi3 in let g = to_uint32 g.hi3 in let h = to_uint32 h.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_seperated_hash_quad32 = opaque_make make_seperated_hash_quad32_def irreducible let make_seperated_hash_quad32_reveal = opaque_revealer (`%make_seperated_hash_quad32) make_seperated_hash_quad32 make_seperated_hash_quad32_def let lemma_make_seperated_hash (hash:hash256) (a b c d e f g h:quad32) : Lemma (requires length hash == 8 /\ a.hi3 == word_to_nat32 hash.[0] /\ b.hi3 == word_to_nat32 hash.[1] /\ c.hi3 == word_to_nat32 hash.[2] /\ d.hi3 == word_to_nat32 hash.[3] /\ e.hi3 == word_to_nat32 hash.[4] /\ f.hi3 == word_to_nat32 hash.[5] /\ g.hi3 == word_to_nat32 hash.[6] /\ h.hi3 == word_to_nat32 hash.[7]) (ensures hash == make_seperated_hash_quad32 a b c d e f g h) = assert (equal hash (make_seperated_hash_quad32 a b c d e f g h)) let lemma_vsel32 (a b c:nat32) : Lemma (ensures (isel32 a b c = (iand32 c a) *^ (iand32 (inot32 c) b))) = reveal_iand_all 32; reveal_inot_all 32; reveal_ixor_all 32; lemma_equal_nth 32 (isel32 a b c) ((iand32 c a) *^ (iand32 (inot32 c) b)) let ch_256_def (x y z:nat32) : (a:nat32 {a == (iand32 x y) *^ (iand32 (inot32 x) z)}) = reveal_iand_all 32; reveal_inot_all 32; reveal_ixor_all 32;
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Vale.Def.Words_s.nat32 -> y: Vale.Def.Words_s.nat32 -> z: Vale.Def.Words_s.nat32 -> Prims.Pure Vale.Def.Words_s.nat32
Prims.Pure
[]
[]
[ "Vale.Def.Opaque_s.opaque_make", "Vale.Def.Words_s.nat32", "Prims.l_True", "Prims.eq2", "Vale.Arch.Types.op_Star_Hat", "Vale.Arch.Types.iand32", "Vale.Arch.Types.inot32", "Vale.SHA.PPC64LE.SHA_helpers.ch_256_def" ]
[]
false
false
false
false
false
let ch_256 =
opaque_make ch_256_def
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.ch_256_reveal
val ch_256_reveal : _: Prims.unit -> FStar.Pervasives.Lemma (ensures Vale.SHA.PPC64LE.SHA_helpers.ch_256 == Vale.SHA.PPC64LE.SHA_helpers.ch_256_def)
let ch_256_reveal = opaque_revealer (`%ch_256) ch_256 ch_256_def
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 76, "end_line": 357, "start_col": 12, "start_line": 357 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma0_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[0]) in sigma256_1_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma2 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig)) = sigma_1_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_1_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma1_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[4]) in sigma256_1_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma3 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[4])) (ensures (sigma256_1_1 src.hi3 == sigma_1_1_partial t block hash_orig)) = sigma_1_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let make_seperated_hash_def (a b c d e f g h:nat32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a /\ hash.[1] == to_uint32 b /\ hash.[2] == to_uint32 c /\ hash.[3] == to_uint32 d /\ hash.[4] == to_uint32 e /\ hash.[5] == to_uint32 f /\ hash.[6] == to_uint32 g /\ hash.[7] == to_uint32 h }) = let a = to_uint32 a in let b = to_uint32 b in let c = to_uint32 c in let d = to_uint32 d in let e = to_uint32 e in let f = to_uint32 f in let g = to_uint32 g in let h = to_uint32 h in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_seperated_hash = opaque_make make_seperated_hash_def irreducible let make_seperated_hash_reveal = opaque_revealer (`%make_seperated_hash) make_seperated_hash make_seperated_hash_def let make_seperated_hash_quad32_def (a b c d e f g h:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a.hi3 /\ hash.[1] == to_uint32 b.hi3 /\ hash.[2] == to_uint32 c.hi3 /\ hash.[3] == to_uint32 d.hi3 /\ hash.[4] == to_uint32 e.hi3 /\ hash.[5] == to_uint32 f.hi3 /\ hash.[6] == to_uint32 g.hi3 /\ hash.[7] == to_uint32 h.hi3 }) = let a = to_uint32 a.hi3 in let b = to_uint32 b.hi3 in let c = to_uint32 c.hi3 in let d = to_uint32 d.hi3 in let e = to_uint32 e.hi3 in let f = to_uint32 f.hi3 in let g = to_uint32 g.hi3 in let h = to_uint32 h.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_seperated_hash_quad32 = opaque_make make_seperated_hash_quad32_def irreducible let make_seperated_hash_quad32_reveal = opaque_revealer (`%make_seperated_hash_quad32) make_seperated_hash_quad32 make_seperated_hash_quad32_def let lemma_make_seperated_hash (hash:hash256) (a b c d e f g h:quad32) : Lemma (requires length hash == 8 /\ a.hi3 == word_to_nat32 hash.[0] /\ b.hi3 == word_to_nat32 hash.[1] /\ c.hi3 == word_to_nat32 hash.[2] /\ d.hi3 == word_to_nat32 hash.[3] /\ e.hi3 == word_to_nat32 hash.[4] /\ f.hi3 == word_to_nat32 hash.[5] /\ g.hi3 == word_to_nat32 hash.[6] /\ h.hi3 == word_to_nat32 hash.[7]) (ensures hash == make_seperated_hash_quad32 a b c d e f g h) = assert (equal hash (make_seperated_hash_quad32 a b c d e f g h)) let lemma_vsel32 (a b c:nat32) : Lemma (ensures (isel32 a b c = (iand32 c a) *^ (iand32 (inot32 c) b))) = reveal_iand_all 32; reveal_inot_all 32; reveal_ixor_all 32; lemma_equal_nth 32 (isel32 a b c) ((iand32 c a) *^ (iand32 (inot32 c) b)) let ch_256_def (x y z:nat32) : (a:nat32 {a == (iand32 x y) *^ (iand32 (inot32 x) z)}) = reveal_iand_all 32; reveal_inot_all 32; reveal_ixor_all 32; ch256 x y z
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Pervasives.Lemma (ensures Vale.SHA.PPC64LE.SHA_helpers.ch_256 == Vale.SHA.PPC64LE.SHA_helpers.ch_256_def)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Opaque_s.opaque_revealer", "Vale.Def.Words_s.nat32", "Prims.l_True", "Prims.eq2", "Vale.Arch.Types.op_Star_Hat", "Vale.Arch.Types.iand32", "Vale.Arch.Types.inot32", "Vale.SHA.PPC64LE.SHA_helpers.ch_256", "Vale.SHA.PPC64LE.SHA_helpers.ch_256_def" ]
[]
true
false
true
false
false
let ch_256_reveal =
opaque_revealer (`%ch_256) ch_256 ch_256_def
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.lemma_update_block_equiv
val lemma_update_block_equiv (hash: hash256) (block: bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block)
val lemma_update_block_equiv (hash: hash256) (block: bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block)
let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); ()
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 4, "end_line": 146, "start_col": 0, "start_line": 140 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3", "smt.arith.nl=true" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
hash: Vale.SHA.PPC64LE.SHA_helpers.hash256 -> block: Vale.SHA.PPC64LE.SHA_helpers.bytes {FStar.Seq.Base.length block = Vale.SHA.PPC64LE.SHA_helpers.block_length} -> FStar.Pervasives.Lemma (ensures Vale.SHA.PPC64LE.SHA_helpers.update_block hash (Spec.Hash.Definitions.words_of_bytes Spec.Hash.Definitions.SHA2_256 block) == Spec.Agile.Hash.update Spec.Hash.Definitions.SHA2_256 hash block)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Vale.SHA.PPC64LE.SHA_helpers.bytes", "Prims.b2t", "Prims.op_Equality", "Prims.int", "FStar.Seq.Base.length", "Vale.SHA.PPC64LE.SHA_helpers.byte", "Vale.SHA.PPC64LE.SHA_helpers.block_length", "Prims.unit", "Prims._assert", "FStar.Seq.Base.equal", "Vale.SHA.PPC64LE.SHA_helpers.word", "Vale.SHA.PPC64LE.SHA_helpers.update_block", "Spec.Hash.Definitions.words_of_bytes", "Spec.Hash.Definitions.SHA2_256", "Spec.Hash.Definitions.block_word_length", "Spec.Agile.Hash.update", "FStar.Pervasives.reveal_opaque", "Spec.Hash.Definitions.sha2_alg", "Spec.Hash.Definitions.words_state", "Spec.SHA2.block_w", "Spec.SHA2.shuffle", "Spec.Hash.Definitions.update_t", "Spec.SHA2.update", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Seq.Base.seq", "Prims.l_or", "Prims.nat", "Spec.Hash.Definitions.word", "Spec.Hash.Definitions.state_word_length", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_update_block_equiv (hash: hash256) (block: bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) =
Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); ()
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.lemma_sigma_1_0_partial
val lemma_sigma_1_0_partial (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w_256) (ensures (sigma256_1_0 (word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) == sigma_1_0_partial t block hash_orig))
val lemma_sigma_1_0_partial (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w_256) (ensures (sigma256_1_0 (word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) == sigma_1_0_partial t block hash_orig))
let lemma_sigma_1_0_partial (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256)) (ensures (sigma256_1_0 (word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) == sigma_1_0_partial t block hash_orig)) = sigma_1_0_partial_reveal ()
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 29, "end_line": 391, "start_col": 0, "start_line": 387 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma0_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[0]) in sigma256_1_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma2 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig)) = sigma_1_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_1_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma1_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[4]) in sigma256_1_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma3 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[4])) (ensures (sigma256_1_1 src.hi3 == sigma_1_1_partial t block hash_orig)) = sigma_1_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let make_seperated_hash_def (a b c d e f g h:nat32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a /\ hash.[1] == to_uint32 b /\ hash.[2] == to_uint32 c /\ hash.[3] == to_uint32 d /\ hash.[4] == to_uint32 e /\ hash.[5] == to_uint32 f /\ hash.[6] == to_uint32 g /\ hash.[7] == to_uint32 h }) = let a = to_uint32 a in let b = to_uint32 b in let c = to_uint32 c in let d = to_uint32 d in let e = to_uint32 e in let f = to_uint32 f in let g = to_uint32 g in let h = to_uint32 h in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_seperated_hash = opaque_make make_seperated_hash_def irreducible let make_seperated_hash_reveal = opaque_revealer (`%make_seperated_hash) make_seperated_hash make_seperated_hash_def let make_seperated_hash_quad32_def (a b c d e f g h:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a.hi3 /\ hash.[1] == to_uint32 b.hi3 /\ hash.[2] == to_uint32 c.hi3 /\ hash.[3] == to_uint32 d.hi3 /\ hash.[4] == to_uint32 e.hi3 /\ hash.[5] == to_uint32 f.hi3 /\ hash.[6] == to_uint32 g.hi3 /\ hash.[7] == to_uint32 h.hi3 }) = let a = to_uint32 a.hi3 in let b = to_uint32 b.hi3 in let c = to_uint32 c.hi3 in let d = to_uint32 d.hi3 in let e = to_uint32 e.hi3 in let f = to_uint32 f.hi3 in let g = to_uint32 g.hi3 in let h = to_uint32 h.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_seperated_hash_quad32 = opaque_make make_seperated_hash_quad32_def irreducible let make_seperated_hash_quad32_reveal = opaque_revealer (`%make_seperated_hash_quad32) make_seperated_hash_quad32 make_seperated_hash_quad32_def let lemma_make_seperated_hash (hash:hash256) (a b c d e f g h:quad32) : Lemma (requires length hash == 8 /\ a.hi3 == word_to_nat32 hash.[0] /\ b.hi3 == word_to_nat32 hash.[1] /\ c.hi3 == word_to_nat32 hash.[2] /\ d.hi3 == word_to_nat32 hash.[3] /\ e.hi3 == word_to_nat32 hash.[4] /\ f.hi3 == word_to_nat32 hash.[5] /\ g.hi3 == word_to_nat32 hash.[6] /\ h.hi3 == word_to_nat32 hash.[7]) (ensures hash == make_seperated_hash_quad32 a b c d e f g h) = assert (equal hash (make_seperated_hash_quad32 a b c d e f g h)) let lemma_vsel32 (a b c:nat32) : Lemma (ensures (isel32 a b c = (iand32 c a) *^ (iand32 (inot32 c) b))) = reveal_iand_all 32; reveal_inot_all 32; reveal_ixor_all 32; lemma_equal_nth 32 (isel32 a b c) ((iand32 c a) *^ (iand32 (inot32 c) b)) let ch_256_def (x y z:nat32) : (a:nat32 {a == (iand32 x y) *^ (iand32 (inot32 x) z)}) = reveal_iand_all 32; reveal_inot_all 32; reveal_ixor_all 32; ch256 x y z [@"opaque_to_smt"] let ch_256 = opaque_make ch_256_def irreducible let ch_256_reveal = opaque_revealer (`%ch_256) ch_256 ch_256_def let lemma_eq_maj_xvsel32 (a b c:nat32) : Lemma (ensures (isel32 c b (a *^ b) = (iand32 a b) *^ ((iand32 a c) *^ (iand32 b c)))) = reveal_iand_all 32; reveal_ixor_all 32; lemma_equal_nth 32 (isel32 c b (a *^ b)) ((iand32 a b) *^ ((iand32 a c) *^ (iand32 b c))) let maj_256_def (x y z:nat32) : (a:nat32 {a == (iand32 x y) *^ ((iand32 x z) *^ (iand32 y z))}) = reveal_iand_all 32; reveal_ixor_all 32; maj256 x y z [@"opaque_to_smt"] let maj_256 = opaque_make maj_256_def irreducible let maj_256_reveal = opaque_revealer (`%maj_256) maj_256 maj_256_def let lemma_sigma_0_0_partial (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256)) (ensures (sigma256_0_0 (ws_opaque block (t-15)) == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal () let lemma_sigma_0_1_partial (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256)) (ensures (sigma256_0_1 (ws_opaque block (t-2)) == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal ()
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Vale.SHA.PPC64LE.SHA_helpers.counter -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w -> hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 -> FStar.Pervasives.Lemma (requires t < Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256) (ensures Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale t block hash_orig).[ 0 ]) == Vale.SHA.PPC64LE.SHA_helpers.sigma_1_0_partial t block hash_orig)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.SHA.PPC64LE.SHA_helpers.counter", "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Vale.SHA.PPC64LE.SHA_helpers.sigma_1_0_partial_reveal", "Prims.unit", "Prims.b2t", "Prims.op_LessThan", "Spec.SHA2.size_k_w", "Spec.Hash.Definitions.SHA2_256", "Prims.squash", "Prims.eq2", "Vale.Def.Words_s.nat32", "Vale.SHA2.Wrapper.sigma256_1_0", "Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32", "Spec.SHA2.op_String_Access", "Vale.SHA.PPC64LE.SHA_helpers.word", "Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale", "Vale.SHA.PPC64LE.SHA_helpers.sigma_1_0_partial", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_sigma_1_0_partial (t: counter) (block: block_w) (hash_orig: hash256) : Lemma (requires t < size_k_w (SHA2_256)) (ensures (sigma256_1_0 (word_to_nat32 ((repeat_range_vale t block hash_orig).[ 0 ])) == sigma_1_0_partial t block hash_orig)) =
sigma_1_0_partial_reveal ()
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.lemma_sha256_sigma1
val lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w_256 /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block))
val lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w_256 /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block))
let lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal (); ()
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 4, "end_line": 230, "start_col": 0, "start_line": 224 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
src: Vale.Def.Types_s.quad32 -> t: Vale.SHA.PPC64LE.SHA_helpers.counter -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w -> FStar.Pervasives.Lemma (requires 16 <= t /\ t < Vale.SHA.PPC64LE.SHA_helpers.size_k_w_256 /\ Mkfour?.hi3 src == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (t - 2)) (ensures Vale.SHA2.Wrapper.sigma256_0_1 (Mkfour?.hi3 src) == Vale.SHA.PPC64LE.SHA_helpers.sigma_0_1_partial t block)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Types_s.quad32", "Vale.SHA.PPC64LE.SHA_helpers.counter", "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Prims.unit", "Vale.SHA.PPC64LE.SHA_helpers.sigma_0_1_partial_reveal", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Spec.SHA2.size_k_w", "Spec.Hash.Definitions.SHA2_256", "Prims.eq2", "Vale.Def.Words_s.nat32", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Vale.Def.Types_s.nat32", "Vale.SHA.PPC64LE.SHA_helpers.ws_opaque", "Prims.op_Subtraction", "Prims.squash", "Vale.SHA2.Wrapper.sigma256_0_1", "Vale.SHA.PPC64LE.SHA_helpers.sigma_0_1_partial", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_sha256_sigma1 (src: quad32) (t: counter) (block: block_w) : Lemma (requires 16 <= t /\ t < size_k_w (SHA2_256) /\ src.hi3 == ws_opaque block (t - 2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) =
sigma_0_1_partial_reveal (); ()
false