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
LowStar.ConstBuffer.fst
LowStar.ConstBuffer.index
val index (c:const_buffer 'a) (i:U32.t) : Stack 'a (requires fun h -> live h c /\ U32.v i < length c) (ensures fun h0 y h1 -> h0 == h1 /\ y == Seq.index (as_seq h0 c) (U32.v i))
val index (c:const_buffer 'a) (i:U32.t) : Stack 'a (requires fun h -> live h c /\ U32.v i < length c) (ensures fun h0 y h1 -> h0 == h1 /\ y == Seq.index (as_seq h0 c) (U32.v i))
let index c i = let x = qbuf_mbuf c in B.index x i
{ "file_name": "ulib/LowStar.ConstBuffer.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 13, "end_line": 43, "start_col": 0, "start_line": 41 }
(* 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 LowStar.ConstBuffer module U32 = FStar.UInt32 module Seq = FStar.Seq module HS = FStar.HyperStack open FStar.HyperStack.ST module I = LowStar.ImmutableBuffer module B = LowStar.Buffer let const_buffer a = qbuf a let as_qbuf c = c let of_buffer b = (| MUTABLE, b |) let of_ibuffer b = (| IMMUTABLE, b |) let of_qbuf #_ #q b = (| q, b |) let is_null #a c = let x = qbuf_mbuf c in B.is_null x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.ImmutableBuffer.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "LowStar.ConstBuffer.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowStar", "short_module": null }, { "abbrev": false, "full_module": "LowStar", "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
c: LowStar.ConstBuffer.const_buffer 'a -> i: FStar.UInt32.t -> FStar.HyperStack.ST.Stack 'a
FStar.HyperStack.ST.Stack
[]
[]
[ "LowStar.ConstBuffer.const_buffer", "FStar.UInt32.t", "LowStar.Monotonic.Buffer.index", "LowStar.ConstBuffer.qbuf_pre", "LowStar.Monotonic.Buffer.mbuffer", "LowStar.ConstBuffer.qbuf_mbuf" ]
[]
false
true
false
false
false
let index c i =
let x = qbuf_mbuf c in B.index x i
false
LowStar.ConstBuffer.fst
LowStar.ConstBuffer.is_null
val is_null (c:const_buffer 'a) : Stack bool (requires (fun h -> live h c)) (ensures (fun h y h' -> h == h' /\ y == g_is_null c))
val is_null (c:const_buffer 'a) : Stack bool (requires (fun h -> live h c)) (ensures (fun h y h' -> h == h' /\ y == g_is_null c))
let is_null #a c = let x = qbuf_mbuf c in B.is_null x
{ "file_name": "ulib/LowStar.ConstBuffer.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 13, "end_line": 39, "start_col": 0, "start_line": 37 }
(* 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 LowStar.ConstBuffer module U32 = FStar.UInt32 module Seq = FStar.Seq module HS = FStar.HyperStack open FStar.HyperStack.ST module I = LowStar.ImmutableBuffer module B = LowStar.Buffer let const_buffer a = qbuf a let as_qbuf c = c let of_buffer b = (| MUTABLE, b |) let of_ibuffer b = (| IMMUTABLE, b |) let of_qbuf #_ #q b = (| q, b |)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.ImmutableBuffer.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "LowStar.ConstBuffer.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowStar", "short_module": null }, { "abbrev": false, "full_module": "LowStar", "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
c: LowStar.ConstBuffer.const_buffer 'a -> FStar.HyperStack.ST.Stack Prims.bool
FStar.HyperStack.ST.Stack
[]
[]
[ "LowStar.ConstBuffer.const_buffer", "LowStar.Monotonic.Buffer.is_null", "LowStar.ConstBuffer.qbuf_pre", "Prims.bool", "LowStar.Monotonic.Buffer.mbuffer", "LowStar.ConstBuffer.qbuf_mbuf" ]
[]
false
true
false
false
false
let is_null #a c =
let x = qbuf_mbuf c in B.is_null x
false
LowStar.ConstBuffer.fst
LowStar.ConstBuffer.of_qbuf
val of_qbuf (#q:qual) (b:B.mbuffer 'a (q_preorder q 'a) (q_preorder q 'a)) : Pure (const_buffer 'a) (requires True) (ensures fun c -> let c = as_qbuf c in qbuf_qual c == q /\ qbuf_mbuf c == b)
val of_qbuf (#q:qual) (b:B.mbuffer 'a (q_preorder q 'a) (q_preorder q 'a)) : Pure (const_buffer 'a) (requires True) (ensures fun c -> let c = as_qbuf c in qbuf_qual c == q /\ qbuf_mbuf c == b)
let of_qbuf #_ #q b = (| q, b |)
{ "file_name": "ulib/LowStar.ConstBuffer.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 32, "end_line": 35, "start_col": 0, "start_line": 35 }
(* 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 LowStar.ConstBuffer module U32 = FStar.UInt32 module Seq = FStar.Seq module HS = FStar.HyperStack open FStar.HyperStack.ST module I = LowStar.ImmutableBuffer module B = LowStar.Buffer let const_buffer a = qbuf a let as_qbuf c = c let of_buffer b = (| MUTABLE, b |) let of_ibuffer b = (| IMMUTABLE, b |)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.ImmutableBuffer.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "LowStar.ConstBuffer.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowStar", "short_module": null }, { "abbrev": false, "full_module": "LowStar", "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
b: LowStar.Monotonic.Buffer.mbuffer 'a (LowStar.ConstBuffer.q_preorder q 'a) (LowStar.ConstBuffer.q_preorder q 'a) -> Prims.Pure (LowStar.ConstBuffer.const_buffer 'a)
Prims.Pure
[]
[]
[ "LowStar.ConstBuffer.qual", "LowStar.Monotonic.Buffer.mbuffer", "LowStar.ConstBuffer.q_preorder", "Prims.Mkdtuple2", "LowStar.ConstBuffer.qbuf_cases", "LowStar.ConstBuffer.const_buffer" ]
[]
false
false
false
false
false
let of_qbuf #_ #q b =
(| q, b |)
false
LowStar.ConstBuffer.fst
LowStar.ConstBuffer.of_buffer
val of_buffer (b:B.buffer 'a) : Pure (const_buffer 'a) (requires True) (ensures fun c -> let c = as_qbuf c in qbuf_qual c == MUTABLE /\ qbuf_mbuf c == b)
val of_buffer (b:B.buffer 'a) : Pure (const_buffer 'a) (requires True) (ensures fun c -> let c = as_qbuf c in qbuf_qual c == MUTABLE /\ qbuf_mbuf c == b)
let of_buffer b = (| MUTABLE, b |)
{ "file_name": "ulib/LowStar.ConstBuffer.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 34, "end_line": 31, "start_col": 0, "start_line": 31 }
(* 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 LowStar.ConstBuffer module U32 = FStar.UInt32 module Seq = FStar.Seq module HS = FStar.HyperStack open FStar.HyperStack.ST module I = LowStar.ImmutableBuffer module B = LowStar.Buffer let const_buffer a = qbuf a let as_qbuf c = c
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.ImmutableBuffer.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "LowStar.ConstBuffer.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowStar", "short_module": null }, { "abbrev": false, "full_module": "LowStar", "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
b: LowStar.Buffer.buffer 'a -> Prims.Pure (LowStar.ConstBuffer.const_buffer 'a)
Prims.Pure
[]
[]
[ "LowStar.Buffer.buffer", "Prims.Mkdtuple2", "LowStar.ConstBuffer.qual", "LowStar.ConstBuffer.qbuf_cases", "LowStar.ConstBuffer.MUTABLE", "LowStar.ConstBuffer.const_buffer" ]
[]
false
false
false
false
false
let of_buffer b =
(| MUTABLE, b |)
false
LowStar.ConstBuffer.fst
LowStar.ConstBuffer.of_ibuffer
val of_ibuffer (b:I.ibuffer 'a) : Pure (const_buffer 'a) (requires True) (ensures fun c -> let c = as_qbuf c in qbuf_qual c == IMMUTABLE /\ qbuf_mbuf c == b)
val of_ibuffer (b:I.ibuffer 'a) : Pure (const_buffer 'a) (requires True) (ensures fun c -> let c = as_qbuf c in qbuf_qual c == IMMUTABLE /\ qbuf_mbuf c == b)
let of_ibuffer b = (| IMMUTABLE, b |)
{ "file_name": "ulib/LowStar.ConstBuffer.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 37, "end_line": 33, "start_col": 0, "start_line": 33 }
(* 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 LowStar.ConstBuffer module U32 = FStar.UInt32 module Seq = FStar.Seq module HS = FStar.HyperStack open FStar.HyperStack.ST module I = LowStar.ImmutableBuffer module B = LowStar.Buffer let const_buffer a = qbuf a let as_qbuf c = c let of_buffer b = (| MUTABLE, b |)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.ImmutableBuffer.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "LowStar.ConstBuffer.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowStar", "short_module": null }, { "abbrev": false, "full_module": "LowStar", "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
b: LowStar.ImmutableBuffer.ibuffer 'a -> Prims.Pure (LowStar.ConstBuffer.const_buffer 'a)
Prims.Pure
[]
[]
[ "LowStar.ImmutableBuffer.ibuffer", "Prims.Mkdtuple2", "LowStar.ConstBuffer.qual", "LowStar.ConstBuffer.qbuf_cases", "LowStar.ConstBuffer.IMMUTABLE", "LowStar.ConstBuffer.const_buffer" ]
[]
false
false
false
false
false
let of_ibuffer b =
(| IMMUTABLE, b |)
false
Hacl.K256.PrecompTable.fst
Hacl.K256.PrecompTable.precomp_g_pow2_128_table_lemma_w4
val precomp_g_pow2_128_table_lemma_w4: unit -> Lemma (forall (i:nat{i < 16}). precomp_table_acc_inv g_pow2_128 16 precomp_g_pow2_128_table_lseq_w4 i)
val precomp_g_pow2_128_table_lemma_w4: unit -> Lemma (forall (i:nat{i < 16}). precomp_table_acc_inv g_pow2_128 16 precomp_g_pow2_128_table_lseq_w4 i)
let precomp_g_pow2_128_table_lemma_w4 () = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_128 15); SPT.precomp_base_table_lemma mk_k256_precomp_base_table proj_g_pow2_128 16 precomp_g_pow2_64_table_lseq_w4; proj_g_pow2_128_lemma ()
{ "file_name": "code/k256/Hacl.K256.PrecompTable.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 26, "end_line": 251, "start_col": 0, "start_line": 247 }
module Hacl.K256.PrecompTable open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module LE = Lib.Exponentiation module SE = Spec.Exponentiation module SPT = Hacl.Spec.PrecompBaseTable module SPT256 = Hacl.Spec.PrecompBaseTable256 module SPTK = Hacl.Spec.K256.PrecompTable module S = Spec.K256 module SL = Spec.K256.Lemmas open Hacl.Impl.K256.Point include Hacl.Impl.K256.Group #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let proj_point_to_list p = SPTK.proj_point_to_list_lemma p; SPTK.proj_point_to_list p let lemma_refl x = SPTK.proj_point_to_list_lemma x //----------------- inline_for_extraction noextract let proj_g_pow2_64 : S.proj_point = [@inline_let] let rX : S.felem = 0x46ec0aa60b0b98c37b29371784676ad967b7beb1a941ddb6fbbff95b44cb788b in [@inline_let] let rY : S.felem = 0x6b946755bbc6b677576579c990a1ccf14a710545251a1428fabbf02f40268e63 in [@inline_let] let rZ : S.felem = 0x3c114b2ac17c199ec9eba9f7cc64dc459ca2e53f5bbead2b4e618b318ffcc00e in (rX, rY, rZ) val lemma_proj_g_pow2_64_eval : unit -> Lemma (SE.exp_pow2 S.mk_k256_concrete_ops S.g 64 == proj_g_pow2_64) let lemma_proj_g_pow2_64_eval () = SPT256.exp_pow2_rec_is_exp_pow2 S.mk_k256_concrete_ops S.g 64; let qX, qY, qZ = normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops S.g 64) in normalize_term_spec (SPT256.exp_pow2_rec S.mk_k256_concrete_ops S.g 64); let rX : S.felem = 0x46ec0aa60b0b98c37b29371784676ad967b7beb1a941ddb6fbbff95b44cb788b in let rY : S.felem = 0x6b946755bbc6b677576579c990a1ccf14a710545251a1428fabbf02f40268e63 in let rZ : S.felem = 0x3c114b2ac17c199ec9eba9f7cc64dc459ca2e53f5bbead2b4e618b318ffcc00e in assert_norm (qX == rX /\ qY == rY /\ qZ == rZ) inline_for_extraction noextract let proj_g_pow2_128 : S.proj_point = [@inline_let] let rX : S.felem = 0x98299efbc8e459915404ae015b48cac3b929e0158665f3c7fa5489fbd25c4297 in [@inline_let] let rY : S.felem = 0xf1e5cbc9579e7d11a31681e947c2959ae0298a006d1c06ab1ad93d6716ea50cc in [@inline_let] let rZ : S.felem = 0x5c53ffe15001674a2eacb60c9327a8b0ddbd93a0fa6d90309de6cc124133938b in (rX, rY, rZ) val lemma_proj_g_pow2_128_eval : unit -> Lemma (SE.exp_pow2 S.mk_k256_concrete_ops proj_g_pow2_64 64 == proj_g_pow2_128) let lemma_proj_g_pow2_128_eval () = SPT256.exp_pow2_rec_is_exp_pow2 S.mk_k256_concrete_ops proj_g_pow2_64 64; let qX, qY, qZ = normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_64 64) in normalize_term_spec (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_64 64); let rX : S.felem = 0x98299efbc8e459915404ae015b48cac3b929e0158665f3c7fa5489fbd25c4297 in let rY : S.felem = 0xf1e5cbc9579e7d11a31681e947c2959ae0298a006d1c06ab1ad93d6716ea50cc in let rZ : S.felem = 0x5c53ffe15001674a2eacb60c9327a8b0ddbd93a0fa6d90309de6cc124133938b in assert_norm (qX == rX /\ qY == rY /\ qZ == rZ) inline_for_extraction noextract let proj_g_pow2_192 : S.proj_point = [@inline_let] let rX : S.felem = 0xbd382b67d20492b1480ca58a6d7d617ba413a9bc7c2f1cff51301ef960fb245c in [@inline_let] let rY : S.felem = 0x0b232afcf692673aa714357c524c07867a64ea3b9dfab53f0e74622159e86b0d in [@inline_let] let rZ : S.felem = 0x028a1380449aede5df8219420b458d464a6a4773ac91e8305237878cef1cffa6 in (rX, rY, rZ) val lemma_proj_g_pow2_192_eval : unit -> Lemma (SE.exp_pow2 S.mk_k256_concrete_ops proj_g_pow2_128 64 == proj_g_pow2_192) let lemma_proj_g_pow2_192_eval () = SPT256.exp_pow2_rec_is_exp_pow2 S.mk_k256_concrete_ops proj_g_pow2_128 64; let qX, qY, qZ = normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_128 64) in normalize_term_spec (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_128 64); let rX : S.felem = 0xbd382b67d20492b1480ca58a6d7d617ba413a9bc7c2f1cff51301ef960fb245c in let rY : S.felem = 0x0b232afcf692673aa714357c524c07867a64ea3b9dfab53f0e74622159e86b0d in let rZ : S.felem = 0x028a1380449aede5df8219420b458d464a6a4773ac91e8305237878cef1cffa6 in assert_norm (qX == rX /\ qY == rY /\ qZ == rZ) // let proj_g_pow2_64 : S.proj_point = // normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops S.g 64) // let proj_g_pow2_128 : S.proj_point = // normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_64 64) // let proj_g_pow2_192 : S.proj_point = // normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_128 64) inline_for_extraction noextract let proj_g_pow2_64_list : SPTK.point_list = normalize_term (SPTK.proj_point_to_list proj_g_pow2_64) inline_for_extraction noextract let proj_g_pow2_128_list : SPTK.point_list = normalize_term (SPTK.proj_point_to_list proj_g_pow2_128) inline_for_extraction noextract let proj_g_pow2_192_list : SPTK.point_list = normalize_term (SPTK.proj_point_to_list proj_g_pow2_192) let proj_g_pow2_64_lseq : LSeq.lseq uint64 15 = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_64); Seq.seq_of_list proj_g_pow2_64_list let proj_g_pow2_128_lseq : LSeq.lseq uint64 15 = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_128); Seq.seq_of_list proj_g_pow2_128_list let proj_g_pow2_192_lseq : LSeq.lseq uint64 15 = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_192); Seq.seq_of_list proj_g_pow2_192_list val proj_g_pow2_64_lemma: unit -> Lemma (S.to_aff_point proj_g_pow2_64 == pow_point (pow2 64) g_aff) let proj_g_pow2_64_lemma () = lemma_proj_g_pow2_64_eval (); SPT256.a_pow2_64_lemma S.mk_k256_concrete_ops S.g val proj_g_pow2_128_lemma: unit -> Lemma (S.to_aff_point proj_g_pow2_128 == pow_point (pow2 128) g_aff) let proj_g_pow2_128_lemma () = lemma_proj_g_pow2_128_eval (); lemma_proj_g_pow2_64_eval (); SPT256.a_pow2_128_lemma S.mk_k256_concrete_ops S.g val proj_g_pow2_192_lemma: unit -> Lemma (S.to_aff_point proj_g_pow2_192 == pow_point (pow2 192) g_aff) let proj_g_pow2_192_lemma () = lemma_proj_g_pow2_192_eval (); lemma_proj_g_pow2_128_eval (); lemma_proj_g_pow2_64_eval (); SPT256.a_pow2_192_lemma S.mk_k256_concrete_ops S.g let proj_g_pow2_64_lseq_lemma () = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_64); proj_g_pow2_64_lemma (); SPTK.proj_point_to_list_lemma proj_g_pow2_64 let proj_g_pow2_128_lseq_lemma () = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_128); proj_g_pow2_128_lemma (); SPTK.proj_point_to_list_lemma proj_g_pow2_128 let proj_g_pow2_192_lseq_lemma () = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_192); proj_g_pow2_192_lemma (); SPTK.proj_point_to_list_lemma proj_g_pow2_192 let mk_proj_g_pow2_64 () = createL proj_g_pow2_64_list let mk_proj_g_pow2_128 () = createL proj_g_pow2_128_list let mk_proj_g_pow2_192 () = createL proj_g_pow2_192_list //---------------- /// window size = 4; precomputed table = [[0]G, [1]G, ..., [15]G] inline_for_extraction noextract let precomp_basepoint_table_list_w4: x:list uint64{FStar.List.Tot.length x = 240} = normalize_term (SPT.precomp_base_table_list mk_k256_precomp_base_table S.g 15) let precomp_basepoint_table_lseq_w4 : LSeq.lseq uint64 240 = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table S.g 15); Seq.seq_of_list precomp_basepoint_table_list_w4 let precomp_basepoint_table_lemma_w4 () = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table S.g 15); SPT.precomp_base_table_lemma mk_k256_precomp_base_table S.g 16 precomp_basepoint_table_lseq_w4 let precomp_basepoint_table_w4: x:glbuffer uint64 240ul{witnessed x precomp_basepoint_table_lseq_w4 /\ recallable x} = createL_global precomp_basepoint_table_list_w4 /// window size = 4; precomputed table = [[0]([pow2 64]G), [1]([pow2 64]G), ..., [15]([pow2 64]G)] inline_for_extraction noextract let precomp_g_pow2_64_table_list_w4: x:list uint64{FStar.List.Tot.length x = 240} = normalize_term (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_64 15) let precomp_g_pow2_64_table_lseq_w4 : LSeq.lseq uint64 240 = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_64 15); Seq.seq_of_list precomp_g_pow2_64_table_list_w4 let precomp_g_pow2_64_table_lemma_w4 () = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_64 15); SPT.precomp_base_table_lemma mk_k256_precomp_base_table proj_g_pow2_64 16 precomp_g_pow2_64_table_lseq_w4; proj_g_pow2_64_lemma () let precomp_g_pow2_64_table_w4: x:glbuffer uint64 240ul{witnessed x precomp_g_pow2_64_table_lseq_w4 /\ recallable x} = createL_global precomp_g_pow2_64_table_list_w4 /// window size = 4; precomputed table = [[0]([pow2 128]G), [1]([pow2 128]G),...,[15]([pow2 128]G)] inline_for_extraction noextract let precomp_g_pow2_128_table_list_w4: x:list uint64{FStar.List.Tot.length x = 240} = normalize_term (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_128 15) let precomp_g_pow2_128_table_lseq_w4 : LSeq.lseq uint64 240 = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_128 15); Seq.seq_of_list precomp_g_pow2_128_table_list_w4
{ "checked_file": "/", "dependencies": [ "Spec.K256.Lemmas.fsti.checked", "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.PrecompBaseTable256.fsti.checked", "Hacl.Spec.PrecompBaseTable.fsti.checked", "Hacl.Spec.K256.PrecompTable.fsti.checked", "Hacl.Impl.K256.Point.fsti.checked", "Hacl.Impl.K256.Group.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.K256.PrecompTable.fst" }
[ { "abbrev": true, "full_module": "Spec.K256.Lemmas", "short_module": "SL" }, { "abbrev": true, "full_module": "Hacl.Spec.K256.PrecompTable", "short_module": "SPTK" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable256", "short_module": "SPT256" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Impl.K256.Group", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.K256.Point", "short_module": null }, { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable", "short_module": "SPT" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation.Definitions", "short_module": "BE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.K256", "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
_: Prims.unit -> FStar.Pervasives.Lemma (ensures forall (i: Prims.nat{i < 16}). Hacl.K256.PrecompTable.precomp_table_acc_inv Hacl.K256.PrecompTable.g_pow2_128 16 Hacl.K256.PrecompTable.precomp_g_pow2_128_table_lseq_w4 i)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.unit", "Hacl.K256.PrecompTable.proj_g_pow2_128_lemma", "Hacl.Spec.PrecompBaseTable.precomp_base_table_lemma", "Spec.K256.PointOps.proj_point", "Lib.IntTypes.U64", "FStar.UInt32.uint_to_t", "Hacl.K256.PrecompTable.mk_k256_precomp_base_table", "Hacl.K256.PrecompTable.proj_g_pow2_128", "Hacl.K256.PrecompTable.precomp_g_pow2_64_table_lseq_w4", "FStar.Pervasives.normalize_term_spec", "Prims.list", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.b2t", "Prims.op_Equality", "Prims.int", "FStar.List.Tot.Base.length", "FStar.Mul.op_Star", "Prims.op_Addition", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Spec.PrecompBaseTable.precomp_base_table_list" ]
[]
true
false
true
false
false
let precomp_g_pow2_128_table_lemma_w4 () =
normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_128 15); SPT.precomp_base_table_lemma mk_k256_precomp_base_table proj_g_pow2_128 16 precomp_g_pow2_64_table_lseq_w4; proj_g_pow2_128_lemma ()
false
LowStar.ConstBuffer.fst
LowStar.ConstBuffer.sub
val sub (#a:_) (c:const_buffer a) (i:U32.t) (len:Ghost.erased (U32.t)) : Stack (const_buffer a) (requires fun h -> live h c /\ U32.v i + U32.v len <= length c) (ensures fun h0 c' h1 -> let qc = as_qbuf c in let qc' = as_qbuf c' in h0 == h1 /\ c' `const_sub_buffer i len` c)
val sub (#a:_) (c:const_buffer a) (i:U32.t) (len:Ghost.erased (U32.t)) : Stack (const_buffer a) (requires fun h -> live h c /\ U32.v i + U32.v len <= length c) (ensures fun h0 c' h1 -> let qc = as_qbuf c in let qc' = as_qbuf c' in h0 == h1 /\ c' `const_sub_buffer i len` c)
let sub #a c i len = let (| q, x |) = c in let x : B.mbuffer a (q_preorder q a) (q_preorder q a) = x in let y = B.msub (q_preorder q a) x i len in (| q, y |)
{ "file_name": "ulib/LowStar.ConstBuffer.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 12, "end_line": 49, "start_col": 0, "start_line": 45 }
(* 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 LowStar.ConstBuffer module U32 = FStar.UInt32 module Seq = FStar.Seq module HS = FStar.HyperStack open FStar.HyperStack.ST module I = LowStar.ImmutableBuffer module B = LowStar.Buffer let const_buffer a = qbuf a let as_qbuf c = c let of_buffer b = (| MUTABLE, b |) let of_ibuffer b = (| IMMUTABLE, b |) let of_qbuf #_ #q b = (| q, b |) let is_null #a c = let x = qbuf_mbuf c in B.is_null x let index c i = let x = qbuf_mbuf c in B.index x i
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.ImmutableBuffer.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "LowStar.ConstBuffer.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowStar", "short_module": null }, { "abbrev": false, "full_module": "LowStar", "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
c: LowStar.ConstBuffer.const_buffer a -> i: FStar.UInt32.t -> len: FStar.Ghost.erased FStar.UInt32.t -> FStar.HyperStack.ST.Stack (LowStar.ConstBuffer.const_buffer a)
FStar.HyperStack.ST.Stack
[]
[]
[ "LowStar.ConstBuffer.const_buffer", "FStar.UInt32.t", "FStar.Ghost.erased", "LowStar.ConstBuffer.qual", "LowStar.ConstBuffer.qbuf_cases", "Prims.Mkdtuple2", "LowStar.Monotonic.Buffer.mbuffer", "LowStar.ConstBuffer.q_preorder", "LowStar.Monotonic.Buffer.msub" ]
[]
false
true
false
false
false
let sub #a c i len =
let (| q , x |) = c in let x:B.mbuffer a (q_preorder q a) (q_preorder q a) = x in let y = B.msub (q_preorder q a) x i len in (| q, y |)
false
LowStar.ConstBuffer.fst
LowStar.ConstBuffer.to_buffer
val to_buffer (c:const_buffer 'a) : Pure (B.buffer 'a) (requires ( let c = as_qbuf c in qbuf_qual c == MUTABLE)) (ensures fun x -> x == as_mbuf c)
val to_buffer (c:const_buffer 'a) : Pure (B.buffer 'a) (requires ( let c = as_qbuf c in qbuf_qual c == MUTABLE)) (ensures fun x -> x == as_mbuf c)
let to_buffer c = qbuf_mbuf c
{ "file_name": "ulib/LowStar.ConstBuffer.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 29, "end_line": 52, "start_col": 0, "start_line": 52 }
(* 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 LowStar.ConstBuffer module U32 = FStar.UInt32 module Seq = FStar.Seq module HS = FStar.HyperStack open FStar.HyperStack.ST module I = LowStar.ImmutableBuffer module B = LowStar.Buffer let const_buffer a = qbuf a let as_qbuf c = c let of_buffer b = (| MUTABLE, b |) let of_ibuffer b = (| IMMUTABLE, b |) let of_qbuf #_ #q b = (| q, b |) let is_null #a c = let x = qbuf_mbuf c in B.is_null x let index c i = let x = qbuf_mbuf c in B.index x i let sub #a c i len = let (| q, x |) = c in let x : B.mbuffer a (q_preorder q a) (q_preorder q a) = x in let y = B.msub (q_preorder q a) x i len in (| q, y |)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.ImmutableBuffer.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "LowStar.ConstBuffer.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowStar", "short_module": null }, { "abbrev": false, "full_module": "LowStar", "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
c: LowStar.ConstBuffer.const_buffer 'a -> Prims.Pure (LowStar.Buffer.buffer 'a)
Prims.Pure
[]
[]
[ "LowStar.ConstBuffer.const_buffer", "LowStar.ConstBuffer.qbuf_mbuf", "LowStar.Buffer.buffer" ]
[]
false
false
false
false
false
let to_buffer c =
qbuf_mbuf c
false
LowStar.ConstBuffer.fst
LowStar.ConstBuffer.cast
val cast (c:const_buffer 'a) : Pure (B.mbuffer 'a (qbuf_pre (as_qbuf c)) (qbuf_pre (as_qbuf c))) (requires True) (ensures fun x -> x == as_mbuf c)
val cast (c:const_buffer 'a) : Pure (B.mbuffer 'a (qbuf_pre (as_qbuf c)) (qbuf_pre (as_qbuf c))) (requires True) (ensures fun x -> x == as_mbuf c)
let cast c = qbuf_mbuf c
{ "file_name": "ulib/LowStar.ConstBuffer.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 24, "end_line": 51, "start_col": 0, "start_line": 51 }
(* 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 LowStar.ConstBuffer module U32 = FStar.UInt32 module Seq = FStar.Seq module HS = FStar.HyperStack open FStar.HyperStack.ST module I = LowStar.ImmutableBuffer module B = LowStar.Buffer let const_buffer a = qbuf a let as_qbuf c = c let of_buffer b = (| MUTABLE, b |) let of_ibuffer b = (| IMMUTABLE, b |) let of_qbuf #_ #q b = (| q, b |) let is_null #a c = let x = qbuf_mbuf c in B.is_null x let index c i = let x = qbuf_mbuf c in B.index x i let sub #a c i len = let (| q, x |) = c in let x : B.mbuffer a (q_preorder q a) (q_preorder q a) = x in let y = B.msub (q_preorder q a) x i len in (| q, y |)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.ImmutableBuffer.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "LowStar.ConstBuffer.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowStar", "short_module": null }, { "abbrev": false, "full_module": "LowStar", "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
c: LowStar.ConstBuffer.const_buffer 'a -> Prims.Pure (LowStar.Monotonic.Buffer.mbuffer 'a (LowStar.ConstBuffer.qbuf_pre (LowStar.ConstBuffer.as_qbuf c)) (LowStar.ConstBuffer.qbuf_pre (LowStar.ConstBuffer.as_qbuf c)))
Prims.Pure
[]
[]
[ "LowStar.ConstBuffer.const_buffer", "LowStar.ConstBuffer.qbuf_mbuf", "LowStar.Monotonic.Buffer.mbuffer", "LowStar.ConstBuffer.qbuf_pre", "LowStar.ConstBuffer.as_qbuf" ]
[]
false
false
false
false
false
let cast c =
qbuf_mbuf c
false
LowStar.ConstBuffer.fst
LowStar.ConstBuffer.to_ibuffer
val to_ibuffer (c:const_buffer 'a) : Pure (I.ibuffer 'a) (requires ( let c = as_qbuf c in qbuf_qual c == IMMUTABLE)) (ensures fun x -> x == as_mbuf c)
val to_ibuffer (c:const_buffer 'a) : Pure (I.ibuffer 'a) (requires ( let c = as_qbuf c in qbuf_qual c == IMMUTABLE)) (ensures fun x -> x == as_mbuf c)
let to_ibuffer c = qbuf_mbuf c
{ "file_name": "ulib/LowStar.ConstBuffer.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 53, "start_col": 0, "start_line": 53 }
(* 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 LowStar.ConstBuffer module U32 = FStar.UInt32 module Seq = FStar.Seq module HS = FStar.HyperStack open FStar.HyperStack.ST module I = LowStar.ImmutableBuffer module B = LowStar.Buffer let const_buffer a = qbuf a let as_qbuf c = c let of_buffer b = (| MUTABLE, b |) let of_ibuffer b = (| IMMUTABLE, b |) let of_qbuf #_ #q b = (| q, b |) let is_null #a c = let x = qbuf_mbuf c in B.is_null x let index c i = let x = qbuf_mbuf c in B.index x i let sub #a c i len = let (| q, x |) = c in let x : B.mbuffer a (q_preorder q a) (q_preorder q a) = x in let y = B.msub (q_preorder q a) x i len in (| q, y |) let cast c = qbuf_mbuf c
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.ImmutableBuffer.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "LowStar.ConstBuffer.fst" }
[ { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "LowStar.ImmutableBuffer", "short_module": "I" }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowStar", "short_module": null }, { "abbrev": false, "full_module": "LowStar", "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
c: LowStar.ConstBuffer.const_buffer 'a -> Prims.Pure (LowStar.ImmutableBuffer.ibuffer 'a)
Prims.Pure
[]
[]
[ "LowStar.ConstBuffer.const_buffer", "LowStar.ConstBuffer.qbuf_mbuf", "LowStar.ImmutableBuffer.ibuffer" ]
[]
false
false
false
false
false
let to_ibuffer c =
qbuf_mbuf c
false
DPE.Messages.Parse.fst
DPE.Messages.Parse.parse_dpe_cmd_post
val parse_dpe_cmd_post (len: SZ.t) (input: A.larray U8.t (SZ.v len)) (s: erased (Seq.seq U8.t)) (p: perm) (res: option dpe_cmd) : vprop
val parse_dpe_cmd_post (len: SZ.t) (input: A.larray U8.t (SZ.v len)) (s: erased (Seq.seq U8.t)) (p: perm) (res: option dpe_cmd) : vprop
let parse_dpe_cmd_post (len:SZ.t) (input:A.larray U8.t (SZ.v len)) (s:erased (Seq.seq U8.t)) (p:perm) (res: option dpe_cmd) : vprop = match res with | None -> A.pts_to input #p s ** pure (parse_dpe_cmd_failure_postcond s) | Some cmd -> exists* vargs. raw_data_item_match full_perm cmd.dpe_cmd_args vargs ** (raw_data_item_match full_perm cmd.dpe_cmd_args vargs @==> A.pts_to input #p s ) ** pure ( exists (vsess: raw_data_item) (rem: Seq.seq U8.t) . Ghost.reveal s == serialize_cbor vsess `Seq.append` rem /\ parse_dpe_cmd_postcond cmd.dpe_cmd_sid cmd.dpe_cmd_cid vargs vsess rem )
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Parse.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 7, "end_line": 216, "start_col": 0, "start_line": 198 }
(* Copyright 2023 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 DPE.Messages.Parse open Pulse.Lib.Pervasives open CBOR.Spec open CBOR.Pulse open CDDL.Pulse module Spec = DPE.Messages.Spec module SZ = FStar.SizeT module U8 = FStar.UInt8 module A = Pulse.Lib.Array #push-options "--ext 'pulse:env_on_err'" assume val dbg : vprop open Pulse.Lib.Stick ```pulse ghost fn elim_implies (#p #q:vprop) () requires (p @==> q) ** p ensures q { open Pulse.Lib.Stick; rewrite (p @==> q) as (stick p q); elim_stick p q; } ``` inline_for_extraction noextract [@@noextract_to "krml"] let impl_session_message1 : impl_typ Spec.session_message = impl_t_array ( impl_array_group3_concat (impl_array_group3_item (impl_uint ())) (impl_array_group3_item (impl_bytes ())) ) (* ```pulse fn impl_session_message0 (c: cbor) (#p: perm) (#v: Ghost.erased raw_data_item) requires (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) )) returns res: bool ensures (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) /\ res == Spec.session_message v )) { eval_impl_typ impl_session_message1 c } ``` *) noextract [@@noextract_to "krml"] assume val impl_session_message : impl_typ Spec.session_message inline_for_extraction noextract [@@noextract_to "krml"] let impl_command_id: impl_typ Spec.command_id = impl_uint_literal Spec.get_profile `impl_t_choice_none` impl_uint_literal Spec.open_session `impl_t_choice_none` impl_uint_literal Spec.close_session `impl_t_choice_none` impl_uint_literal Spec.sync_session `impl_t_choice_none` impl_uint_literal Spec.export_session `impl_t_choice_none` impl_uint_literal Spec.import_session `impl_t_choice_none` impl_uint_literal Spec.initialize_context `impl_t_choice_none` impl_uint_literal Spec.derive_child `impl_t_choice_none` impl_uint_literal Spec.certify_key `impl_t_choice_none` impl_uint_literal Spec.sign `impl_t_choice_none` impl_uint_literal Spec.seal `impl_t_choice_none` impl_uint_literal Spec.unseal `impl_t_choice_none` impl_uint_literal Spec.derive_sealing_public_key `impl_t_choice_none` impl_uint_literal Spec.rotate_context_handle `impl_t_choice_none` impl_uint_literal Spec.destroy_context inline_for_extraction noextract [@@noextract_to "krml"] let impl_default_args_group : impl_matches_map_group Spec.default_args_group = impl_matches_map_group_no_restricted ( impl_matches_map_entry_zero_or_more_cons (CDDL.Spec.uint `CDDL.Spec.MapGroupEntry` CDDL.Spec.any) (impl_uint ()) (impl_any ()) (impl_matches_map_entry_zero_or_more_nil _) ) () inline_for_extraction noextract [@@noextract_to "krml"] let impl_command_message1 : impl_typ Spec.command_message = // Wow, the equivalence with command_message' seems to work out of the box impl_t_array ( impl_array_group3_item impl_command_id `impl_array_group3_concat` impl_array_group3_item (impl_t_map impl_default_args_group) ) (* ```pulse fn impl_command_message0 (c: cbor) (#p: perm) (#v: Ghost.erased raw_data_item) requires (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) )) returns res: bool ensures (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) /\ res == Spec.command_message v )) { eval_impl_typ impl_command_message1 c } ``` *) noextract [@@noextract_to "krml"] assume val impl_command_message : impl_typ Spec.command_message module U64 = FStar.UInt64 noeq type dpe_cmd = { dpe_cmd_sid: U64.t; dpe_cmd_cid: U64.t; dpe_cmd_args: cbor; } #push-options "--z3rlimit 64 --query_stats" // to let z3 cope with CDDL specs #restart-solver noextract [@@noextract_to "krml"] let parse_dpe_cmd_args_postcond (cid: U64.t) (vargs: raw_data_item) (vcmd: raw_data_item) (rem: Seq.seq U8.t) : Tot prop = data_item_wf deterministically_encoded_cbor_map_key_order vcmd /\ Spec.command_message vcmd /\ ( let Array [Int64 _ cid'; vargs'] = vcmd in cid == cid' /\ vargs == vargs' ) /\ Seq.length rem == 0 noextract [@@noextract_to "krml"] let parse_dpe_cmd_postcond (sid: U64.t) (cid: U64.t) (vargs: raw_data_item) (vsess: raw_data_item) (_: Seq.seq U8.t) : Tot prop = data_item_wf deterministically_encoded_cbor_map_key_order vsess /\ Spec.session_message vsess /\ ( let Array [Int64 _ sid'; String _ cmd] = vsess in sid == sid' /\ ( exists vcmd rem . cmd == serialize_cbor vcmd `Seq.append` rem /\ parse_dpe_cmd_args_postcond cid vargs vcmd rem )) noextract [@@noextract_to "krml"] let parse_dpe_cmd_failure_postcond (s: Seq.seq U8.t) : prop = ~ (exists vsess rem . s == serialize_cbor vsess `Seq.append` rem /\ ( exists sid cid vargs . parse_dpe_cmd_postcond sid cid vargs vsess rem ) )
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Stick.fsti.checked", "Pulse.Lib.Pervasives.fst.checked", "Pulse.Lib.Array.fsti.checked", "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.SizeT.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "DPE.Messages.Spec.fst.checked", "CDDL.Spec.fsti.checked", "CDDL.Pulse.fst.checked", "CBOR.Spec.fsti.checked", "CBOR.Pulse.fst.checked" ], "interface_file": false, "source_file": "DPE.Messages.Parse.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": false, "full_module": "Pulse.Lib.Stick", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Lib.Array", "short_module": "A" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "SZ" }, { "abbrev": true, "full_module": "DPE.Messages.Spec", "short_module": "Spec" }, { "abbrev": false, "full_module": "CDDL.Pulse", "short_module": null }, { "abbrev": false, "full_module": "CBOR.Pulse", "short_module": null }, { "abbrev": false, "full_module": "CBOR.Spec", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "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": 64, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: FStar.SizeT.t -> input: Pulse.Lib.Array.Core.larray FStar.UInt8.t (FStar.SizeT.v len) -> s: FStar.Ghost.erased (FStar.Seq.Base.seq FStar.UInt8.t) -> p: PulseCore.FractionalPermission.perm -> res: FStar.Pervasives.Native.option DPE.Messages.Parse.dpe_cmd -> Pulse.Lib.Core.vprop
Prims.Tot
[ "total" ]
[]
[ "FStar.SizeT.t", "Pulse.Lib.Array.Core.larray", "FStar.UInt8.t", "FStar.SizeT.v", "FStar.Ghost.erased", "FStar.Seq.Base.seq", "PulseCore.FractionalPermission.perm", "FStar.Pervasives.Native.option", "DPE.Messages.Parse.dpe_cmd", "Pulse.Lib.Core.op_Star_Star", "Pulse.Lib.Array.Core.pts_to", "FStar.Ghost.reveal", "Pulse.Lib.Core.pure", "DPE.Messages.Parse.parse_dpe_cmd_failure_postcond", "Pulse.Lib.Core.op_exists_Star", "CBOR.Spec.Type.raw_data_item", "CBOR.Pulse.Extern.raw_data_item_match", "PulseCore.FractionalPermission.full_perm", "DPE.Messages.Parse.__proj__Mkdpe_cmd__item__dpe_cmd_args", "Pulse.Lib.Stick.op_At_Equals_Equals_Greater", "Prims.l_Exists", "Prims.l_and", "Prims.eq2", "FStar.Seq.Base.append", "CBOR.Spec.serialize_cbor", "DPE.Messages.Parse.parse_dpe_cmd_postcond", "DPE.Messages.Parse.__proj__Mkdpe_cmd__item__dpe_cmd_sid", "DPE.Messages.Parse.__proj__Mkdpe_cmd__item__dpe_cmd_cid", "Pulse.Lib.Core.vprop" ]
[]
false
false
false
false
false
let parse_dpe_cmd_post (len: SZ.t) (input: A.larray U8.t (SZ.v len)) (s: erased (Seq.seq U8.t)) (p: perm) (res: option dpe_cmd) : vprop =
match res with | None -> A.pts_to input #p s ** pure (parse_dpe_cmd_failure_postcond s) | Some cmd -> exists* vargs. (raw_data_item_match full_perm cmd.dpe_cmd_args vargs ** (raw_data_item_match full_perm cmd.dpe_cmd_args vargs @==> A.pts_to input #p s)) ** pure (exists (vsess: raw_data_item) (rem: Seq.seq U8.t). Ghost.reveal s == (serialize_cbor vsess) `Seq.append` rem /\ parse_dpe_cmd_postcond cmd.dpe_cmd_sid cmd.dpe_cmd_cid vargs vsess rem)
false
DPE.Messages.Parse.fst
DPE.Messages.Parse.parse_dpe_cmd_postcond
val parse_dpe_cmd_postcond: sid: U64.t -> cid: U64.t -> vargs: raw_data_item -> vsess: raw_data_item -> Seq.seq U8.t -> Tot prop
val parse_dpe_cmd_postcond: sid: U64.t -> cid: U64.t -> vargs: raw_data_item -> vsess: raw_data_item -> Seq.seq U8.t -> Tot prop
let parse_dpe_cmd_postcond (sid: U64.t) (cid: U64.t) (vargs: raw_data_item) (vsess: raw_data_item) (_: Seq.seq U8.t) : Tot prop = data_item_wf deterministically_encoded_cbor_map_key_order vsess /\ Spec.session_message vsess /\ ( let Array [Int64 _ sid'; String _ cmd] = vsess in sid == sid' /\ ( exists vcmd rem . cmd == serialize_cbor vcmd `Seq.append` rem /\ parse_dpe_cmd_args_postcond cid vargs vcmd rem ))
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Parse.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 4, "end_line": 183, "start_col": 0, "start_line": 169 }
(* Copyright 2023 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 DPE.Messages.Parse open Pulse.Lib.Pervasives open CBOR.Spec open CBOR.Pulse open CDDL.Pulse module Spec = DPE.Messages.Spec module SZ = FStar.SizeT module U8 = FStar.UInt8 module A = Pulse.Lib.Array #push-options "--ext 'pulse:env_on_err'" assume val dbg : vprop open Pulse.Lib.Stick ```pulse ghost fn elim_implies (#p #q:vprop) () requires (p @==> q) ** p ensures q { open Pulse.Lib.Stick; rewrite (p @==> q) as (stick p q); elim_stick p q; } ``` inline_for_extraction noextract [@@noextract_to "krml"] let impl_session_message1 : impl_typ Spec.session_message = impl_t_array ( impl_array_group3_concat (impl_array_group3_item (impl_uint ())) (impl_array_group3_item (impl_bytes ())) ) (* ```pulse fn impl_session_message0 (c: cbor) (#p: perm) (#v: Ghost.erased raw_data_item) requires (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) )) returns res: bool ensures (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) /\ res == Spec.session_message v )) { eval_impl_typ impl_session_message1 c } ``` *) noextract [@@noextract_to "krml"] assume val impl_session_message : impl_typ Spec.session_message inline_for_extraction noextract [@@noextract_to "krml"] let impl_command_id: impl_typ Spec.command_id = impl_uint_literal Spec.get_profile `impl_t_choice_none` impl_uint_literal Spec.open_session `impl_t_choice_none` impl_uint_literal Spec.close_session `impl_t_choice_none` impl_uint_literal Spec.sync_session `impl_t_choice_none` impl_uint_literal Spec.export_session `impl_t_choice_none` impl_uint_literal Spec.import_session `impl_t_choice_none` impl_uint_literal Spec.initialize_context `impl_t_choice_none` impl_uint_literal Spec.derive_child `impl_t_choice_none` impl_uint_literal Spec.certify_key `impl_t_choice_none` impl_uint_literal Spec.sign `impl_t_choice_none` impl_uint_literal Spec.seal `impl_t_choice_none` impl_uint_literal Spec.unseal `impl_t_choice_none` impl_uint_literal Spec.derive_sealing_public_key `impl_t_choice_none` impl_uint_literal Spec.rotate_context_handle `impl_t_choice_none` impl_uint_literal Spec.destroy_context inline_for_extraction noextract [@@noextract_to "krml"] let impl_default_args_group : impl_matches_map_group Spec.default_args_group = impl_matches_map_group_no_restricted ( impl_matches_map_entry_zero_or_more_cons (CDDL.Spec.uint `CDDL.Spec.MapGroupEntry` CDDL.Spec.any) (impl_uint ()) (impl_any ()) (impl_matches_map_entry_zero_or_more_nil _) ) () inline_for_extraction noextract [@@noextract_to "krml"] let impl_command_message1 : impl_typ Spec.command_message = // Wow, the equivalence with command_message' seems to work out of the box impl_t_array ( impl_array_group3_item impl_command_id `impl_array_group3_concat` impl_array_group3_item (impl_t_map impl_default_args_group) ) (* ```pulse fn impl_command_message0 (c: cbor) (#p: perm) (#v: Ghost.erased raw_data_item) requires (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) )) returns res: bool ensures (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) /\ res == Spec.command_message v )) { eval_impl_typ impl_command_message1 c } ``` *) noextract [@@noextract_to "krml"] assume val impl_command_message : impl_typ Spec.command_message module U64 = FStar.UInt64 noeq type dpe_cmd = { dpe_cmd_sid: U64.t; dpe_cmd_cid: U64.t; dpe_cmd_args: cbor; } #push-options "--z3rlimit 64 --query_stats" // to let z3 cope with CDDL specs #restart-solver noextract [@@noextract_to "krml"] let parse_dpe_cmd_args_postcond (cid: U64.t) (vargs: raw_data_item) (vcmd: raw_data_item) (rem: Seq.seq U8.t) : Tot prop = data_item_wf deterministically_encoded_cbor_map_key_order vcmd /\ Spec.command_message vcmd /\ ( let Array [Int64 _ cid'; vargs'] = vcmd in cid == cid' /\ vargs == vargs' ) /\ Seq.length rem == 0
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Stick.fsti.checked", "Pulse.Lib.Pervasives.fst.checked", "Pulse.Lib.Array.fsti.checked", "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.SizeT.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "DPE.Messages.Spec.fst.checked", "CDDL.Spec.fsti.checked", "CDDL.Pulse.fst.checked", "CBOR.Spec.fsti.checked", "CBOR.Pulse.fst.checked" ], "interface_file": false, "source_file": "DPE.Messages.Parse.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": false, "full_module": "Pulse.Lib.Stick", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Lib.Array", "short_module": "A" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "SZ" }, { "abbrev": true, "full_module": "DPE.Messages.Spec", "short_module": "Spec" }, { "abbrev": false, "full_module": "CDDL.Pulse", "short_module": null }, { "abbrev": false, "full_module": "CBOR.Pulse", "short_module": null }, { "abbrev": false, "full_module": "CBOR.Spec", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "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": 64, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
sid: FStar.UInt64.t -> cid: FStar.UInt64.t -> vargs: CBOR.Spec.Type.raw_data_item -> vsess: CBOR.Spec.Type.raw_data_item -> _: FStar.Seq.Base.seq FStar.UInt8.t -> Prims.prop
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.t", "CBOR.Spec.Type.raw_data_item", "FStar.Seq.Base.seq", "FStar.UInt8.t", "Prims.l_and", "Prims.b2t", "CBOR.Spec.Type.data_item_wf", "FStar.Ghost.reveal", "Prims.bool", "CBOR.Spec.deterministically_encoded_cbor_map_key_order", "DPE.Messages.Spec.session_message", "CBOR.Spec.Constants.major_type_uint64_or_neg_int64", "CBOR.Spec.Constants.major_type_byte_string_or_text_string", "FStar.UInt.fits", "FStar.Seq.Base.length", "FStar.UInt64.n", "Prims.eq2", "Prims.l_Exists", "FStar.Seq.Base.append", "CBOR.Spec.serialize_cbor", "DPE.Messages.Parse.parse_dpe_cmd_args_postcond", "Prims.logical", "Prims.prop" ]
[]
false
false
false
true
true
let parse_dpe_cmd_postcond (sid: U64.t) (cid: U64.t) (vargs: raw_data_item) (vsess: raw_data_item) (_: Seq.seq U8.t) : Tot prop =
data_item_wf deterministically_encoded_cbor_map_key_order vsess /\ Spec.session_message vsess /\ (let Array [Int64 _ sid' ; String _ cmd] = vsess in sid == sid' /\ (exists vcmd rem. cmd == (serialize_cbor vcmd) `Seq.append` rem /\ parse_dpe_cmd_args_postcond cid vargs vcmd rem))
false
DPE.Messages.Parse.fst
DPE.Messages.Parse.impl_command_message1
val impl_command_message1:impl_typ Spec.command_message
val impl_command_message1:impl_typ Spec.command_message
let impl_command_message1 : impl_typ Spec.command_message = // Wow, the equivalence with command_message' seems to work out of the box impl_t_array ( impl_array_group3_item impl_command_id `impl_array_group3_concat` impl_array_group3_item (impl_t_map impl_default_args_group) )
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Parse.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 3, "end_line": 114, "start_col": 0, "start_line": 110 }
(* Copyright 2023 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 DPE.Messages.Parse open Pulse.Lib.Pervasives open CBOR.Spec open CBOR.Pulse open CDDL.Pulse module Spec = DPE.Messages.Spec module SZ = FStar.SizeT module U8 = FStar.UInt8 module A = Pulse.Lib.Array #push-options "--ext 'pulse:env_on_err'" assume val dbg : vprop open Pulse.Lib.Stick ```pulse ghost fn elim_implies (#p #q:vprop) () requires (p @==> q) ** p ensures q { open Pulse.Lib.Stick; rewrite (p @==> q) as (stick p q); elim_stick p q; } ``` inline_for_extraction noextract [@@noextract_to "krml"] let impl_session_message1 : impl_typ Spec.session_message = impl_t_array ( impl_array_group3_concat (impl_array_group3_item (impl_uint ())) (impl_array_group3_item (impl_bytes ())) ) (* ```pulse fn impl_session_message0 (c: cbor) (#p: perm) (#v: Ghost.erased raw_data_item) requires (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) )) returns res: bool ensures (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) /\ res == Spec.session_message v )) { eval_impl_typ impl_session_message1 c } ``` *) noextract [@@noextract_to "krml"] assume val impl_session_message : impl_typ Spec.session_message inline_for_extraction noextract [@@noextract_to "krml"] let impl_command_id: impl_typ Spec.command_id = impl_uint_literal Spec.get_profile `impl_t_choice_none` impl_uint_literal Spec.open_session `impl_t_choice_none` impl_uint_literal Spec.close_session `impl_t_choice_none` impl_uint_literal Spec.sync_session `impl_t_choice_none` impl_uint_literal Spec.export_session `impl_t_choice_none` impl_uint_literal Spec.import_session `impl_t_choice_none` impl_uint_literal Spec.initialize_context `impl_t_choice_none` impl_uint_literal Spec.derive_child `impl_t_choice_none` impl_uint_literal Spec.certify_key `impl_t_choice_none` impl_uint_literal Spec.sign `impl_t_choice_none` impl_uint_literal Spec.seal `impl_t_choice_none` impl_uint_literal Spec.unseal `impl_t_choice_none` impl_uint_literal Spec.derive_sealing_public_key `impl_t_choice_none` impl_uint_literal Spec.rotate_context_handle `impl_t_choice_none` impl_uint_literal Spec.destroy_context inline_for_extraction noextract [@@noextract_to "krml"] let impl_default_args_group : impl_matches_map_group Spec.default_args_group = impl_matches_map_group_no_restricted ( impl_matches_map_entry_zero_or_more_cons (CDDL.Spec.uint `CDDL.Spec.MapGroupEntry` CDDL.Spec.any) (impl_uint ()) (impl_any ()) (impl_matches_map_entry_zero_or_more_nil _) ) ()
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Stick.fsti.checked", "Pulse.Lib.Pervasives.fst.checked", "Pulse.Lib.Array.fsti.checked", "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.SizeT.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "DPE.Messages.Spec.fst.checked", "CDDL.Spec.fsti.checked", "CDDL.Pulse.fst.checked", "CBOR.Spec.fsti.checked", "CBOR.Pulse.fst.checked" ], "interface_file": false, "source_file": "DPE.Messages.Parse.fst" }
[ { "abbrev": false, "full_module": "Pulse.Lib.Stick", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Lib.Array", "short_module": "A" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "SZ" }, { "abbrev": true, "full_module": "DPE.Messages.Spec", "short_module": "Spec" }, { "abbrev": false, "full_module": "CDDL.Pulse", "short_module": null }, { "abbrev": false, "full_module": "CBOR.Pulse", "short_module": null }, { "abbrev": false, "full_module": "CBOR.Spec", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "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
CDDL.Pulse.impl_typ DPE.Messages.Spec.command_message
Prims.Tot
[ "total" ]
[]
[ "CDDL.Pulse.impl_t_array", "FStar.Ghost.hide", "FStar.Pervasives.Native.option", "CBOR.Spec.Type.raw_data_item", "FStar.Pervasives.Native.None", "CDDL.Spec.array_group3_concat", "FStar.Ghost.reveal", "CDDL.Spec.array_group3_item", "DPE.Messages.Spec.command_id", "CDDL.Spec.t_map", "DPE.Messages.Spec.default_args_group", "CDDL.Pulse.impl_array_group3_concat", "CDDL.Pulse.impl_array_group3_item", "DPE.Messages.Parse.impl_command_id", "CDDL.Pulse.impl_t_map", "DPE.Messages.Parse.impl_default_args_group" ]
[]
false
false
false
true
false
let impl_command_message1:impl_typ Spec.command_message =
impl_t_array ((impl_array_group3_item impl_command_id) `impl_array_group3_concat` (impl_array_group3_item (impl_t_map impl_default_args_group)))
false
Hacl.Blake2s_128.fst
Hacl.Blake2s_128.update_block
val update_block:Impl.blake2_update_block_st Spec.Blake2S Core.M128
val update_block:Impl.blake2_update_block_st Spec.Blake2S Core.M128
let update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 = Impl.blake2_update_block #Spec.Blake2S #Core.M128
{ "file_name": "code/blake2/Hacl.Blake2s_128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 51, "end_line": 11, "start_col": 0, "start_line": 10 }
module Hacl.Blake2s_128 module Spec = Spec.Blake2 module Impl = Hacl.Impl.Blake2.Generic module Core = Hacl.Impl.Blake2.Core (* Some specialized components of blake2 *) [@CInline]
{ "checked_file": "/", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Hacl.Impl.Blake2.Generic.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Blake2s_128.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Core", "short_module": "Core" }, { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Generic", "short_module": "Impl" }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Spec" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Blake2.Generic.blake2_update_block_st Spec.Blake2.Definitions.Blake2S Hacl.Impl.Blake2.Core.M128
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Blake2.Generic.blake2_update_block", "Spec.Blake2.Definitions.Blake2S", "Hacl.Impl.Blake2.Core.M128" ]
[]
false
false
false
true
false
let update_block:Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128
false
Hacl.Blake2s_128.fst
Hacl.Blake2s_128.init
val init:Impl.blake2_init_st Spec.Blake2S Core.M128
val init:Impl.blake2_init_st Spec.Blake2S Core.M128
let init : Impl.blake2_init_st Spec.Blake2S Core.M128 = Impl.blake2_init #Spec.Blake2S #Core.M128
{ "file_name": "code/blake2/Hacl.Blake2s_128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 43, "end_line": 14, "start_col": 0, "start_line": 13 }
module Hacl.Blake2s_128 module Spec = Spec.Blake2 module Impl = Hacl.Impl.Blake2.Generic module Core = Hacl.Impl.Blake2.Core (* Some specialized components of blake2 *) [@CInline] private let update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 = Impl.blake2_update_block #Spec.Blake2S #Core.M128
{ "checked_file": "/", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Hacl.Impl.Blake2.Generic.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Blake2s_128.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Core", "short_module": "Core" }, { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Generic", "short_module": "Impl" }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Spec" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Blake2.Generic.blake2_init_st Spec.Blake2.Definitions.Blake2S Hacl.Impl.Blake2.Core.M128
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Blake2.Generic.blake2_init", "Spec.Blake2.Definitions.Blake2S", "Hacl.Impl.Blake2.Core.M128" ]
[]
false
false
false
true
false
let init:Impl.blake2_init_st Spec.Blake2S Core.M128 =
Impl.blake2_init #Spec.Blake2S #Core.M128
false
Hacl.Blake2s_128.fst
Hacl.Blake2s_128.update_key
val update_key:Impl.blake2_update_key_st Spec.Blake2S Core.M128
val update_key:Impl.blake2_update_key_st Spec.Blake2S Core.M128
let update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 = Impl.blake2_update_key #Spec.Blake2S #Core.M128 update_block
{ "file_name": "code/blake2/Hacl.Blake2s_128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 62, "end_line": 17, "start_col": 0, "start_line": 16 }
module Hacl.Blake2s_128 module Spec = Spec.Blake2 module Impl = Hacl.Impl.Blake2.Generic module Core = Hacl.Impl.Blake2.Core (* Some specialized components of blake2 *) [@CInline] private let update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 = Impl.blake2_update_block #Spec.Blake2S #Core.M128 let init : Impl.blake2_init_st Spec.Blake2S Core.M128 = Impl.blake2_init #Spec.Blake2S #Core.M128
{ "checked_file": "/", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Hacl.Impl.Blake2.Generic.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Blake2s_128.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Core", "short_module": "Core" }, { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Generic", "short_module": "Impl" }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Spec" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Blake2.Generic.blake2_update_key_st Spec.Blake2.Definitions.Blake2S Hacl.Impl.Blake2.Core.M128
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Blake2.Generic.blake2_update_key", "Spec.Blake2.Definitions.Blake2S", "Hacl.Impl.Blake2.Core.M128", "Hacl.Blake2s_128.update_block" ]
[]
false
false
false
true
false
let update_key:Impl.blake2_update_key_st Spec.Blake2S Core.M128 =
Impl.blake2_update_key #Spec.Blake2S #Core.M128 update_block
false
Hacl.Blake2s_128.fst
Hacl.Blake2s_128.update_multi
val update_multi:Impl.blake2_update_multi_st Spec.Blake2S Core.M128
val update_multi:Impl.blake2_update_multi_st Spec.Blake2S Core.M128
let update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 = Impl.blake2_update_multi #Spec.Blake2S #Core.M128 update_block
{ "file_name": "code/blake2/Hacl.Blake2s_128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 64, "end_line": 20, "start_col": 0, "start_line": 19 }
module Hacl.Blake2s_128 module Spec = Spec.Blake2 module Impl = Hacl.Impl.Blake2.Generic module Core = Hacl.Impl.Blake2.Core (* Some specialized components of blake2 *) [@CInline] private let update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 = Impl.blake2_update_block #Spec.Blake2S #Core.M128 let init : Impl.blake2_init_st Spec.Blake2S Core.M128 = Impl.blake2_init #Spec.Blake2S #Core.M128 let update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 = Impl.blake2_update_key #Spec.Blake2S #Core.M128 update_block
{ "checked_file": "/", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Hacl.Impl.Blake2.Generic.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Blake2s_128.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Core", "short_module": "Core" }, { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Generic", "short_module": "Impl" }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Spec" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Blake2.Generic.blake2_update_multi_st Spec.Blake2.Definitions.Blake2S Hacl.Impl.Blake2.Core.M128
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Blake2.Generic.blake2_update_multi", "Spec.Blake2.Definitions.Blake2S", "Hacl.Impl.Blake2.Core.M128", "Hacl.Blake2s_128.update_block" ]
[]
false
false
false
true
false
let update_multi:Impl.blake2_update_multi_st Spec.Blake2S Core.M128 =
Impl.blake2_update_multi #Spec.Blake2S #Core.M128 update_block
false
Hacl.Blake2s_128.fst
Hacl.Blake2s_128.update_last
val update_last:Impl.blake2_update_last_st Spec.Blake2S Core.M128
val update_last:Impl.blake2_update_last_st Spec.Blake2S Core.M128
let update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 = Impl.blake2_update_last #Spec.Blake2S #Core.M128 update_block
{ "file_name": "code/blake2/Hacl.Blake2s_128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 63, "end_line": 23, "start_col": 0, "start_line": 22 }
module Hacl.Blake2s_128 module Spec = Spec.Blake2 module Impl = Hacl.Impl.Blake2.Generic module Core = Hacl.Impl.Blake2.Core (* Some specialized components of blake2 *) [@CInline] private let update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 = Impl.blake2_update_block #Spec.Blake2S #Core.M128 let init : Impl.blake2_init_st Spec.Blake2S Core.M128 = Impl.blake2_init #Spec.Blake2S #Core.M128 let update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 = Impl.blake2_update_key #Spec.Blake2S #Core.M128 update_block let update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 = Impl.blake2_update_multi #Spec.Blake2S #Core.M128 update_block
{ "checked_file": "/", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Hacl.Impl.Blake2.Generic.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Blake2s_128.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Core", "short_module": "Core" }, { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Generic", "short_module": "Impl" }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Spec" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Blake2.Generic.blake2_update_last_st Spec.Blake2.Definitions.Blake2S Hacl.Impl.Blake2.Core.M128
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Blake2.Generic.blake2_update_last", "Spec.Blake2.Definitions.Blake2S", "Hacl.Impl.Blake2.Core.M128", "Hacl.Blake2s_128.update_block" ]
[]
false
false
false
true
false
let update_last:Impl.blake2_update_last_st Spec.Blake2S Core.M128 =
Impl.blake2_update_last #Spec.Blake2S #Core.M128 update_block
false
Hacl.Blake2s_128.fst
Hacl.Blake2s_128.update_blocks
val update_blocks:Impl.blake2_update_blocks_st Spec.Blake2S Core.M128
val update_blocks:Impl.blake2_update_blocks_st Spec.Blake2S Core.M128
let update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 = Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 update_multi update_last
{ "file_name": "code/blake2/Hacl.Blake2s_128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 77, "end_line": 28, "start_col": 0, "start_line": 27 }
module Hacl.Blake2s_128 module Spec = Spec.Blake2 module Impl = Hacl.Impl.Blake2.Generic module Core = Hacl.Impl.Blake2.Core (* Some specialized components of blake2 *) [@CInline] private let update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 = Impl.blake2_update_block #Spec.Blake2S #Core.M128 let init : Impl.blake2_init_st Spec.Blake2S Core.M128 = Impl.blake2_init #Spec.Blake2S #Core.M128 let update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 = Impl.blake2_update_key #Spec.Blake2S #Core.M128 update_block let update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 = Impl.blake2_update_multi #Spec.Blake2S #Core.M128 update_block let update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 = Impl.blake2_update_last #Spec.Blake2S #Core.M128 update_block [@CInline]
{ "checked_file": "/", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Hacl.Impl.Blake2.Generic.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Blake2s_128.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Core", "short_module": "Core" }, { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Generic", "short_module": "Impl" }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Spec" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Blake2.Generic.blake2_update_blocks_st Spec.Blake2.Definitions.Blake2S Hacl.Impl.Blake2.Core.M128
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Blake2.Generic.blake2_update_blocks", "Spec.Blake2.Definitions.Blake2S", "Hacl.Impl.Blake2.Core.M128", "Hacl.Blake2s_128.update_multi", "Hacl.Blake2s_128.update_last" ]
[]
false
false
false
true
false
let update_blocks:Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 =
Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 update_multi update_last
false
Hacl.Blake2s_128.fst
Hacl.Blake2s_128.update
val update:Impl.blake2_update_st Spec.Blake2S Core.M128
val update:Impl.blake2_update_st Spec.Blake2S Core.M128
let update : Impl.blake2_update_st Spec.Blake2S Core.M128 = Impl.blake2_update #Spec.Blake2S #Core.M128 update_key update_blocks
{ "file_name": "code/blake2/Hacl.Blake2s_128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 70, "end_line": 32, "start_col": 0, "start_line": 31 }
module Hacl.Blake2s_128 module Spec = Spec.Blake2 module Impl = Hacl.Impl.Blake2.Generic module Core = Hacl.Impl.Blake2.Core (* Some specialized components of blake2 *) [@CInline] private let update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 = Impl.blake2_update_block #Spec.Blake2S #Core.M128 let init : Impl.blake2_init_st Spec.Blake2S Core.M128 = Impl.blake2_init #Spec.Blake2S #Core.M128 let update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 = Impl.blake2_update_key #Spec.Blake2S #Core.M128 update_block let update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 = Impl.blake2_update_multi #Spec.Blake2S #Core.M128 update_block let update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 = Impl.blake2_update_last #Spec.Blake2S #Core.M128 update_block [@CInline] private let update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 = Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 update_multi update_last
{ "checked_file": "/", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Hacl.Impl.Blake2.Generic.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Blake2s_128.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Core", "short_module": "Core" }, { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Generic", "short_module": "Impl" }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Spec" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Blake2.Generic.blake2_update_st Spec.Blake2.Definitions.Blake2S Hacl.Impl.Blake2.Core.M128
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Blake2.Generic.blake2_update", "Spec.Blake2.Definitions.Blake2S", "Hacl.Impl.Blake2.Core.M128", "Hacl.Blake2s_128.update_key", "Hacl.Blake2s_128.update_blocks" ]
[]
false
false
false
true
false
let update:Impl.blake2_update_st Spec.Blake2S Core.M128 =
Impl.blake2_update #Spec.Blake2S #Core.M128 update_key update_blocks
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_double_fw_f
val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2
val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2
let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 116, "end_line": 88, "start_col": 0, "start_line": 85 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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
len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> pow_a_to_small_b1: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> Hacl.Impl.MultiExponentiation.lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Hacl.Impl.Exponentiation.pow_a_to_small_b_st", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "Hacl.Impl.Exponentiation.lmul_acc_pow_a_bits_l", "Prims.unit", "Hacl.Impl.Exponentiation.lexp_fw_f" ]
[]
false
false
false
false
false
let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp =
lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp
false
Hacl.Blake2s_128.fst
Hacl.Blake2s_128.store_state128s_to_state32
val store_state128s_to_state32:Core.store_state_st Spec.Blake2S Core.M128
val store_state128s_to_state32:Core.store_state_st Spec.Blake2S Core.M128
let store_state128s_to_state32: Core.store_state_st Spec.Blake2S Core.M128 = Core.store_state_to_state32 #Spec.Blake2S #Core.M128
{ "file_name": "code/blake2/Hacl.Blake2s_128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 54, "end_line": 38, "start_col": 0, "start_line": 37 }
module Hacl.Blake2s_128 module Spec = Spec.Blake2 module Impl = Hacl.Impl.Blake2.Generic module Core = Hacl.Impl.Blake2.Core (* Some specialized components of blake2 *) [@CInline] private let update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 = Impl.blake2_update_block #Spec.Blake2S #Core.M128 let init : Impl.blake2_init_st Spec.Blake2S Core.M128 = Impl.blake2_init #Spec.Blake2S #Core.M128 let update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 = Impl.blake2_update_key #Spec.Blake2S #Core.M128 update_block let update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 = Impl.blake2_update_multi #Spec.Blake2S #Core.M128 update_block let update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 = Impl.blake2_update_last #Spec.Blake2S #Core.M128 update_block [@CInline] private let update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 = Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 update_multi update_last [@CInline] let update : Impl.blake2_update_st Spec.Blake2S Core.M128 = Impl.blake2_update #Spec.Blake2S #Core.M128 update_key update_blocks let finish : Impl.blake2_finish_st Spec.Blake2S Core.M128 = Impl.blake2_finish #Spec.Blake2S #Core.M128
{ "checked_file": "/", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Hacl.Impl.Blake2.Generic.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Blake2s_128.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Core", "short_module": "Core" }, { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Generic", "short_module": "Impl" }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Spec" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Blake2.Core.store_state_st Spec.Blake2.Definitions.Blake2S Hacl.Impl.Blake2.Core.M128
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Blake2.Core.store_state_to_state32", "Spec.Blake2.Definitions.Blake2S", "Hacl.Impl.Blake2.Core.M128" ]
[]
false
false
false
true
false
let store_state128s_to_state32:Core.store_state_st Spec.Blake2S Core.M128 =
Core.store_state_to_state32 #Spec.Blake2S #Core.M128
false
Hacl.Blake2s_128.fst
Hacl.Blake2s_128.finish
val finish:Impl.blake2_finish_st Spec.Blake2S Core.M128
val finish:Impl.blake2_finish_st Spec.Blake2S Core.M128
let finish : Impl.blake2_finish_st Spec.Blake2S Core.M128 = Impl.blake2_finish #Spec.Blake2S #Core.M128
{ "file_name": "code/blake2/Hacl.Blake2s_128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 45, "end_line": 35, "start_col": 0, "start_line": 34 }
module Hacl.Blake2s_128 module Spec = Spec.Blake2 module Impl = Hacl.Impl.Blake2.Generic module Core = Hacl.Impl.Blake2.Core (* Some specialized components of blake2 *) [@CInline] private let update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 = Impl.blake2_update_block #Spec.Blake2S #Core.M128 let init : Impl.blake2_init_st Spec.Blake2S Core.M128 = Impl.blake2_init #Spec.Blake2S #Core.M128 let update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 = Impl.blake2_update_key #Spec.Blake2S #Core.M128 update_block let update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 = Impl.blake2_update_multi #Spec.Blake2S #Core.M128 update_block let update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 = Impl.blake2_update_last #Spec.Blake2S #Core.M128 update_block [@CInline] private let update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 = Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 update_multi update_last [@CInline] let update : Impl.blake2_update_st Spec.Blake2S Core.M128 = Impl.blake2_update #Spec.Blake2S #Core.M128 update_key update_blocks
{ "checked_file": "/", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Hacl.Impl.Blake2.Generic.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Blake2s_128.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Core", "short_module": "Core" }, { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Generic", "short_module": "Impl" }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Spec" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Blake2.Generic.blake2_finish_st Spec.Blake2.Definitions.Blake2S Hacl.Impl.Blake2.Core.M128
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Blake2.Generic.blake2_finish", "Spec.Blake2.Definitions.Blake2S", "Hacl.Impl.Blake2.Core.M128" ]
[]
false
false
false
true
false
let finish:Impl.blake2_finish_st Spec.Blake2S Core.M128 =
Impl.blake2_finish #Spec.Blake2S #Core.M128
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_double_fw_f_st
val lexp_double_fw_f_st : a_t: Hacl.Impl.Exponentiation.Definitions.inttype_a -> len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> Type0
let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc)))
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 89, "end_line": 68, "start_col": 0, "start_line": 22 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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_t: Hacl.Impl.Exponentiation.Definitions.inttype_a -> len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "Prims.unit", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "Lib.Buffer.live", "Lib.Buffer.MUT", "Lib.Buffer.CONST", "Lib.Buffer.disjoint", "Lib.Buffer.eq_or_disjoint", "Hacl.Bignum.Definitions.bn_v", "Prims.pow2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv_ctx", "FStar.Ghost.reveal", "Hacl.Impl.Exponentiation.Definitions.to_comm_monoid", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkconcrete_ops__item__to", "Lib.Buffer.as_seq", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv", "Lib.Buffer.modifies", "Lib.Buffer.op_Bar_Plus_Bar", "Lib.Buffer.loc", "Prims.eq2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__a_spec", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__refl", "Lib.Exponentiation.exp_double_fw_f", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__comm_monoid" ]
[]
false
false
false
false
true
let lexp_double_fw_f_st (a_t: inttype_a) (len: size_t{v len > 0}) (ctx_len: size_t) (k: concrete_ops a_t len ctx_len) (l: size_window_t a_t len) (table_len: table_len_t len) (table_inv1 table_inv2: table_inv_t a_t len table_len) =
ctx: lbuffer (uint_t a_t SEC) ctx_len -> a1: lbuffer (uint_t a_t SEC) len -> bLen: size_t -> bBits: size_t{(v bBits - 1) / bits a_t < v bLen} -> b1: lbuffer (uint_t a_t SEC) bLen -> a2: lbuffer (uint_t a_t SEC) len -> b2: lbuffer (uint_t a_t SEC) bLen -> table1: clbuffer (uint_t a_t SEC) (table_len *! len) -> table2: clbuffer (uint_t a_t SEC) (table_len *! len) -> i: size_t{v i < v bBits / v l} -> acc: lbuffer (uint_t a_t SEC) len -> tmp: lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc)))
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_double_fw_loop_st
val lexp_double_fw_loop_st : a_t: Hacl.Impl.Exponentiation.Definitions.inttype_a -> len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> Type0
let lexp_double_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc)))
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 110, "end_line": 196, "start_col": 0, "start_line": 158 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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_t: Hacl.Impl.Exponentiation.Definitions.inttype_a -> len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "Prims.unit", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "Lib.Buffer.live", "Lib.Buffer.MUT", "Lib.Buffer.CONST", "Lib.Buffer.eq_or_disjoint", "Lib.Buffer.disjoint", "Hacl.Bignum.Definitions.bn_v", "Prims.pow2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv_ctx", "FStar.Ghost.reveal", "Hacl.Impl.Exponentiation.Definitions.to_comm_monoid", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkconcrete_ops__item__to", "Lib.Buffer.as_seq", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv", "Lib.Buffer.modifies", "Lib.Buffer.loc", "Prims.eq2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__a_spec", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__refl", "Lib.LoopCombinators.repeati", "Lib.Exponentiation.exp_double_fw_f", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__comm_monoid" ]
[]
false
false
false
false
true
let lexp_double_fw_loop_st (a_t: inttype_a) (len: size_t{v len > 0}) (ctx_len: size_t) (k: concrete_ops a_t len ctx_len) (l: size_window_t a_t len) (table_len: table_len_t len) (table_inv1 table_inv2: table_inv_t a_t len table_len) =
ctx: lbuffer (uint_t a_t SEC) ctx_len -> a1: lbuffer (uint_t a_t SEC) len -> bLen: size_t -> bBits: size_t{(v bBits - 1) / bits a_t < v bLen} -> b1: lbuffer (uint_t a_t SEC) bLen -> a2: lbuffer (uint_t a_t SEC) len -> b2: lbuffer (uint_t a_t SEC) bLen -> table1: clbuffer (uint_t a_t SEC) (table_len *! len) -> table2: clbuffer (uint_t a_t SEC) (table_len *! len) -> acc: lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc)))
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_double_fw_vartime
val lexp_double_fw_vartime: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> lexp_double_fw_st a_t len ctx_len k l
val lexp_double_fw_vartime: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> lexp_double_fw_st a_t len ctx_len k l
let lexp_double_fw_vartime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_vartime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 297, "start_col": 0, "start_line": 288 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame () inline_for_extraction noextract let lexp_double_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@ inline_let] let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@inline_let] let spec (h:mem) = S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) in [@inline_let] let inv h (i:nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_double_fw_f len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp ); pop_frame () let mk_lexp_double_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res = assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res else k.lone ctx res; lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res //----------------------------------- inline_for_extraction noextract val lexp_double_fw_gen: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len{1 < v table_len /\ v table_len == pow2 (v l)} -> lprecomp_get:pow_a_to_small_b_st a_t len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) -> lexp_double_fw_st a_t len ctx_len k l #push-options "--z3rlimit 150" let lexp_double_fw_gen #a_t len ctx_len k l table_len lprecomp_get ctx a1 bLen bBits b1 a2 b2 acc = push_frame (); lemma_pow2_is_divisible_by_2 (v l); let table1 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a1 table_len table1; let h0 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h0 a1) (as_seq h0 table1)); let table2 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a2 table_len table2; let h1 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a1) (as_seq h1 table1)); assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a2) (as_seq h1 table2)); mk_lexp_double_fw_tables len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) (table_inv_precomp len ctx_len k l table_len) lprecomp_get lprecomp_get ctx a1 bLen bBits b1 a2 b2 (to_const table1) (to_const table2) acc; pop_frame () #pop-options
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Hacl.Impl.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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
len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> Hacl.Impl.MultiExponentiation.lexp_double_fw_st a_t len ctx_len k l
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Hacl.Impl.MultiExponentiation.lexp_double_fw_gen", "Hacl.Impl.Exponentiation.lprecomp_get_vartime", "Prims.unit", "Prims._assert", "Prims.l_and", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Lib.IntTypes.max_size_t", "FStar.Math.Lemmas.pow2_le_compat", "Prims.eq2", "Prims.int", "Prims.l_or", "Lib.IntTypes.range", "Prims.pow2", "Lib.IntTypes.int_t", "Lib.IntTypes.op_Less_Less_Dot", "FStar.UInt32.__uint_to_t" ]
[]
false
false
false
false
false
let lexp_double_fw_vartime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc =
[@@ inline_let ]let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_vartime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc
false
Hacl.Blake2s_128.fst
Hacl.Blake2s_128.malloc_with_key
val malloc_with_key:Impl.blake2_malloc_st Spec.Blake2S Core.M128
val malloc_with_key:Impl.blake2_malloc_st Spec.Blake2S Core.M128
let malloc_with_key : Impl.blake2_malloc_st Spec.Blake2S Core.M128 = Impl.blake2_malloc Spec.Blake2S Core.M128
{ "file_name": "code/blake2/Hacl.Blake2s_128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 43, "end_line": 43, "start_col": 0, "start_line": 42 }
module Hacl.Blake2s_128 module Spec = Spec.Blake2 module Impl = Hacl.Impl.Blake2.Generic module Core = Hacl.Impl.Blake2.Core (* Some specialized components of blake2 *) [@CInline] private let update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 = Impl.blake2_update_block #Spec.Blake2S #Core.M128 let init : Impl.blake2_init_st Spec.Blake2S Core.M128 = Impl.blake2_init #Spec.Blake2S #Core.M128 let update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 = Impl.blake2_update_key #Spec.Blake2S #Core.M128 update_block let update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 = Impl.blake2_update_multi #Spec.Blake2S #Core.M128 update_block let update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 = Impl.blake2_update_last #Spec.Blake2S #Core.M128 update_block [@CInline] private let update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 = Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 update_multi update_last [@CInline] let update : Impl.blake2_update_st Spec.Blake2S Core.M128 = Impl.blake2_update #Spec.Blake2S #Core.M128 update_key update_blocks let finish : Impl.blake2_finish_st Spec.Blake2S Core.M128 = Impl.blake2_finish #Spec.Blake2S #Core.M128 let store_state128s_to_state32: Core.store_state_st Spec.Blake2S Core.M128 = Core.store_state_to_state32 #Spec.Blake2S #Core.M128 let load_state128s_from_state32: Core.load_state_st Spec.Blake2S Core.M128 = Core.load_state_from_state32 #Spec.Blake2S #Core.M128
{ "checked_file": "/", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Hacl.Impl.Blake2.Generic.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Blake2s_128.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Core", "short_module": "Core" }, { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Generic", "short_module": "Impl" }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Spec" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Blake2.Generic.blake2_malloc_st Spec.Blake2.Definitions.Blake2S Hacl.Impl.Blake2.Core.M128
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Blake2.Generic.blake2_malloc", "Spec.Blake2.Definitions.Blake2S", "Hacl.Impl.Blake2.Core.M128" ]
[]
false
false
false
true
false
let malloc_with_key:Impl.blake2_malloc_st Spec.Blake2S Core.M128 =
Impl.blake2_malloc Spec.Blake2S Core.M128
false
Hacl.Blake2s_128.fst
Hacl.Blake2s_128.load_state128s_from_state32
val load_state128s_from_state32:Core.load_state_st Spec.Blake2S Core.M128
val load_state128s_from_state32:Core.load_state_st Spec.Blake2S Core.M128
let load_state128s_from_state32: Core.load_state_st Spec.Blake2S Core.M128 = Core.load_state_from_state32 #Spec.Blake2S #Core.M128
{ "file_name": "code/blake2/Hacl.Blake2s_128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 55, "end_line": 40, "start_col": 0, "start_line": 39 }
module Hacl.Blake2s_128 module Spec = Spec.Blake2 module Impl = Hacl.Impl.Blake2.Generic module Core = Hacl.Impl.Blake2.Core (* Some specialized components of blake2 *) [@CInline] private let update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 = Impl.blake2_update_block #Spec.Blake2S #Core.M128 let init : Impl.blake2_init_st Spec.Blake2S Core.M128 = Impl.blake2_init #Spec.Blake2S #Core.M128 let update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 = Impl.blake2_update_key #Spec.Blake2S #Core.M128 update_block let update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 = Impl.blake2_update_multi #Spec.Blake2S #Core.M128 update_block let update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 = Impl.blake2_update_last #Spec.Blake2S #Core.M128 update_block [@CInline] private let update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 = Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 update_multi update_last [@CInline] let update : Impl.blake2_update_st Spec.Blake2S Core.M128 = Impl.blake2_update #Spec.Blake2S #Core.M128 update_key update_blocks let finish : Impl.blake2_finish_st Spec.Blake2S Core.M128 = Impl.blake2_finish #Spec.Blake2S #Core.M128 let store_state128s_to_state32: Core.store_state_st Spec.Blake2S Core.M128 =
{ "checked_file": "/", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Hacl.Impl.Blake2.Generic.fst.checked", "Hacl.Impl.Blake2.Core.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Blake2s_128.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Core", "short_module": "Core" }, { "abbrev": true, "full_module": "Hacl.Impl.Blake2.Generic", "short_module": "Impl" }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Spec" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Impl.Blake2.Core.load_state_st Spec.Blake2.Definitions.Blake2S Hacl.Impl.Blake2.Core.M128
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Blake2.Core.load_state_from_state32", "Spec.Blake2.Definitions.Blake2S", "Hacl.Impl.Blake2.Core.M128" ]
[]
false
false
false
true
false
let load_state128s_from_state32:Core.load_state_st Spec.Blake2S Core.M128 =
Core.load_state_from_state32 #Spec.Blake2S #Core.M128
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_double_fw_consttime
val lexp_double_fw_consttime: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> lexp_double_fw_st a_t len ctx_len k l
val lexp_double_fw_consttime: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> lexp_double_fw_st a_t len ctx_len k l
let lexp_double_fw_consttime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_consttime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 309, "start_col": 0, "start_line": 300 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame () inline_for_extraction noextract let lexp_double_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@ inline_let] let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@inline_let] let spec (h:mem) = S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) in [@inline_let] let inv h (i:nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_double_fw_f len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp ); pop_frame () let mk_lexp_double_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res = assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res else k.lone ctx res; lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res //----------------------------------- inline_for_extraction noextract val lexp_double_fw_gen: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len{1 < v table_len /\ v table_len == pow2 (v l)} -> lprecomp_get:pow_a_to_small_b_st a_t len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) -> lexp_double_fw_st a_t len ctx_len k l #push-options "--z3rlimit 150" let lexp_double_fw_gen #a_t len ctx_len k l table_len lprecomp_get ctx a1 bLen bBits b1 a2 b2 acc = push_frame (); lemma_pow2_is_divisible_by_2 (v l); let table1 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a1 table_len table1; let h0 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h0 a1) (as_seq h0 table1)); let table2 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a2 table_len table2; let h1 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a1) (as_seq h1 table1)); assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a2) (as_seq h1 table2)); mk_lexp_double_fw_tables len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) (table_inv_precomp len ctx_len k l table_len) lprecomp_get lprecomp_get ctx a1 bLen bBits b1 a2 b2 (to_const table1) (to_const table2) acc; pop_frame () #pop-options let lexp_double_fw_vartime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_vartime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Hacl.Impl.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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
len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> Hacl.Impl.MultiExponentiation.lexp_double_fw_st a_t len ctx_len k l
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Hacl.Impl.MultiExponentiation.lexp_double_fw_gen", "Hacl.Impl.Exponentiation.lprecomp_get_consttime", "Prims.unit", "Prims._assert", "Prims.l_and", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Lib.IntTypes.max_size_t", "FStar.Math.Lemmas.pow2_le_compat", "Prims.eq2", "Prims.int", "Prims.l_or", "Lib.IntTypes.range", "Prims.pow2", "Lib.IntTypes.int_t", "Lib.IntTypes.op_Less_Less_Dot", "FStar.UInt32.__uint_to_t" ]
[]
false
false
false
false
false
let lexp_double_fw_consttime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc =
[@@ inline_let ]let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_consttime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.create_heaplets_this
val create_heaplets_this (buffers: list buffer_info) (s: state) : GTot state
val create_heaplets_this (buffers: list buffer_info) (s: state) : GTot state
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 79, "end_line": 14, "start_col": 0, "start_line": 13 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
buffers: Prims.list Vale.Arch.HeapImpl.buffer_info -> s: Vale.PPC64LE.State.state -> Prims.GTot Vale.PPC64LE.State.state
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.list", "Vale.Arch.HeapImpl.buffer_info", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Machine_s.Mkstate", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ok", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__regs", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__vecs", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__cr0", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__xer", "Vale.PPC64LE.Memory_Sems.create_heaplets", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stack", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stackTaint" ]
[]
false
false
false
false
false
let create_heaplets_this (buffers: list buffer_info) (s: state) : GTot state =
{ s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap }
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_double_fw_acc0_st
val lexp_double_fw_acc0_st : a_t: Hacl.Impl.Exponentiation.Definitions.inttype_a -> len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> Type0
let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l))
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 55, "end_line": 131, "start_col": 0, "start_line": 92 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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_t: Hacl.Impl.Exponentiation.Definitions.inttype_a -> len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.l_and", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "Prims.unit", "FStar.Monotonic.HyperStack.mem", "Prims.op_disEquality", "Prims.int", "Prims.op_Modulus", "Lib.Buffer.live", "Lib.Buffer.MUT", "Lib.Buffer.CONST", "Lib.Buffer.eq_or_disjoint", "Lib.Buffer.disjoint", "Hacl.Bignum.Definitions.bn_v", "Prims.pow2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv_ctx", "FStar.Ghost.reveal", "Hacl.Impl.Exponentiation.Definitions.to_comm_monoid", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkconcrete_ops__item__to", "Lib.Buffer.as_seq", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv", "Lib.Buffer.modifies", "Lib.Buffer.loc", "Prims.eq2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__a_spec", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__refl", "Lib.Exponentiation.exp_double_fw_acc0", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__comm_monoid" ]
[]
false
false
false
false
true
let lexp_double_fw_acc0_st (a_t: inttype_a) (len: size_t{v len > 0}) (ctx_len: size_t) (k: concrete_ops a_t len ctx_len) (l: size_window_t a_t len) (table_len: table_len_t len) (table_inv1 table_inv2: table_inv_t a_t len table_len) =
ctx: lbuffer (uint_t a_t SEC) ctx_len -> a1: lbuffer (uint_t a_t SEC) len -> bLen: size_t -> bBits: size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1: lbuffer (uint_t a_t SEC) bLen -> a2: lbuffer (uint_t a_t SEC) len -> b2: lbuffer (uint_t a_t SEC) bLen -> table1: clbuffer (uint_t a_t SEC) (table_len *! len) -> table2: clbuffer (uint_t a_t SEC) (table_len *! len) -> acc: lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l))
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_code_CreateHeaplets
val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code
val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code
let va_code_CreateHeaplets () = (Ins (S.Ghost ()))
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 20, "end_line": 25, "start_col": 0, "start_line": 24 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Vale.PPC64LE.Machine_s.Ins", "Vale.PPC64LE.Decls.ins", "Vale.PPC64LE.Decls.ocmp", "Vale.PPC64LE.Semantics_s.Ghost", "Vale.PPC64LE.Decls.va_code" ]
[]
false
false
false
true
false
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_codegen_success_CreateHeaplets
val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool
val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool
let va_codegen_success_CreateHeaplets () = (va_ttrue ())
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 15, "end_line": 29, "start_col": 0, "start_line": 28 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ()))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Vale.PPC64LE.Decls.va_ttrue", "Vale.PPC64LE.Decls.va_pbool" ]
[]
false
false
false
true
false
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.mk_lexp_double_fw_tables
val mk_lexp_double_fw_tables: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_tables_st a_t len ctx_len k l table_len table_inv1 table_inv2
val mk_lexp_double_fw_tables: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_tables_st a_t len ctx_len k l table_len table_inv1 table_inv2
let mk_lexp_double_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res = assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res else k.lone ctx res; lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 155, "end_line": 249, "start_col": 0, "start_line": 243 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame () inline_for_extraction noextract let lexp_double_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@ inline_let] let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@inline_let] let spec (h:mem) = S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) in [@inline_let] let inv h (i:nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_double_fw_f len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp ); pop_frame ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Hacl.Impl.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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
len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> pow_a_to_small_b1: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> Hacl.Impl.MultiExponentiation.lexp_double_fw_tables_st a_t len ctx_len k l table_len table_inv1 table_inv2
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Hacl.Impl.Exponentiation.pow_a_to_small_b_st", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "Hacl.Impl.MultiExponentiation.lexp_double_fw_loop", "Prims.unit", "Prims.op_disEquality", "FStar.UInt32.t", "Lib.IntTypes.op_Percent_Dot", "FStar.UInt32.__uint_to_t", "Hacl.Impl.MultiExponentiation.lexp_double_fw_acc0", "Prims.bool", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkconcrete_ops__item__lone", "Prims._assert", "Prims.eq2", "Prims.int", "Prims.op_Modulus" ]
[]
false
false
false
false
false
let mk_lexp_double_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res =
assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res else k.lone ctx res; lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_codegen_success_DestroyHeaplets
val va_codegen_success_DestroyHeaplets : va_dummy:unit -> Tot va_pbool
val va_codegen_success_DestroyHeaplets : va_dummy:unit -> Tot va_pbool
let va_codegen_success_DestroyHeaplets () = (va_ttrue ())
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 15, "end_line": 64, "start_col": 0, "start_line": 63 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- DestroyHeaplets [@ "opaque_to_smt"] let va_code_DestroyHeaplets () = (Ins (S.Ghost ()))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Vale.PPC64LE.Decls.va_ttrue", "Vale.PPC64LE.Decls.va_pbool" ]
[]
false
false
false
true
false
let va_codegen_success_DestroyHeaplets () =
(va_ttrue ())
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_code_DestroyHeaplets
val va_code_DestroyHeaplets : va_dummy:unit -> Tot va_code
val va_code_DestroyHeaplets : va_dummy:unit -> Tot va_code
let va_code_DestroyHeaplets () = (Ins (S.Ghost ()))
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 20, "end_line": 60, "start_col": 0, "start_line": 59 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- DestroyHeaplets
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Vale.PPC64LE.Machine_s.Ins", "Vale.PPC64LE.Decls.ins", "Vale.PPC64LE.Decls.ocmp", "Vale.PPC64LE.Semantics_s.Ghost", "Vale.PPC64LE.Decls.va_code" ]
[]
false
false
false
true
false
let va_code_DestroyHeaplets () =
(Ins (S.Ghost ()))
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_codegen_success_MemLoad64
val va_codegen_success_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool
val va_codegen_success_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool
let va_codegen_success_MemLoad64 h dst base offset t = (va_ttrue ())
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 15, "end_line": 97, "start_col": 0, "start_line": 96 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- DestroyHeaplets [@ "opaque_to_smt"] let va_code_DestroyHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_DestroyHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_DestroyHeaplets va_b0 va_s0 = va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let va_sM = destroy_heaplets_this va_sM in Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_DestroyHeaplets va_s0 va_k = let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- MemLoad64 [@ "opaque_to_smt"] let va_code_MemLoad64 h dst base offset t = (Ins (S.Load64 dst base offset))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: Vale.PPC64LE.Decls.va_operand_heaplet -> dst: Vale.PPC64LE.Decls.va_operand_reg_opr -> base: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> Vale.PPC64LE.Decls.va_pbool
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Decls.va_operand_heaplet", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.PPC64LE.Decls.va_ttrue", "Vale.PPC64LE.Decls.va_pbool" ]
[]
false
false
false
true
false
let va_codegen_success_MemLoad64 h dst base offset t =
(va_ttrue ())
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_code_MemLoad64
val va_code_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_code
val va_code_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_code
let va_code_MemLoad64 h dst base offset t = (Ins (S.Load64 dst base offset))
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 93, "start_col": 0, "start_line": 92 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- DestroyHeaplets [@ "opaque_to_smt"] let va_code_DestroyHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_DestroyHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_DestroyHeaplets va_b0 va_s0 = va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let va_sM = destroy_heaplets_this va_sM in Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_DestroyHeaplets va_s0 va_k = let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- MemLoad64
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: Vale.PPC64LE.Decls.va_operand_heaplet -> dst: Vale.PPC64LE.Decls.va_operand_reg_opr -> base: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> Vale.PPC64LE.Decls.va_code
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Decls.va_operand_heaplet", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.PPC64LE.Machine_s.Ins", "Vale.PPC64LE.Decls.ins", "Vale.PPC64LE.Decls.ocmp", "Vale.PPC64LE.Semantics_s.Load64", "Vale.PPC64LE.Decls.va_code" ]
[]
false
false
false
true
false
let va_code_MemLoad64 h dst base offset t =
(Ins (S.Load64 dst base offset))
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_code_MemStore64
val va_code_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_code
val va_code_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_code
let va_code_MemStore64 h src base offset t = (Ins (S.Store64 src base offset))
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 35, "end_line": 125, "start_col": 0, "start_line": 124 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- DestroyHeaplets [@ "opaque_to_smt"] let va_code_DestroyHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_DestroyHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_DestroyHeaplets va_b0 va_s0 = va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let va_sM = destroy_heaplets_this va_sM in Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_DestroyHeaplets va_s0 va_k = let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- MemLoad64 [@ "opaque_to_smt"] let va_code_MemLoad64 h dst base offset t = (Ins (S.Load64 dst base offset)) [@ "opaque_to_smt"] let va_codegen_success_MemLoad64 h dst base offset t = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index = va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl (va_sM.ms_heap)) t h; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_MemLoad64 h dst base offset t b index va_s0 va_k = let (va_sM, va_f0) = va_lemma_MemLoad64 (va_code_MemLoad64 h dst base offset t) va_s0 h dst base offset t b index in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- MemStore64
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: Vale.PPC64LE.Decls.va_operand_heaplet -> src: Vale.PPC64LE.Decls.va_operand_reg_opr -> base: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> Vale.PPC64LE.Decls.va_code
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Decls.va_operand_heaplet", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.PPC64LE.Machine_s.Ins", "Vale.PPC64LE.Decls.ins", "Vale.PPC64LE.Decls.ocmp", "Vale.PPC64LE.Semantics_s.Store64", "Vale.PPC64LE.Decls.va_code" ]
[]
false
false
false
true
false
let va_code_MemStore64 h src base offset t =
(Ins (S.Store64 src base offset))
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_codegen_success_MemStore64
val va_codegen_success_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool
val va_codegen_success_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool
let va_codegen_success_MemStore64 h src base offset t = (va_ttrue ())
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 15, "end_line": 129, "start_col": 0, "start_line": 128 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- DestroyHeaplets [@ "opaque_to_smt"] let va_code_DestroyHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_DestroyHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_DestroyHeaplets va_b0 va_s0 = va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let va_sM = destroy_heaplets_this va_sM in Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_DestroyHeaplets va_s0 va_k = let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- MemLoad64 [@ "opaque_to_smt"] let va_code_MemLoad64 h dst base offset t = (Ins (S.Load64 dst base offset)) [@ "opaque_to_smt"] let va_codegen_success_MemLoad64 h dst base offset t = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index = va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl (va_sM.ms_heap)) t h; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_MemLoad64 h dst base offset t b index va_s0 va_k = let (va_sM, va_f0) = va_lemma_MemLoad64 (va_code_MemLoad64 h dst base offset t) va_s0 h dst base offset t b index in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- MemStore64 [@ "opaque_to_smt"] let va_code_MemStore64 h src base offset t = (Ins (S.Store64 src base offset))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: Vale.PPC64LE.Decls.va_operand_heaplet -> src: Vale.PPC64LE.Decls.va_operand_reg_opr -> base: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> Vale.PPC64LE.Decls.va_pbool
Prims.Tot
[ "total" ]
[]
[ "Vale.PPC64LE.Decls.va_operand_heaplet", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.PPC64LE.Decls.va_ttrue", "Vale.PPC64LE.Decls.va_pbool" ]
[]
false
false
false
true
false
let va_codegen_success_MemStore64 h src base offset t =
(va_ttrue ())
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_four_fw_f
val lexp_four_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4
val lexp_four_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4
let lexp_four_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 i acc tmp = lexp_double_fw_f len ctx_len k l table_len table_inv3 table_inv4 pow_a_to_small_b3 pow_a_to_small_b4 ctx a3 bLen bBits b3 a4 b4 table3 table4 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 116, "end_line": 412, "start_col": 0, "start_line": 405 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame () inline_for_extraction noextract let lexp_double_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@ inline_let] let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@inline_let] let spec (h:mem) = S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) in [@inline_let] let inv h (i:nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_double_fw_f len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp ); pop_frame () let mk_lexp_double_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res = assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res else k.lone ctx res; lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res //----------------------------------- inline_for_extraction noextract val lexp_double_fw_gen: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len{1 < v table_len /\ v table_len == pow2 (v l)} -> lprecomp_get:pow_a_to_small_b_st a_t len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) -> lexp_double_fw_st a_t len ctx_len k l #push-options "--z3rlimit 150" let lexp_double_fw_gen #a_t len ctx_len k l table_len lprecomp_get ctx a1 bLen bBits b1 a2 b2 acc = push_frame (); lemma_pow2_is_divisible_by_2 (v l); let table1 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a1 table_len table1; let h0 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h0 a1) (as_seq h0 table1)); let table2 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a2 table_len table2; let h1 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a1) (as_seq h1 table1)); assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a2) (as_seq h1 table2)); mk_lexp_double_fw_tables len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) (table_inv_precomp len ctx_len k l table_len) lprecomp_get lprecomp_get ctx a1 bLen bBits b1 a2 b2 (to_const table1) (to_const table2) acc; pop_frame () #pop-options let lexp_double_fw_vartime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_vartime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc let lexp_double_fw_consttime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_consttime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc //-------------------------------------------------- inline_for_extraction noextract let lexp_four_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) (table_inv3:table_inv_t a_t len table_len) (table_inv4:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> a3:lbuffer (uint_t a_t SEC) len -> b3:lbuffer (uint_t a_t SEC) bLen -> a4:lbuffer (uint_t a_t SEC) len -> b4:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> table3:clbuffer (uint_t a_t SEC) (table_len *! len) -> table4:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp a3 /\ disjoint tmp a4 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp b3 /\ disjoint tmp b4 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ disjoint tmp table3 /\ disjoint tmp table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_four_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_four_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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
len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv3: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv4: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> pow_a_to_small_b1: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> Hacl.Impl.MultiExponentiation.lexp_four_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Hacl.Impl.Exponentiation.pow_a_to_small_b_st", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "Hacl.Impl.Exponentiation.lmul_acc_pow_a_bits_l", "Prims.unit", "Hacl.Impl.MultiExponentiation.lexp_double_fw_f" ]
[]
false
false
false
false
false
let lexp_four_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 i acc tmp =
lexp_double_fw_f len ctx_len k l table_len table_inv3 table_inv4 pow_a_to_small_b3 pow_a_to_small_b4 ctx a3 bLen bBits b3 a4 b4 table3 table4 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.destroy_heaplets_this
val destroy_heaplets_this (s: state) : Ghost state (requires state_inv s) (ensures fun _ -> True)
val destroy_heaplets_this (s: state) : Ghost state (requires state_inv s) (ensures fun _ -> True)
let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 72, "end_line": 20, "start_col": 0, "start_line": 16 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: Vale.PPC64LE.State.state -> Prims.Ghost Vale.PPC64LE.State.state
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.State.state", "Vale.PPC64LE.Machine_s.Mkstate", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ok", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__regs", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__vecs", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__cr0", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__xer", "Vale.PPC64LE.Memory_Sems.destroy_heaplets", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stack", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stackTaint", "Vale.PPC64LE.Decls.state_inv", "Prims.l_True" ]
[]
false
false
false
false
false
let destroy_heaplets_this (s: state) : Ghost state (requires state_inv s) (ensures fun _ -> True) =
{ s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap }
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.mk_lexp_four_fw_tables
val mk_lexp_four_fw_tables: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_tables_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4
val mk_lexp_four_fw_tables: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_tables_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4
let mk_lexp_four_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 res = assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_four_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 res else k.lone ctx res; lexp_four_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 res
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 74, "end_line": 647, "start_col": 0, "start_line": 632 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame () inline_for_extraction noextract let lexp_double_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@ inline_let] let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@inline_let] let spec (h:mem) = S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) in [@inline_let] let inv h (i:nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_double_fw_f len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp ); pop_frame () let mk_lexp_double_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res = assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res else k.lone ctx res; lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res //----------------------------------- inline_for_extraction noextract val lexp_double_fw_gen: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len{1 < v table_len /\ v table_len == pow2 (v l)} -> lprecomp_get:pow_a_to_small_b_st a_t len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) -> lexp_double_fw_st a_t len ctx_len k l #push-options "--z3rlimit 150" let lexp_double_fw_gen #a_t len ctx_len k l table_len lprecomp_get ctx a1 bLen bBits b1 a2 b2 acc = push_frame (); lemma_pow2_is_divisible_by_2 (v l); let table1 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a1 table_len table1; let h0 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h0 a1) (as_seq h0 table1)); let table2 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a2 table_len table2; let h1 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a1) (as_seq h1 table1)); assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a2) (as_seq h1 table2)); mk_lexp_double_fw_tables len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) (table_inv_precomp len ctx_len k l table_len) lprecomp_get lprecomp_get ctx a1 bLen bBits b1 a2 b2 (to_const table1) (to_const table2) acc; pop_frame () #pop-options let lexp_double_fw_vartime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_vartime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc let lexp_double_fw_consttime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_consttime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc //-------------------------------------------------- inline_for_extraction noextract let lexp_four_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) (table_inv3:table_inv_t a_t len table_len) (table_inv4:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> a3:lbuffer (uint_t a_t SEC) len -> b3:lbuffer (uint_t a_t SEC) bLen -> a4:lbuffer (uint_t a_t SEC) len -> b4:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> table3:clbuffer (uint_t a_t SEC) (table_len *! len) -> table4:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp a3 /\ disjoint tmp a4 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp b3 /\ disjoint tmp b4 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ disjoint tmp table3 /\ disjoint tmp table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_four_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_four_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 let lexp_four_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 i acc tmp = lexp_double_fw_f len ctx_len k l table_len table_inv3 table_inv4 pow_a_to_small_b3 pow_a_to_small_b4 ctx a3 bLen bBits b3 a4 b4 table3 table4 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_four_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) (table_inv3:table_inv_t a_t len table_len) (table_inv4:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> a3:lbuffer (uint_t a_t SEC) len -> b3:lbuffer (uint_t a_t SEC) bLen -> a4:lbuffer (uint_t a_t SEC) len -> b4:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> table3:clbuffer (uint_t a_t SEC) (table_len *! len) -> table4:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_four_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l)) inline_for_extraction noextract val lexp_four_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 let lexp_four_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc; lexp_double_fw_acc0 len ctx_len k l table_len table_inv3 table_inv4 pow_a_to_small_b3 pow_a_to_small_b4 ctx a3 bLen bBits b3 a4 b4 table3 table4 tmp; k.lmul ctx acc tmp acc; pop_frame () inline_for_extraction noextract let lexp_four_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) (table_inv3:table_inv_t a_t len table_len) (table_inv4:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> a3:lbuffer (uint_t a_t SEC) len -> b3:lbuffer (uint_t a_t SEC) bLen -> a4:lbuffer (uint_t a_t SEC) len -> b4:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> table3:clbuffer (uint_t a_t SEC) (table_len *! len) -> table4:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_four_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l)) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_four_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 let lexp_four_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@ inline_let] let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@inline_let] let spec (h:mem) = S.exp_four_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l) in [@inline_let] let inv h (i:nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_four_fw_f len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 i acc tmp ); pop_frame ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Hacl.Impl.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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
len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv3: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv4: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> pow_a_to_small_b1: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> Hacl.Impl.MultiExponentiation.lexp_four_fw_tables_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Hacl.Impl.Exponentiation.pow_a_to_small_b_st", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "Hacl.Impl.MultiExponentiation.lexp_four_fw_loop", "Prims.unit", "Prims.op_disEquality", "FStar.UInt32.t", "Lib.IntTypes.op_Percent_Dot", "FStar.UInt32.__uint_to_t", "Hacl.Impl.MultiExponentiation.lexp_four_fw_acc0", "Prims.bool", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkconcrete_ops__item__lone", "Prims._assert", "Prims.eq2", "Prims.int", "Prims.op_Modulus" ]
[]
false
false
false
false
false
let mk_lexp_four_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 res =
assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_four_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 res else k.lone ctx res; lexp_four_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 res
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_wpProof_CreateHeaplets
val va_wpProof_CreateHeaplets : buffers:(list buffer_info) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_CreateHeaplets buffers va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_CreateHeaplets : buffers:(list buffer_info) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_CreateHeaplets buffers va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_CreateHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 53, "start_col": 0, "start_line": 47 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM)
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
buffers: Prims.list Vale.Arch.HeapImpl.buffer_info -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit)
Prims.Ghost
[]
[]
[ "Prims.list", "Vale.Arch.HeapImpl.buffer_info", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Vale.PPC64LE.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Vale.PPC64LE.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_Mod_mem_layout", "Prims.Nil", "Prims._assert", "Vale.PPC64LE.Decls.va_state_eq", "Vale.PPC64LE.Decls.va_update_mem_layout", "Vale.PPC64LE.Decls.va_update_ok", "Vale.PPC64LE.Decls.va_lemma_upd_update", "FStar.Pervasives.Native.tuple3", "FStar.Pervasives.Native.tuple2", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.InsMem.va_lemma_CreateHeaplets", "Vale.PPC64LE.InsMem.va_code_CreateHeaplets" ]
[]
false
false
false
false
false
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let va_sM, va_f0 = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_wpProof_DestroyHeaplets
val va_wpProof_DestroyHeaplets : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_DestroyHeaplets va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_DestroyHeaplets : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_DestroyHeaplets va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_DestroyHeaplets ()) ([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_DestroyHeaplets va_s0 va_k = let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 86, "start_col": 0, "start_line": 80 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- DestroyHeaplets [@ "opaque_to_smt"] let va_code_DestroyHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_DestroyHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_DestroyHeaplets va_b0 va_s0 = va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let va_sM = destroy_heaplets_this va_sM in Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM)
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Vale.PPC64LE.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Vale.PPC64LE.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_Mod_mem_layout", "Prims.Nil", "Prims._assert", "Vale.PPC64LE.Decls.va_state_eq", "Vale.PPC64LE.Decls.va_update_mem_layout", "Vale.PPC64LE.Decls.va_update_ok", "Vale.PPC64LE.Decls.va_lemma_upd_update", "FStar.Pervasives.Native.tuple3", "FStar.Pervasives.Native.tuple2", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.InsMem.va_lemma_DestroyHeaplets", "Vale.PPC64LE.InsMem.va_code_DestroyHeaplets" ]
[]
false
false
false
false
false
let va_wpProof_DestroyHeaplets va_s0 va_k =
let va_sM, va_f0 = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_double_fw_acc0
val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2
val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2
let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame ()
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 154, "start_col": 0, "start_line": 148 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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
len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> pow_a_to_small_b1: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> Hacl.Impl.MultiExponentiation.lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Hacl.Impl.Exponentiation.pow_a_to_small_b_st", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.l_and", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkconcrete_ops__item__lmul", "Hacl.Impl.Exponentiation.lexp_fw_acc0", "Lib.Buffer.lbuffer_t", "Lib.Buffer.MUT", "Lib.IntTypes.int_t", "Lib.Buffer.create", "Lib.IntTypes.uint", "FStar.HyperStack.ST.push_frame" ]
[]
false
false
false
false
false
let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc =
push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame ()
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_lemma_DestroyHeaplets
val va_lemma_DestroyHeaplets : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_DestroyHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))))
val va_lemma_DestroyHeaplets : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_DestroyHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner)) (va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))))
let va_lemma_DestroyHeaplets va_b0 va_s0 = va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let va_sM = destroy_heaplets_this va_sM in Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM)
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 76, "start_col": 0, "start_line": 67 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- DestroyHeaplets [@ "opaque_to_smt"] let va_code_DestroyHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_DestroyHeaplets () = (va_ttrue ())
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.PPC64LE.Decls.va_code -> va_s0: Vale.PPC64LE.Decls.va_state -> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_code", "Vale.PPC64LE.Decls.va_state", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Lemmas.fuel", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "Prims.unit", "Vale.PPC64LE.State.use_machine_state_equal", "Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets", "Vale.PPC64LE.Decls.from_heap_impl", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.InsMem.destroy_heaplets_this", "FStar.Pervasives.Native.tuple2", "Prims.nat", "Vale.PPC64LE.Decls.va_eval_ins", "Vale.PPC64LE.Machine_s.Ins", "Vale.PPC64LE.Semantics_s.ins", "Vale.PPC64LE.Semantics_s.ocmp", "Vale.PPC64LE.Semantics_s.Ghost", "Vale.PPC64LE.Decls.va_ins_lemma", "Vale.PPC64LE.Decls.ins", "Vale.PPC64LE.Decls.ocmp", "Vale.PPC64LE.Decls.va_reveal_opaque", "Vale.PPC64LE.InsMem.va_code_DestroyHeaplets" ]
[]
false
false
false
false
false
let va_lemma_DestroyHeaplets va_b0 va_s0 =
va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ()); let va_old_s:va_state = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let va_sM, va_fM = va_eval_ins (Ins (S.Ghost ())) va_s0 in let va_sM = destroy_heaplets_this va_sM in Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap )); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM)
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_double_fw_loop
val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2
val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2
let lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@ inline_let] let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@inline_let] let spec (h:mem) = S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) in [@inline_let] let inv h (i:nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_double_fw_f len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp ); pop_frame ()
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 240, "start_col": 0, "start_line": 213 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame () inline_for_extraction noextract let lexp_double_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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
len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> pow_a_to_small_b1: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> Hacl.Impl.MultiExponentiation.lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Hacl.Impl.Exponentiation.pow_a_to_small_b_st", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Lib.Loops.for", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.op_Slash_Dot", "Prims.l_and", "Prims.op_LessThanOrEqual", "Hacl.Impl.MultiExponentiation.lexp_double_fw_f", "Lib.LoopCombinators.unfold_repeati", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__a_spec", "FStar.Ghost.reveal", "Hacl.Impl.Exponentiation.Definitions.to_comm_monoid", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkconcrete_ops__item__to", "Lib.LoopCombinators.eq_repeati0", "FStar.Monotonic.HyperStack.mem", "Prims.nat", "Prims.logical", "Lib.Buffer.modifies", "Lib.Buffer.op_Bar_Plus_Bar", "Lib.Buffer.loc", "Lib.Buffer.MUT", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv", "Lib.Buffer.as_seq", "Prims.eq2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__refl", "Lib.LoopCombinators.repeati", "Lib.Buffer.CONST", "Lib.Exponentiation.exp_double_fw_f", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__comm_monoid", "Hacl.Bignum.Definitions.bn_v", "Prims.int", "FStar.HyperStack.ST.get", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "Lib.Buffer.create", "Lib.IntTypes.uint", "FStar.HyperStack.ST.push_frame" ]
[]
false
false
false
false
false
let lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc =
push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@@ inline_let ]let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@@ inline_let ]let spec (h: mem) = S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) in [@@ inline_let ]let inv h (i: nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_double_fw_f len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp); pop_frame ()
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_lemma_CreateHeaplets
val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))))
val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==> Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\ Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) . {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))))
let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM)
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 43, "start_col": 0, "start_line": 32 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ())
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.PPC64LE.Decls.va_code -> va_s0: Vale.PPC64LE.Decls.va_state -> buffers: Prims.list Vale.Arch.HeapImpl.buffer_info -> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_code", "Vale.PPC64LE.Decls.va_state", "Prims.list", "Vale.Arch.HeapImpl.buffer_info", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Lemmas.fuel", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "Prims.unit", "Vale.PPC64LE.State.use_machine_state_equal", "Vale.PPC64LE.Memory_Sems.lemma_create_heaplets", "Vale.PPC64LE.Decls.from_heap_impl", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.InsMem.create_heaplets_this", "Vale.Lib.Seqs.lemma_list_to_seq", "FStar.Seq.Base.seq", "Vale.Lib.Seqs.list_to_seq", "FStar.Pervasives.Native.tuple2", "Prims.nat", "Vale.PPC64LE.Decls.va_eval_ins", "Vale.PPC64LE.Machine_s.Ins", "Vale.PPC64LE.Semantics_s.ins", "Vale.PPC64LE.Semantics_s.ocmp", "Vale.PPC64LE.Semantics_s.Ghost", "Vale.PPC64LE.Decls.va_ins_lemma", "Vale.PPC64LE.Decls.ins", "Vale.PPC64LE.Decls.ocmp", "Vale.PPC64LE.Decls.va_reveal_opaque", "Vale.PPC64LE.InsMem.va_code_CreateHeaplets" ]
[]
false
false
false
false
false
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let va_old_s:va_state = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let va_sM, va_fM = va_eval_ins (Ins (S.Ghost ())) va_s0 in let bs:(FStar.Seq.Base.seq buffer_info) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM)
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_wpProof_MemStore64
val va_wpProof_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_MemStore64 h src base offset t b index va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemStore64 h src base offset t) ([va_Mod_mem; va_mod_heaplet h]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_MemStore64 h src base offset t b index va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemStore64 h src base offset t) ([va_Mod_mem; va_mod_heaplet h]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_MemStore64 h src base offset t b index va_s0 va_k = let (va_sM, va_f0) = va_lemma_MemStore64 (va_code_MemStore64 h src base offset t) va_s0 h src base offset t b index in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem va_sM (va_update_ok va_sM (va_update_operand_heaplet h va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_mem; va_mod_heaplet h]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 151, "start_col": 0, "start_line": 143 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- DestroyHeaplets [@ "opaque_to_smt"] let va_code_DestroyHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_DestroyHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_DestroyHeaplets va_b0 va_s0 = va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let va_sM = destroy_heaplets_this va_sM in Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_DestroyHeaplets va_s0 va_k = let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- MemLoad64 [@ "opaque_to_smt"] let va_code_MemLoad64 h dst base offset t = (Ins (S.Load64 dst base offset)) [@ "opaque_to_smt"] let va_codegen_success_MemLoad64 h dst base offset t = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index = va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl (va_sM.ms_heap)) t h; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_MemLoad64 h dst base offset t b index va_s0 va_k = let (va_sM, va_f0) = va_lemma_MemLoad64 (va_code_MemLoad64 h dst base offset t) va_s0 h dst base offset t b index in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- MemStore64 [@ "opaque_to_smt"] let va_code_MemStore64 h src base offset t = (Ins (S.Store64 src base offset)) [@ "opaque_to_smt"] let va_codegen_success_MemStore64 h src base offset t = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_MemStore64 va_b0 va_s0 h src base offset t b index = va_reveal_opaque (`%va_code_MemStore64) (va_code_MemStore64 h src base offset t); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Store64 src base offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Store64 src base offset)) va_s0 in Vale.PPC64LE.Memory_Sems.low_lemma_store_mem64_full b index (va_eval_reg_opr va_old_s src) (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)) t h; (va_sM, va_fM)
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: Vale.PPC64LE.Decls.va_operand_heaplet -> src: Vale.PPC64LE.Decls.va_operand_reg_opr -> base: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> b: Vale.PPC64LE.Memory.buffer64 -> index: Prims.int -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_operand_heaplet", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.PPC64LE.Memory.buffer64", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Vale.PPC64LE.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Vale.PPC64LE.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_Mod_mem", "Vale.PPC64LE.QuickCode.va_mod_heaplet", "Prims.Nil", "Prims._assert", "Vale.PPC64LE.Decls.va_state_eq", "Vale.PPC64LE.Decls.va_update_mem", "Vale.PPC64LE.Decls.va_update_ok", "Vale.PPC64LE.Decls.va_update_operand_heaplet", "Vale.PPC64LE.Decls.va_lemma_upd_update", "FStar.Pervasives.Native.tuple3", "FStar.Pervasives.Native.tuple2", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.InsMem.va_lemma_MemStore64", "Vale.PPC64LE.InsMem.va_code_MemStore64" ]
[]
false
false
false
false
false
let va_wpProof_MemStore64 h src base offset t b index va_s0 va_k =
let va_sM, va_f0 = va_lemma_MemStore64 (va_code_MemStore64 h src base offset t) va_s0 h src base offset t b index in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem va_sM (va_update_ok va_sM (va_update_operand_heaplet h va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_mem; va_mod_heaplet h]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_wpProof_MemLoad64
val va_wpProof_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_MemLoad64 h dst base offset t b index va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemLoad64 h dst base offset t) ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_MemLoad64 h dst base offset t b index va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemLoad64 h dst base offset t) ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_MemLoad64 h dst base offset t b index va_s0 va_k = let (va_sM, va_f0) = va_lemma_MemLoad64 (va_code_MemLoad64 h dst base offset t) va_s0 h dst base offset t b index in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 118, "start_col": 0, "start_line": 111 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- DestroyHeaplets [@ "opaque_to_smt"] let va_code_DestroyHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_DestroyHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_DestroyHeaplets va_b0 va_s0 = va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let va_sM = destroy_heaplets_this va_sM in Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_DestroyHeaplets va_s0 va_k = let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- MemLoad64 [@ "opaque_to_smt"] let va_code_MemLoad64 h dst base offset t = (Ins (S.Load64 dst base offset)) [@ "opaque_to_smt"] let va_codegen_success_MemLoad64 h dst base offset t = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index = va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl (va_sM.ms_heap)) t h; (va_sM, va_fM)
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: Vale.PPC64LE.Decls.va_operand_heaplet -> dst: Vale.PPC64LE.Decls.va_operand_reg_opr -> base: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> b: Vale.PPC64LE.Memory.buffer64 -> index: Prims.int -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_operand_heaplet", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.PPC64LE.Memory.buffer64", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Vale.PPC64LE.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Vale.PPC64LE.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_mod_reg_opr", "Prims.Nil", "Prims._assert", "Vale.PPC64LE.Decls.va_state_eq", "Vale.PPC64LE.Decls.va_update_ok", "Vale.PPC64LE.Decls.va_update_operand_reg_opr", "Vale.PPC64LE.Decls.va_lemma_upd_update", "FStar.Pervasives.Native.tuple3", "FStar.Pervasives.Native.tuple2", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.InsMem.va_lemma_MemLoad64", "Vale.PPC64LE.InsMem.va_code_MemLoad64" ]
[]
false
false
false
false
false
let va_wpProof_MemLoad64 h dst base offset t b index va_s0 va_k =
let va_sM, va_f0 = va_lemma_MemLoad64 (va_code_MemLoad64 h dst base offset t) va_s0 h dst base offset t b index in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_lemma_MemStore64
val va_lemma_MemStore64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_MemStore64 h src base offset t) va_s0 /\ va_is_dst_heaplet h va_s0 /\ va_is_src_reg_opr src va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_dst_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) true /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_heaplet va_sM h == buffer64_write b index (va_eval_reg_opr va_s0 src) (va_eval_heaplet va_s0 h) /\ va_state_eq va_sM (va_update_mem va_sM (va_update_ok va_sM (va_update_operand_heaplet h va_sM va_s0)))))
val va_lemma_MemStore64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_MemStore64 h src base offset t) va_s0 /\ va_is_dst_heaplet h va_s0 /\ va_is_src_reg_opr src va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_dst_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) true /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_heaplet va_sM h == buffer64_write b index (va_eval_reg_opr va_s0 src) (va_eval_heaplet va_s0 h) /\ va_state_eq va_sM (va_update_mem va_sM (va_update_ok va_sM (va_update_operand_heaplet h va_sM va_s0)))))
let va_lemma_MemStore64 va_b0 va_s0 h src base offset t b index = va_reveal_opaque (`%va_code_MemStore64) (va_code_MemStore64 h src base offset t); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Store64 src base offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Store64 src base offset)) va_s0 in Vale.PPC64LE.Memory_Sems.low_lemma_store_mem64_full b index (va_eval_reg_opr va_old_s src) (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)) t h; (va_sM, va_fM)
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 139, "start_col": 0, "start_line": 132 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- DestroyHeaplets [@ "opaque_to_smt"] let va_code_DestroyHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_DestroyHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_DestroyHeaplets va_b0 va_s0 = va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let va_sM = destroy_heaplets_this va_sM in Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_DestroyHeaplets va_s0 va_k = let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- MemLoad64 [@ "opaque_to_smt"] let va_code_MemLoad64 h dst base offset t = (Ins (S.Load64 dst base offset)) [@ "opaque_to_smt"] let va_codegen_success_MemLoad64 h dst base offset t = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index = va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl (va_sM.ms_heap)) t h; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_MemLoad64 h dst base offset t b index va_s0 va_k = let (va_sM, va_f0) = va_lemma_MemLoad64 (va_code_MemLoad64 h dst base offset t) va_s0 h dst base offset t b index in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- MemStore64 [@ "opaque_to_smt"] let va_code_MemStore64 h src base offset t = (Ins (S.Store64 src base offset)) [@ "opaque_to_smt"] let va_codegen_success_MemStore64 h src base offset t = (va_ttrue ())
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.PPC64LE.Decls.va_code -> va_s0: Vale.PPC64LE.Decls.va_state -> h: Vale.PPC64LE.Decls.va_operand_heaplet -> src: Vale.PPC64LE.Decls.va_operand_reg_opr -> base: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> b: Vale.PPC64LE.Memory.buffer64 -> index: Prims.int -> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_code", "Vale.PPC64LE.Decls.va_state", "Vale.PPC64LE.Decls.va_operand_heaplet", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.PPC64LE.Memory.buffer64", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Lemmas.fuel", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "Prims.unit", "Vale.PPC64LE.Memory_Sems.low_lemma_store_mem64_full", "Vale.PPC64LE.Decls.va_eval_reg_opr", "Vale.PPC64LE.Decls.from_heap_impl", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "FStar.Pervasives.Native.tuple2", "Vale.PPC64LE.Machine_s.state", "Prims.nat", "Vale.PPC64LE.Decls.va_eval_ins", "Vale.PPC64LE.Machine_s.Ins", "Vale.PPC64LE.Semantics_s.ins", "Vale.PPC64LE.Semantics_s.ocmp", "Vale.PPC64LE.Semantics_s.Store64", "Vale.PPC64LE.Decls.va_ins_lemma", "Vale.PPC64LE.Decls.ins", "Vale.PPC64LE.Decls.ocmp", "Vale.PPC64LE.Decls.va_reveal_opaque", "Vale.PPC64LE.InsMem.va_code_MemStore64" ]
[]
false
false
false
false
false
let va_lemma_MemStore64 va_b0 va_s0 h src base offset t b index =
va_reveal_opaque (`%va_code_MemStore64) (va_code_MemStore64 h src base offset t); let va_old_s:va_state = va_s0 in va_ins_lemma (Ins (S.Store64 src base offset)) va_s0; let va_sM, va_fM = va_eval_ins (Ins (S.Store64 src base offset)) va_s0 in Vale.PPC64LE.Memory_Sems.low_lemma_store_mem64_full b index (va_eval_reg_opr va_old_s src) (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)) t h; (va_sM, va_fM)
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_double_fw_gen
val lexp_double_fw_gen: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len{1 < v table_len /\ v table_len == pow2 (v l)} -> lprecomp_get:pow_a_to_small_b_st a_t len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) -> lexp_double_fw_st a_t len ctx_len k l
val lexp_double_fw_gen: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len{1 < v table_len /\ v table_len == pow2 (v l)} -> lprecomp_get:pow_a_to_small_b_st a_t len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) -> lexp_double_fw_st a_t len ctx_len k l
let lexp_double_fw_gen #a_t len ctx_len k l table_len lprecomp_get ctx a1 bLen bBits b1 a2 b2 acc = push_frame (); lemma_pow2_is_divisible_by_2 (v l); let table1 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a1 table_len table1; let h0 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h0 a1) (as_seq h0 table1)); let table2 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a2 table_len table2; let h1 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a1) (as_seq h1 table1)); assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a2) (as_seq h1 table2)); mk_lexp_double_fw_tables len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) (table_inv_precomp len ctx_len k l table_len) lprecomp_get lprecomp_get ctx a1 bLen bBits b1 a2 b2 (to_const table1) (to_const table2) acc; pop_frame ()
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 284, "start_col": 0, "start_line": 266 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame () inline_for_extraction noextract let lexp_double_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@ inline_let] let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@inline_let] let spec (h:mem) = S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) in [@inline_let] let inv h (i:nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_double_fw_f len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp ); pop_frame () let mk_lexp_double_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res = assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res else k.lone ctx res; lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res //----------------------------------- inline_for_extraction noextract val lexp_double_fw_gen: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len{1 < v table_len /\ v table_len == pow2 (v l)} -> lprecomp_get:pow_a_to_small_b_st a_t len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) -> lexp_double_fw_st a_t len ctx_len k l
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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": 150, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len {1 < Lib.IntTypes.v table_len /\ Lib.IntTypes.v table_len == Prims.pow2 (Lib.IntTypes.v l)} -> lprecomp_get: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len (Hacl.Impl.Exponentiation.table_inv_precomp len ctx_len k l table_len) -> Hacl.Impl.MultiExponentiation.lexp_double_fw_st a_t len ctx_len k l
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Prims.l_and", "Prims.op_LessThan", "Prims.eq2", "Prims.int", "Prims.l_or", "Lib.IntTypes.range", "Prims.pow2", "Hacl.Impl.Exponentiation.pow_a_to_small_b_st", "Hacl.Impl.Exponentiation.table_inv_precomp", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Impl.MultiExponentiation.mk_lexp_double_fw_tables", "Lib.Buffer.to_const", "Lib.Buffer.MUT", "Prims._assert", "Lib.Buffer.as_seq", "Lib.IntTypes.op_Star_Bang", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Hacl.Impl.PrecompTable.lprecomp_table", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "Lib.IntTypes.mul", "Lib.Buffer.create", "Lib.IntTypes.uint", "Hacl.Impl.Exponentiation.lemma_pow2_is_divisible_by_2", "FStar.HyperStack.ST.push_frame" ]
[]
false
false
false
false
false
let lexp_double_fw_gen #a_t len ctx_len k l table_len lprecomp_get ctx a1 bLen bBits b1 a2 b2 acc =
push_frame (); lemma_pow2_is_divisible_by_2 (v l); let table1 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a1 table_len table1; let h0 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h0 a1) (as_seq h0 table1)); let table2 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a2 table_len table2; let h1 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a1) (as_seq h1 table1)); assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a2) (as_seq h1 table2)); mk_lexp_double_fw_tables len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) (table_inv_precomp len ctx_len k l table_len) lprecomp_get lprecomp_get ctx a1 bLen bBits b1 a2 b2 (to_const table1) (to_const table2) acc; pop_frame ()
false
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.InsMem.va_lemma_MemLoad64
val va_lemma_MemLoad64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_MemLoad64 h dst base offset t) va_s0 /\ va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))))
val va_lemma_MemLoad64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_MemLoad64 h dst base offset t) va_s0 /\ va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b (va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\ Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))))
let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index = va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl (va_sM.ms_heap)) t h; (va_sM, va_fM)
{ "file_name": "obj/Vale.PPC64LE.InsMem.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 107, "start_col": 0, "start_line": 100 }
module Vale.PPC64LE.InsMem open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.Arch.Heap open Vale.Arch.HeapImpl module S = Vale.PPC64LE.Semantics_s friend Vale.PPC64LE.Decls #reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state = {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} let destroy_heaplets_this (s:state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} //-- CreateHeaplets [@ "opaque_to_smt"] let va_code_CreateHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_CreateHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_CreateHeaplets va_b0 va_s0 buffers = va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers; let va_sM = create_heaplets_this buffers va_sM in Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_CreateHeaplets buffers va_s0 va_k = let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- DestroyHeaplets [@ "opaque_to_smt"] let va_code_DestroyHeaplets () = (Ins (S.Ghost ())) [@ "opaque_to_smt"] let va_codegen_success_DestroyHeaplets () = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_DestroyHeaplets va_b0 va_s0 = va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ()); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Ghost ())) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in let va_sM = destroy_heaplets_this va_sM in Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)); Vale.PPC64LE.State.use_machine_state_equal (); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_DestroyHeaplets va_s0 va_k = let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- MemLoad64 [@ "opaque_to_smt"] let va_code_MemLoad64 h dst base offset t = (Ins (S.Load64 dst base offset)) [@ "opaque_to_smt"] let va_codegen_success_MemLoad64 h dst base offset t = (va_ttrue ())
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Memory_Sems.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsMem.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.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": 2, "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": 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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.PPC64LE.Decls.va_code -> va_s0: Vale.PPC64LE.Decls.va_state -> h: Vale.PPC64LE.Decls.va_operand_heaplet -> dst: Vale.PPC64LE.Decls.va_operand_reg_opr -> base: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> b: Vale.PPC64LE.Memory.buffer64 -> index: Prims.int -> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_code", "Vale.PPC64LE.Decls.va_state", "Vale.PPC64LE.Decls.va_operand_heaplet", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.PPC64LE.Memory.buffer64", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Lemmas.fuel", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "Prims.unit", "Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full", "Vale.PPC64LE.Decls.from_heap_impl", "Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap", "FStar.Pervasives.Native.tuple2", "Vale.PPC64LE.Machine_s.state", "Prims.nat", "Vale.PPC64LE.Decls.va_eval_ins", "Vale.PPC64LE.Machine_s.Ins", "Vale.PPC64LE.Semantics_s.ins", "Vale.PPC64LE.Semantics_s.ocmp", "Vale.PPC64LE.Semantics_s.Load64", "Vale.PPC64LE.Decls.va_ins_lemma", "Vale.PPC64LE.Decls.ins", "Vale.PPC64LE.Decls.ocmp", "Vale.PPC64LE.Decls.va_reveal_opaque", "Vale.PPC64LE.InsMem.va_code_MemLoad64" ]
[]
false
false
false
false
false
let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index =
va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t); let va_old_s:va_state = va_s0 in va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0; let va_sM, va_fM = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl (va_sM.ms_heap)) t h; (va_sM, va_fM)
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_four_fw_loop_st
val lexp_four_fw_loop_st : a_t: Hacl.Impl.Exponentiation.Definitions.inttype_a -> len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv3: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv4: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> Type0
let lexp_four_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) (table_inv3:table_inv_t a_t len table_len) (table_inv4:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> a3:lbuffer (uint_t a_t SEC) len -> b3:lbuffer (uint_t a_t SEC) bLen -> a4:lbuffer (uint_t a_t SEC) len -> b4:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> table3:clbuffer (uint_t a_t SEC) (table_len *! len) -> table4:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_four_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l)) (k.to.refl (as_seq h0 acc)))
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 86, "end_line": 573, "start_col": 0, "start_line": 511 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame () inline_for_extraction noextract let lexp_double_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@ inline_let] let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@inline_let] let spec (h:mem) = S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) in [@inline_let] let inv h (i:nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_double_fw_f len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp ); pop_frame () let mk_lexp_double_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res = assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res else k.lone ctx res; lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res //----------------------------------- inline_for_extraction noextract val lexp_double_fw_gen: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len{1 < v table_len /\ v table_len == pow2 (v l)} -> lprecomp_get:pow_a_to_small_b_st a_t len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) -> lexp_double_fw_st a_t len ctx_len k l #push-options "--z3rlimit 150" let lexp_double_fw_gen #a_t len ctx_len k l table_len lprecomp_get ctx a1 bLen bBits b1 a2 b2 acc = push_frame (); lemma_pow2_is_divisible_by_2 (v l); let table1 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a1 table_len table1; let h0 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h0 a1) (as_seq h0 table1)); let table2 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a2 table_len table2; let h1 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a1) (as_seq h1 table1)); assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a2) (as_seq h1 table2)); mk_lexp_double_fw_tables len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) (table_inv_precomp len ctx_len k l table_len) lprecomp_get lprecomp_get ctx a1 bLen bBits b1 a2 b2 (to_const table1) (to_const table2) acc; pop_frame () #pop-options let lexp_double_fw_vartime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_vartime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc let lexp_double_fw_consttime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_consttime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc //-------------------------------------------------- inline_for_extraction noextract let lexp_four_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) (table_inv3:table_inv_t a_t len table_len) (table_inv4:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> a3:lbuffer (uint_t a_t SEC) len -> b3:lbuffer (uint_t a_t SEC) bLen -> a4:lbuffer (uint_t a_t SEC) len -> b4:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> table3:clbuffer (uint_t a_t SEC) (table_len *! len) -> table4:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp a3 /\ disjoint tmp a4 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp b3 /\ disjoint tmp b4 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ disjoint tmp table3 /\ disjoint tmp table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_four_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_four_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 let lexp_four_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 i acc tmp = lexp_double_fw_f len ctx_len k l table_len table_inv3 table_inv4 pow_a_to_small_b3 pow_a_to_small_b4 ctx a3 bLen bBits b3 a4 b4 table3 table4 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_four_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) (table_inv3:table_inv_t a_t len table_len) (table_inv4:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> a3:lbuffer (uint_t a_t SEC) len -> b3:lbuffer (uint_t a_t SEC) bLen -> a4:lbuffer (uint_t a_t SEC) len -> b4:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> table3:clbuffer (uint_t a_t SEC) (table_len *! len) -> table4:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_four_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l)) inline_for_extraction noextract val lexp_four_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 let lexp_four_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc; lexp_double_fw_acc0 len ctx_len k l table_len table_inv3 table_inv4 pow_a_to_small_b3 pow_a_to_small_b4 ctx a3 bLen bBits b3 a4 b4 table3 table4 tmp; k.lmul ctx acc tmp acc; pop_frame ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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_t: Hacl.Impl.Exponentiation.Definitions.inttype_a -> len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv3: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv4: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "Prims.unit", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "Lib.Buffer.live", "Lib.Buffer.MUT", "Lib.Buffer.CONST", "Lib.Buffer.eq_or_disjoint", "Lib.Buffer.disjoint", "Hacl.Bignum.Definitions.bn_v", "Prims.pow2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv_ctx", "FStar.Ghost.reveal", "Hacl.Impl.Exponentiation.Definitions.to_comm_monoid", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkconcrete_ops__item__to", "Lib.Buffer.as_seq", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv", "Lib.Buffer.modifies", "Lib.Buffer.loc", "Prims.eq2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__a_spec", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__refl", "Lib.LoopCombinators.repeati", "Lib.Exponentiation.exp_four_fw_f", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__comm_monoid" ]
[]
false
false
false
false
true
let lexp_four_fw_loop_st (a_t: inttype_a) (len: size_t{v len > 0}) (ctx_len: size_t) (k: concrete_ops a_t len ctx_len) (l: size_window_t a_t len) (table_len: table_len_t len) (table_inv1 table_inv2 table_inv3 table_inv4: table_inv_t a_t len table_len) =
ctx: lbuffer (uint_t a_t SEC) ctx_len -> a1: lbuffer (uint_t a_t SEC) len -> bLen: size_t -> bBits: size_t{(v bBits - 1) / bits a_t < v bLen} -> b1: lbuffer (uint_t a_t SEC) bLen -> a2: lbuffer (uint_t a_t SEC) len -> b2: lbuffer (uint_t a_t SEC) bLen -> a3: lbuffer (uint_t a_t SEC) len -> b3: lbuffer (uint_t a_t SEC) bLen -> a4: lbuffer (uint_t a_t SEC) len -> b4: lbuffer (uint_t a_t SEC) bLen -> table1: clbuffer (uint_t a_t SEC) (table_len *! len) -> table2: clbuffer (uint_t a_t SEC) (table_len *! len) -> table3: clbuffer (uint_t a_t SEC) (table_len *! len) -> table4: clbuffer (uint_t a_t SEC) (table_len *! len) -> acc: lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_four_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l)) (k.to.refl (as_seq h0 acc)))
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_four_fw_acc0_st
val lexp_four_fw_acc0_st : a_t: Hacl.Impl.Exponentiation.Definitions.inttype_a -> len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv3: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv4: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> Type0
let lexp_four_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) (table_inv3:table_inv_t a_t len table_len) (table_inv4:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> a3:lbuffer (uint_t a_t SEC) len -> b3:lbuffer (uint_t a_t SEC) bLen -> a4:lbuffer (uint_t a_t SEC) len -> b4:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> table3:clbuffer (uint_t a_t SEC) (table_len *! len) -> table4:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_four_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l))
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 55, "end_line": 477, "start_col": 0, "start_line": 416 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame () inline_for_extraction noextract let lexp_double_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@ inline_let] let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@inline_let] let spec (h:mem) = S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) in [@inline_let] let inv h (i:nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_double_fw_f len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp ); pop_frame () let mk_lexp_double_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res = assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res else k.lone ctx res; lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res //----------------------------------- inline_for_extraction noextract val lexp_double_fw_gen: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len{1 < v table_len /\ v table_len == pow2 (v l)} -> lprecomp_get:pow_a_to_small_b_st a_t len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) -> lexp_double_fw_st a_t len ctx_len k l #push-options "--z3rlimit 150" let lexp_double_fw_gen #a_t len ctx_len k l table_len lprecomp_get ctx a1 bLen bBits b1 a2 b2 acc = push_frame (); lemma_pow2_is_divisible_by_2 (v l); let table1 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a1 table_len table1; let h0 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h0 a1) (as_seq h0 table1)); let table2 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a2 table_len table2; let h1 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a1) (as_seq h1 table1)); assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a2) (as_seq h1 table2)); mk_lexp_double_fw_tables len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) (table_inv_precomp len ctx_len k l table_len) lprecomp_get lprecomp_get ctx a1 bLen bBits b1 a2 b2 (to_const table1) (to_const table2) acc; pop_frame () #pop-options let lexp_double_fw_vartime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_vartime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc let lexp_double_fw_consttime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_consttime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc //-------------------------------------------------- inline_for_extraction noextract let lexp_four_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) (table_inv3:table_inv_t a_t len table_len) (table_inv4:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> a3:lbuffer (uint_t a_t SEC) len -> b3:lbuffer (uint_t a_t SEC) bLen -> a4:lbuffer (uint_t a_t SEC) len -> b4:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> table3:clbuffer (uint_t a_t SEC) (table_len *! len) -> table4:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp a3 /\ disjoint tmp a4 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp b3 /\ disjoint tmp b4 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ disjoint tmp table3 /\ disjoint tmp table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_four_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_four_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 let lexp_four_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 i acc tmp = lexp_double_fw_f len ctx_len k l table_len table_inv3 table_inv4 pow_a_to_small_b3 pow_a_to_small_b4 ctx a3 bLen bBits b3 a4 b4 table3 table4 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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_t: Hacl.Impl.Exponentiation.Definitions.inttype_a -> len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv3: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv4: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.l_and", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "Prims.unit", "FStar.Monotonic.HyperStack.mem", "Prims.op_disEquality", "Prims.int", "Prims.op_Modulus", "Lib.Buffer.live", "Lib.Buffer.MUT", "Lib.Buffer.CONST", "Lib.Buffer.eq_or_disjoint", "Lib.Buffer.disjoint", "Hacl.Bignum.Definitions.bn_v", "Prims.pow2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv_ctx", "FStar.Ghost.reveal", "Hacl.Impl.Exponentiation.Definitions.to_comm_monoid", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkconcrete_ops__item__to", "Lib.Buffer.as_seq", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv", "Lib.Buffer.modifies", "Lib.Buffer.loc", "Prims.eq2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__a_spec", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__refl", "Lib.Exponentiation.exp_four_fw_acc0", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__comm_monoid" ]
[]
false
false
false
false
true
let lexp_four_fw_acc0_st (a_t: inttype_a) (len: size_t{v len > 0}) (ctx_len: size_t) (k: concrete_ops a_t len ctx_len) (l: size_window_t a_t len) (table_len: table_len_t len) (table_inv1 table_inv2 table_inv3 table_inv4: table_inv_t a_t len table_len) =
ctx: lbuffer (uint_t a_t SEC) ctx_len -> a1: lbuffer (uint_t a_t SEC) len -> bLen: size_t -> bBits: size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1: lbuffer (uint_t a_t SEC) bLen -> a2: lbuffer (uint_t a_t SEC) len -> b2: lbuffer (uint_t a_t SEC) bLen -> a3: lbuffer (uint_t a_t SEC) len -> b3: lbuffer (uint_t a_t SEC) bLen -> a4: lbuffer (uint_t a_t SEC) len -> b4: lbuffer (uint_t a_t SEC) bLen -> table1: clbuffer (uint_t a_t SEC) (table_len *! len) -> table2: clbuffer (uint_t a_t SEC) (table_len *! len) -> table3: clbuffer (uint_t a_t SEC) (table_len *! len) -> table4: clbuffer (uint_t a_t SEC) (table_len *! len) -> acc: lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_four_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l))
false
Vale.AES.GF128_s.fsti
Vale.AES.GF128_s.gf128_modulus_low_terms
val gf128_modulus_low_terms:poly
val gf128_modulus_low_terms:poly
let gf128_modulus_low_terms : poly = of_fun 8 (fun (i:nat) -> i = 0 || i = 1 || i = 2 || i = 7)
{ "file_name": "vale/specs/crypto/Vale.AES.GF128_s.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 95, "end_line": 9, "start_col": 0, "start_line": 9 }
module Vale.AES.GF128_s open FStar.Mul open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open FStar.Seq open Vale.Def.Types_s
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.AES.GF128_s.fsti" }
[ { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "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
Vale.Math.Poly2_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2_s.of_fun", "Prims.nat", "Prims.op_BarBar", "Prims.op_Equality", "Prims.int", "Prims.bool" ]
[]
false
false
false
true
false
let gf128_modulus_low_terms:poly =
of_fun 8 (fun (i: nat) -> i = 0 || i = 1 || i = 2 || i = 7)
false
Vale.AES.GF128_s.fsti
Vale.AES.GF128_s.gf128_modulus
val gf128_modulus:poly
val gf128_modulus:poly
let gf128_modulus : poly = add (monomial 128) gf128_modulus_low_terms
{ "file_name": "vale/specs/crypto/Vale.AES.GF128_s.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 69, "end_line": 12, "start_col": 0, "start_line": 12 }
module Vale.AES.GF128_s open FStar.Mul open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open FStar.Seq open Vale.Def.Types_s // x^7 + x^2 + x + 1 let gf128_modulus_low_terms : poly = of_fun 8 (fun (i:nat) -> i = 0 || i = 1 || i = 2 || i = 7)
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.AES.GF128_s.fsti" }
[ { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "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
Vale.Math.Poly2_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2_s.add", "Vale.Math.Poly2_s.monomial", "Vale.AES.GF128_s.gf128_modulus_low_terms" ]
[]
false
false
false
true
false
let gf128_modulus:poly =
add (monomial 128) gf128_modulus_low_terms
false
Vale.AES.GF128_s.fsti
Vale.AES.GF128_s.gf128_add
val gf128_add (a b: poly) : poly
val gf128_add (a b: poly) : poly
let gf128_add (a b:poly) : poly = add a b
{ "file_name": "vale/specs/crypto/Vale.AES.GF128_s.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 41, "end_line": 14, "start_col": 0, "start_line": 14 }
module Vale.AES.GF128_s open FStar.Mul open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open FStar.Seq open Vale.Def.Types_s // x^7 + x^2 + x + 1 let gf128_modulus_low_terms : poly = of_fun 8 (fun (i:nat) -> i = 0 || i = 1 || i = 2 || i = 7) // x^128 + x^7 + x^2 + x + 1 let gf128_modulus : poly = add (monomial 128) gf128_modulus_low_terms
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.AES.GF128_s.fsti" }
[ { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "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
a: Vale.Math.Poly2_s.poly -> b: Vale.Math.Poly2_s.poly -> Vale.Math.Poly2_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2_s.poly", "Vale.Math.Poly2_s.add" ]
[]
false
false
false
true
false
let gf128_add (a b: poly) : poly =
add a b
false
Hacl.K256.PrecompTable.fst
Hacl.K256.PrecompTable.precomp_g_pow2_128_table_lseq_w4
val precomp_g_pow2_128_table_lseq_w4 : LSeq.lseq uint64 240
val precomp_g_pow2_128_table_lseq_w4 : LSeq.lseq uint64 240
let precomp_g_pow2_128_table_lseq_w4 : LSeq.lseq uint64 240 = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_128 15); Seq.seq_of_list precomp_g_pow2_128_table_list_w4
{ "file_name": "code/k256/Hacl.K256.PrecompTable.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 50, "end_line": 245, "start_col": 0, "start_line": 243 }
module Hacl.K256.PrecompTable open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module LE = Lib.Exponentiation module SE = Spec.Exponentiation module SPT = Hacl.Spec.PrecompBaseTable module SPT256 = Hacl.Spec.PrecompBaseTable256 module SPTK = Hacl.Spec.K256.PrecompTable module S = Spec.K256 module SL = Spec.K256.Lemmas open Hacl.Impl.K256.Point include Hacl.Impl.K256.Group #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let proj_point_to_list p = SPTK.proj_point_to_list_lemma p; SPTK.proj_point_to_list p let lemma_refl x = SPTK.proj_point_to_list_lemma x //----------------- inline_for_extraction noextract let proj_g_pow2_64 : S.proj_point = [@inline_let] let rX : S.felem = 0x46ec0aa60b0b98c37b29371784676ad967b7beb1a941ddb6fbbff95b44cb788b in [@inline_let] let rY : S.felem = 0x6b946755bbc6b677576579c990a1ccf14a710545251a1428fabbf02f40268e63 in [@inline_let] let rZ : S.felem = 0x3c114b2ac17c199ec9eba9f7cc64dc459ca2e53f5bbead2b4e618b318ffcc00e in (rX, rY, rZ) val lemma_proj_g_pow2_64_eval : unit -> Lemma (SE.exp_pow2 S.mk_k256_concrete_ops S.g 64 == proj_g_pow2_64) let lemma_proj_g_pow2_64_eval () = SPT256.exp_pow2_rec_is_exp_pow2 S.mk_k256_concrete_ops S.g 64; let qX, qY, qZ = normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops S.g 64) in normalize_term_spec (SPT256.exp_pow2_rec S.mk_k256_concrete_ops S.g 64); let rX : S.felem = 0x46ec0aa60b0b98c37b29371784676ad967b7beb1a941ddb6fbbff95b44cb788b in let rY : S.felem = 0x6b946755bbc6b677576579c990a1ccf14a710545251a1428fabbf02f40268e63 in let rZ : S.felem = 0x3c114b2ac17c199ec9eba9f7cc64dc459ca2e53f5bbead2b4e618b318ffcc00e in assert_norm (qX == rX /\ qY == rY /\ qZ == rZ) inline_for_extraction noextract let proj_g_pow2_128 : S.proj_point = [@inline_let] let rX : S.felem = 0x98299efbc8e459915404ae015b48cac3b929e0158665f3c7fa5489fbd25c4297 in [@inline_let] let rY : S.felem = 0xf1e5cbc9579e7d11a31681e947c2959ae0298a006d1c06ab1ad93d6716ea50cc in [@inline_let] let rZ : S.felem = 0x5c53ffe15001674a2eacb60c9327a8b0ddbd93a0fa6d90309de6cc124133938b in (rX, rY, rZ) val lemma_proj_g_pow2_128_eval : unit -> Lemma (SE.exp_pow2 S.mk_k256_concrete_ops proj_g_pow2_64 64 == proj_g_pow2_128) let lemma_proj_g_pow2_128_eval () = SPT256.exp_pow2_rec_is_exp_pow2 S.mk_k256_concrete_ops proj_g_pow2_64 64; let qX, qY, qZ = normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_64 64) in normalize_term_spec (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_64 64); let rX : S.felem = 0x98299efbc8e459915404ae015b48cac3b929e0158665f3c7fa5489fbd25c4297 in let rY : S.felem = 0xf1e5cbc9579e7d11a31681e947c2959ae0298a006d1c06ab1ad93d6716ea50cc in let rZ : S.felem = 0x5c53ffe15001674a2eacb60c9327a8b0ddbd93a0fa6d90309de6cc124133938b in assert_norm (qX == rX /\ qY == rY /\ qZ == rZ) inline_for_extraction noextract let proj_g_pow2_192 : S.proj_point = [@inline_let] let rX : S.felem = 0xbd382b67d20492b1480ca58a6d7d617ba413a9bc7c2f1cff51301ef960fb245c in [@inline_let] let rY : S.felem = 0x0b232afcf692673aa714357c524c07867a64ea3b9dfab53f0e74622159e86b0d in [@inline_let] let rZ : S.felem = 0x028a1380449aede5df8219420b458d464a6a4773ac91e8305237878cef1cffa6 in (rX, rY, rZ) val lemma_proj_g_pow2_192_eval : unit -> Lemma (SE.exp_pow2 S.mk_k256_concrete_ops proj_g_pow2_128 64 == proj_g_pow2_192) let lemma_proj_g_pow2_192_eval () = SPT256.exp_pow2_rec_is_exp_pow2 S.mk_k256_concrete_ops proj_g_pow2_128 64; let qX, qY, qZ = normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_128 64) in normalize_term_spec (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_128 64); let rX : S.felem = 0xbd382b67d20492b1480ca58a6d7d617ba413a9bc7c2f1cff51301ef960fb245c in let rY : S.felem = 0x0b232afcf692673aa714357c524c07867a64ea3b9dfab53f0e74622159e86b0d in let rZ : S.felem = 0x028a1380449aede5df8219420b458d464a6a4773ac91e8305237878cef1cffa6 in assert_norm (qX == rX /\ qY == rY /\ qZ == rZ) // let proj_g_pow2_64 : S.proj_point = // normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops S.g 64) // let proj_g_pow2_128 : S.proj_point = // normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_64 64) // let proj_g_pow2_192 : S.proj_point = // normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_128 64) inline_for_extraction noextract let proj_g_pow2_64_list : SPTK.point_list = normalize_term (SPTK.proj_point_to_list proj_g_pow2_64) inline_for_extraction noextract let proj_g_pow2_128_list : SPTK.point_list = normalize_term (SPTK.proj_point_to_list proj_g_pow2_128) inline_for_extraction noextract let proj_g_pow2_192_list : SPTK.point_list = normalize_term (SPTK.proj_point_to_list proj_g_pow2_192) let proj_g_pow2_64_lseq : LSeq.lseq uint64 15 = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_64); Seq.seq_of_list proj_g_pow2_64_list let proj_g_pow2_128_lseq : LSeq.lseq uint64 15 = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_128); Seq.seq_of_list proj_g_pow2_128_list let proj_g_pow2_192_lseq : LSeq.lseq uint64 15 = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_192); Seq.seq_of_list proj_g_pow2_192_list val proj_g_pow2_64_lemma: unit -> Lemma (S.to_aff_point proj_g_pow2_64 == pow_point (pow2 64) g_aff) let proj_g_pow2_64_lemma () = lemma_proj_g_pow2_64_eval (); SPT256.a_pow2_64_lemma S.mk_k256_concrete_ops S.g val proj_g_pow2_128_lemma: unit -> Lemma (S.to_aff_point proj_g_pow2_128 == pow_point (pow2 128) g_aff) let proj_g_pow2_128_lemma () = lemma_proj_g_pow2_128_eval (); lemma_proj_g_pow2_64_eval (); SPT256.a_pow2_128_lemma S.mk_k256_concrete_ops S.g val proj_g_pow2_192_lemma: unit -> Lemma (S.to_aff_point proj_g_pow2_192 == pow_point (pow2 192) g_aff) let proj_g_pow2_192_lemma () = lemma_proj_g_pow2_192_eval (); lemma_proj_g_pow2_128_eval (); lemma_proj_g_pow2_64_eval (); SPT256.a_pow2_192_lemma S.mk_k256_concrete_ops S.g let proj_g_pow2_64_lseq_lemma () = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_64); proj_g_pow2_64_lemma (); SPTK.proj_point_to_list_lemma proj_g_pow2_64 let proj_g_pow2_128_lseq_lemma () = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_128); proj_g_pow2_128_lemma (); SPTK.proj_point_to_list_lemma proj_g_pow2_128 let proj_g_pow2_192_lseq_lemma () = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_192); proj_g_pow2_192_lemma (); SPTK.proj_point_to_list_lemma proj_g_pow2_192 let mk_proj_g_pow2_64 () = createL proj_g_pow2_64_list let mk_proj_g_pow2_128 () = createL proj_g_pow2_128_list let mk_proj_g_pow2_192 () = createL proj_g_pow2_192_list //---------------- /// window size = 4; precomputed table = [[0]G, [1]G, ..., [15]G] inline_for_extraction noextract let precomp_basepoint_table_list_w4: x:list uint64{FStar.List.Tot.length x = 240} = normalize_term (SPT.precomp_base_table_list mk_k256_precomp_base_table S.g 15) let precomp_basepoint_table_lseq_w4 : LSeq.lseq uint64 240 = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table S.g 15); Seq.seq_of_list precomp_basepoint_table_list_w4 let precomp_basepoint_table_lemma_w4 () = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table S.g 15); SPT.precomp_base_table_lemma mk_k256_precomp_base_table S.g 16 precomp_basepoint_table_lseq_w4 let precomp_basepoint_table_w4: x:glbuffer uint64 240ul{witnessed x precomp_basepoint_table_lseq_w4 /\ recallable x} = createL_global precomp_basepoint_table_list_w4 /// window size = 4; precomputed table = [[0]([pow2 64]G), [1]([pow2 64]G), ..., [15]([pow2 64]G)] inline_for_extraction noextract let precomp_g_pow2_64_table_list_w4: x:list uint64{FStar.List.Tot.length x = 240} = normalize_term (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_64 15) let precomp_g_pow2_64_table_lseq_w4 : LSeq.lseq uint64 240 = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_64 15); Seq.seq_of_list precomp_g_pow2_64_table_list_w4 let precomp_g_pow2_64_table_lemma_w4 () = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_64 15); SPT.precomp_base_table_lemma mk_k256_precomp_base_table proj_g_pow2_64 16 precomp_g_pow2_64_table_lseq_w4; proj_g_pow2_64_lemma () let precomp_g_pow2_64_table_w4: x:glbuffer uint64 240ul{witnessed x precomp_g_pow2_64_table_lseq_w4 /\ recallable x} = createL_global precomp_g_pow2_64_table_list_w4 /// window size = 4; precomputed table = [[0]([pow2 128]G), [1]([pow2 128]G),...,[15]([pow2 128]G)] inline_for_extraction noextract let precomp_g_pow2_128_table_list_w4: x:list uint64{FStar.List.Tot.length x = 240} = normalize_term (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_128 15)
{ "checked_file": "/", "dependencies": [ "Spec.K256.Lemmas.fsti.checked", "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.PrecompBaseTable256.fsti.checked", "Hacl.Spec.PrecompBaseTable.fsti.checked", "Hacl.Spec.K256.PrecompTable.fsti.checked", "Hacl.Impl.K256.Point.fsti.checked", "Hacl.Impl.K256.Group.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.K256.PrecompTable.fst" }
[ { "abbrev": true, "full_module": "Spec.K256.Lemmas", "short_module": "SL" }, { "abbrev": true, "full_module": "Hacl.Spec.K256.PrecompTable", "short_module": "SPTK" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable256", "short_module": "SPT256" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Impl.K256.Group", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.K256.Point", "short_module": null }, { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable", "short_module": "SPT" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation.Definitions", "short_module": "BE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.K256", "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
Lib.Sequence.lseq Lib.IntTypes.uint64 240
Prims.Tot
[ "total" ]
[]
[ "FStar.Seq.Base.seq_of_list", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Hacl.K256.PrecompTable.precomp_g_pow2_128_table_list_w4", "Prims.unit", "FStar.Pervasives.normalize_term_spec", "Prims.list", "Lib.IntTypes.uint_t", "Prims.b2t", "Prims.op_Equality", "Prims.int", "FStar.List.Tot.Base.length", "FStar.Mul.op_Star", "Prims.op_Addition", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "FStar.UInt32.uint_to_t", "Hacl.Spec.PrecompBaseTable.precomp_base_table_list", "Spec.K256.PointOps.proj_point", "Hacl.K256.PrecompTable.mk_k256_precomp_base_table", "Hacl.K256.PrecompTable.proj_g_pow2_128", "Lib.Sequence.lseq", "Lib.IntTypes.uint64" ]
[]
false
false
false
false
false
let precomp_g_pow2_128_table_lseq_w4:LSeq.lseq uint64 240 =
normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_128 15); Seq.seq_of_list precomp_g_pow2_128_table_list_w4
false
Vale.AES.GF128_s.fsti
Vale.AES.GF128_s.gf128_to_quad32
val gf128_to_quad32 (a: poly) : quad32
val gf128_to_quad32 (a: poly) : quad32
let gf128_to_quad32 (a:poly) : quad32 = to_quad32 (reverse a 127)
{ "file_name": "vale/specs/crypto/Vale.AES.GF128_s.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 65, "end_line": 17, "start_col": 0, "start_line": 17 }
module Vale.AES.GF128_s open FStar.Mul open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open FStar.Seq open Vale.Def.Types_s // x^7 + x^2 + x + 1 let gf128_modulus_low_terms : poly = of_fun 8 (fun (i:nat) -> i = 0 || i = 1 || i = 2 || i = 7) // x^128 + x^7 + x^2 + x + 1 let gf128_modulus : poly = add (monomial 128) gf128_modulus_low_terms let gf128_add (a b:poly) : poly = add a b let gf128_mul (a b:poly) : poly = mod (mul a b) gf128_modulus
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.AES.GF128_s.fsti" }
[ { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "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
a: Vale.Math.Poly2_s.poly -> Vale.Def.Types_s.quad32
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2_s.poly", "Vale.Math.Poly2.Bits_s.to_quad32", "Vale.Math.Poly2_s.reverse", "Vale.Def.Types_s.quad32" ]
[]
false
false
false
true
false
let gf128_to_quad32 (a: poly) : quad32 =
to_quad32 (reverse a 127)
false
Vale.AES.GF128_s.fsti
Vale.AES.GF128_s.gf128_mul
val gf128_mul (a b: poly) : poly
val gf128_mul (a b: poly) : poly
let gf128_mul (a b:poly) : poly = mod (mul a b) gf128_modulus
{ "file_name": "vale/specs/crypto/Vale.AES.GF128_s.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 61, "end_line": 15, "start_col": 0, "start_line": 15 }
module Vale.AES.GF128_s open FStar.Mul open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open FStar.Seq open Vale.Def.Types_s // x^7 + x^2 + x + 1 let gf128_modulus_low_terms : poly = of_fun 8 (fun (i:nat) -> i = 0 || i = 1 || i = 2 || i = 7) // x^128 + x^7 + x^2 + x + 1 let gf128_modulus : poly = add (monomial 128) gf128_modulus_low_terms
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.AES.GF128_s.fsti" }
[ { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "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
a: Vale.Math.Poly2_s.poly -> b: Vale.Math.Poly2_s.poly -> Vale.Math.Poly2_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2_s.poly", "Vale.Math.Poly2_s.mod", "Vale.Math.Poly2_s.mul", "Vale.AES.GF128_s.gf128_modulus" ]
[]
false
false
false
true
false
let gf128_mul (a b: poly) : poly =
mod (mul a b) gf128_modulus
false
Vale.AES.GF128_s.fsti
Vale.AES.GF128_s.gf128_of_quad32
val gf128_of_quad32 (q: quad32) : poly
val gf128_of_quad32 (q: quad32) : poly
let gf128_of_quad32 (q:quad32) : poly = reverse (of_quad32 q) 127
{ "file_name": "vale/specs/crypto/Vale.AES.GF128_s.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 65, "end_line": 18, "start_col": 0, "start_line": 18 }
module Vale.AES.GF128_s open FStar.Mul open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open FStar.Seq open Vale.Def.Types_s // x^7 + x^2 + x + 1 let gf128_modulus_low_terms : poly = of_fun 8 (fun (i:nat) -> i = 0 || i = 1 || i = 2 || i = 7) // x^128 + x^7 + x^2 + x + 1 let gf128_modulus : poly = add (monomial 128) gf128_modulus_low_terms let gf128_add (a b:poly) : poly = add a b let gf128_mul (a b:poly) : poly = mod (mul a b) gf128_modulus
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.AES.GF128_s.fsti" }
[ { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "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
q: Vale.Def.Types_s.quad32 -> Vale.Math.Poly2_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Def.Types_s.quad32", "Vale.Math.Poly2_s.reverse", "Vale.Math.Poly2.Bits_s.of_quad32", "Vale.Math.Poly2_s.poly" ]
[]
false
false
false
true
false
let gf128_of_quad32 (q: quad32) : poly =
reverse (of_quad32 q) 127
false
Hacl.K256.PrecompTable.fst
Hacl.K256.PrecompTable.precomp_g_pow2_192_table_list_w4
val precomp_g_pow2_192_table_list_w4:x: list uint64 {FStar.List.Tot.length x = 240}
val precomp_g_pow2_192_table_list_w4:x: list uint64 {FStar.List.Tot.length x = 240}
let precomp_g_pow2_192_table_list_w4: x:list uint64{FStar.List.Tot.length x = 240} = normalize_term (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_192 15)
{ "file_name": "code/k256/Hacl.K256.PrecompTable.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 92, "end_line": 262, "start_col": 0, "start_line": 261 }
module Hacl.K256.PrecompTable open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module LE = Lib.Exponentiation module SE = Spec.Exponentiation module SPT = Hacl.Spec.PrecompBaseTable module SPT256 = Hacl.Spec.PrecompBaseTable256 module SPTK = Hacl.Spec.K256.PrecompTable module S = Spec.K256 module SL = Spec.K256.Lemmas open Hacl.Impl.K256.Point include Hacl.Impl.K256.Group #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let proj_point_to_list p = SPTK.proj_point_to_list_lemma p; SPTK.proj_point_to_list p let lemma_refl x = SPTK.proj_point_to_list_lemma x //----------------- inline_for_extraction noextract let proj_g_pow2_64 : S.proj_point = [@inline_let] let rX : S.felem = 0x46ec0aa60b0b98c37b29371784676ad967b7beb1a941ddb6fbbff95b44cb788b in [@inline_let] let rY : S.felem = 0x6b946755bbc6b677576579c990a1ccf14a710545251a1428fabbf02f40268e63 in [@inline_let] let rZ : S.felem = 0x3c114b2ac17c199ec9eba9f7cc64dc459ca2e53f5bbead2b4e618b318ffcc00e in (rX, rY, rZ) val lemma_proj_g_pow2_64_eval : unit -> Lemma (SE.exp_pow2 S.mk_k256_concrete_ops S.g 64 == proj_g_pow2_64) let lemma_proj_g_pow2_64_eval () = SPT256.exp_pow2_rec_is_exp_pow2 S.mk_k256_concrete_ops S.g 64; let qX, qY, qZ = normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops S.g 64) in normalize_term_spec (SPT256.exp_pow2_rec S.mk_k256_concrete_ops S.g 64); let rX : S.felem = 0x46ec0aa60b0b98c37b29371784676ad967b7beb1a941ddb6fbbff95b44cb788b in let rY : S.felem = 0x6b946755bbc6b677576579c990a1ccf14a710545251a1428fabbf02f40268e63 in let rZ : S.felem = 0x3c114b2ac17c199ec9eba9f7cc64dc459ca2e53f5bbead2b4e618b318ffcc00e in assert_norm (qX == rX /\ qY == rY /\ qZ == rZ) inline_for_extraction noextract let proj_g_pow2_128 : S.proj_point = [@inline_let] let rX : S.felem = 0x98299efbc8e459915404ae015b48cac3b929e0158665f3c7fa5489fbd25c4297 in [@inline_let] let rY : S.felem = 0xf1e5cbc9579e7d11a31681e947c2959ae0298a006d1c06ab1ad93d6716ea50cc in [@inline_let] let rZ : S.felem = 0x5c53ffe15001674a2eacb60c9327a8b0ddbd93a0fa6d90309de6cc124133938b in (rX, rY, rZ) val lemma_proj_g_pow2_128_eval : unit -> Lemma (SE.exp_pow2 S.mk_k256_concrete_ops proj_g_pow2_64 64 == proj_g_pow2_128) let lemma_proj_g_pow2_128_eval () = SPT256.exp_pow2_rec_is_exp_pow2 S.mk_k256_concrete_ops proj_g_pow2_64 64; let qX, qY, qZ = normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_64 64) in normalize_term_spec (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_64 64); let rX : S.felem = 0x98299efbc8e459915404ae015b48cac3b929e0158665f3c7fa5489fbd25c4297 in let rY : S.felem = 0xf1e5cbc9579e7d11a31681e947c2959ae0298a006d1c06ab1ad93d6716ea50cc in let rZ : S.felem = 0x5c53ffe15001674a2eacb60c9327a8b0ddbd93a0fa6d90309de6cc124133938b in assert_norm (qX == rX /\ qY == rY /\ qZ == rZ) inline_for_extraction noextract let proj_g_pow2_192 : S.proj_point = [@inline_let] let rX : S.felem = 0xbd382b67d20492b1480ca58a6d7d617ba413a9bc7c2f1cff51301ef960fb245c in [@inline_let] let rY : S.felem = 0x0b232afcf692673aa714357c524c07867a64ea3b9dfab53f0e74622159e86b0d in [@inline_let] let rZ : S.felem = 0x028a1380449aede5df8219420b458d464a6a4773ac91e8305237878cef1cffa6 in (rX, rY, rZ) val lemma_proj_g_pow2_192_eval : unit -> Lemma (SE.exp_pow2 S.mk_k256_concrete_ops proj_g_pow2_128 64 == proj_g_pow2_192) let lemma_proj_g_pow2_192_eval () = SPT256.exp_pow2_rec_is_exp_pow2 S.mk_k256_concrete_ops proj_g_pow2_128 64; let qX, qY, qZ = normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_128 64) in normalize_term_spec (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_128 64); let rX : S.felem = 0xbd382b67d20492b1480ca58a6d7d617ba413a9bc7c2f1cff51301ef960fb245c in let rY : S.felem = 0x0b232afcf692673aa714357c524c07867a64ea3b9dfab53f0e74622159e86b0d in let rZ : S.felem = 0x028a1380449aede5df8219420b458d464a6a4773ac91e8305237878cef1cffa6 in assert_norm (qX == rX /\ qY == rY /\ qZ == rZ) // let proj_g_pow2_64 : S.proj_point = // normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops S.g 64) // let proj_g_pow2_128 : S.proj_point = // normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_64 64) // let proj_g_pow2_192 : S.proj_point = // normalize_term (SPT256.exp_pow2_rec S.mk_k256_concrete_ops proj_g_pow2_128 64) inline_for_extraction noextract let proj_g_pow2_64_list : SPTK.point_list = normalize_term (SPTK.proj_point_to_list proj_g_pow2_64) inline_for_extraction noextract let proj_g_pow2_128_list : SPTK.point_list = normalize_term (SPTK.proj_point_to_list proj_g_pow2_128) inline_for_extraction noextract let proj_g_pow2_192_list : SPTK.point_list = normalize_term (SPTK.proj_point_to_list proj_g_pow2_192) let proj_g_pow2_64_lseq : LSeq.lseq uint64 15 = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_64); Seq.seq_of_list proj_g_pow2_64_list let proj_g_pow2_128_lseq : LSeq.lseq uint64 15 = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_128); Seq.seq_of_list proj_g_pow2_128_list let proj_g_pow2_192_lseq : LSeq.lseq uint64 15 = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_192); Seq.seq_of_list proj_g_pow2_192_list val proj_g_pow2_64_lemma: unit -> Lemma (S.to_aff_point proj_g_pow2_64 == pow_point (pow2 64) g_aff) let proj_g_pow2_64_lemma () = lemma_proj_g_pow2_64_eval (); SPT256.a_pow2_64_lemma S.mk_k256_concrete_ops S.g val proj_g_pow2_128_lemma: unit -> Lemma (S.to_aff_point proj_g_pow2_128 == pow_point (pow2 128) g_aff) let proj_g_pow2_128_lemma () = lemma_proj_g_pow2_128_eval (); lemma_proj_g_pow2_64_eval (); SPT256.a_pow2_128_lemma S.mk_k256_concrete_ops S.g val proj_g_pow2_192_lemma: unit -> Lemma (S.to_aff_point proj_g_pow2_192 == pow_point (pow2 192) g_aff) let proj_g_pow2_192_lemma () = lemma_proj_g_pow2_192_eval (); lemma_proj_g_pow2_128_eval (); lemma_proj_g_pow2_64_eval (); SPT256.a_pow2_192_lemma S.mk_k256_concrete_ops S.g let proj_g_pow2_64_lseq_lemma () = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_64); proj_g_pow2_64_lemma (); SPTK.proj_point_to_list_lemma proj_g_pow2_64 let proj_g_pow2_128_lseq_lemma () = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_128); proj_g_pow2_128_lemma (); SPTK.proj_point_to_list_lemma proj_g_pow2_128 let proj_g_pow2_192_lseq_lemma () = normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_192); proj_g_pow2_192_lemma (); SPTK.proj_point_to_list_lemma proj_g_pow2_192 let mk_proj_g_pow2_64 () = createL proj_g_pow2_64_list let mk_proj_g_pow2_128 () = createL proj_g_pow2_128_list let mk_proj_g_pow2_192 () = createL proj_g_pow2_192_list //---------------- /// window size = 4; precomputed table = [[0]G, [1]G, ..., [15]G] inline_for_extraction noextract let precomp_basepoint_table_list_w4: x:list uint64{FStar.List.Tot.length x = 240} = normalize_term (SPT.precomp_base_table_list mk_k256_precomp_base_table S.g 15) let precomp_basepoint_table_lseq_w4 : LSeq.lseq uint64 240 = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table S.g 15); Seq.seq_of_list precomp_basepoint_table_list_w4 let precomp_basepoint_table_lemma_w4 () = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table S.g 15); SPT.precomp_base_table_lemma mk_k256_precomp_base_table S.g 16 precomp_basepoint_table_lseq_w4 let precomp_basepoint_table_w4: x:glbuffer uint64 240ul{witnessed x precomp_basepoint_table_lseq_w4 /\ recallable x} = createL_global precomp_basepoint_table_list_w4 /// window size = 4; precomputed table = [[0]([pow2 64]G), [1]([pow2 64]G), ..., [15]([pow2 64]G)] inline_for_extraction noextract let precomp_g_pow2_64_table_list_w4: x:list uint64{FStar.List.Tot.length x = 240} = normalize_term (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_64 15) let precomp_g_pow2_64_table_lseq_w4 : LSeq.lseq uint64 240 = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_64 15); Seq.seq_of_list precomp_g_pow2_64_table_list_w4 let precomp_g_pow2_64_table_lemma_w4 () = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_64 15); SPT.precomp_base_table_lemma mk_k256_precomp_base_table proj_g_pow2_64 16 precomp_g_pow2_64_table_lseq_w4; proj_g_pow2_64_lemma () let precomp_g_pow2_64_table_w4: x:glbuffer uint64 240ul{witnessed x precomp_g_pow2_64_table_lseq_w4 /\ recallable x} = createL_global precomp_g_pow2_64_table_list_w4 /// window size = 4; precomputed table = [[0]([pow2 128]G), [1]([pow2 128]G),...,[15]([pow2 128]G)] inline_for_extraction noextract let precomp_g_pow2_128_table_list_w4: x:list uint64{FStar.List.Tot.length x = 240} = normalize_term (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_128 15) let precomp_g_pow2_128_table_lseq_w4 : LSeq.lseq uint64 240 = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_128 15); Seq.seq_of_list precomp_g_pow2_128_table_list_w4 let precomp_g_pow2_128_table_lemma_w4 () = normalize_term_spec (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_128 15); SPT.precomp_base_table_lemma mk_k256_precomp_base_table proj_g_pow2_128 16 precomp_g_pow2_64_table_lseq_w4; proj_g_pow2_128_lemma () let precomp_g_pow2_128_table_w4: x:glbuffer uint64 240ul{witnessed x precomp_g_pow2_128_table_lseq_w4 /\ recallable x} = createL_global precomp_g_pow2_128_table_list_w4 /// window size = 4; precomputed table = [[0]([pow2 192]G), [1]([pow2 192]G),...,[15]([pow2 192]G)]
{ "checked_file": "/", "dependencies": [ "Spec.K256.Lemmas.fsti.checked", "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.PrecompBaseTable256.fsti.checked", "Hacl.Spec.PrecompBaseTable.fsti.checked", "Hacl.Spec.K256.PrecompTable.fsti.checked", "Hacl.Impl.K256.Point.fsti.checked", "Hacl.Impl.K256.Group.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.K256.PrecompTable.fst" }
[ { "abbrev": false, "full_module": "Hacl.Impl.K256.Group", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.K256.Point", "short_module": null }, { "abbrev": true, "full_module": "Spec.K256.Lemmas", "short_module": "SL" }, { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.K256.PrecompTable", "short_module": "SPTK" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable256", "short_module": "SPT256" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable", "short_module": "SPT" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.K256.Group", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.K256.Point", "short_module": null }, { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable", "short_module": "SPT" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation.Definitions", "short_module": "BE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.K256", "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
x: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U64 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length x = 240}
Prims.Tot
[ "total" ]
[]
[ "FStar.Pervasives.normalize_term", "Prims.list", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Prims.b2t", "Prims.op_Equality", "Prims.int", "FStar.List.Tot.Base.length", "Hacl.Spec.PrecompBaseTable.precomp_base_table_list", "Spec.K256.PointOps.proj_point", "FStar.UInt32.uint_to_t", "Hacl.K256.PrecompTable.mk_k256_precomp_base_table", "Hacl.K256.PrecompTable.proj_g_pow2_192" ]
[]
false
false
false
false
false
let precomp_g_pow2_192_table_list_w4:x: list uint64 {FStar.List.Tot.length x = 240} =
normalize_term (SPT.precomp_base_table_list mk_k256_precomp_base_table proj_g_pow2_192 15)
false
DPE.Messages.Parse.fst
DPE.Messages.Parse.parse_dpe_cmd_args_postcond
val parse_dpe_cmd_args_postcond (cid: U64.t) (vargs vcmd: raw_data_item) (rem: Seq.seq U8.t) : Tot prop
val parse_dpe_cmd_args_postcond (cid: U64.t) (vargs vcmd: raw_data_item) (rem: Seq.seq U8.t) : Tot prop
let parse_dpe_cmd_args_postcond (cid: U64.t) (vargs: raw_data_item) (vcmd: raw_data_item) (rem: Seq.seq U8.t) : Tot prop = data_item_wf deterministically_encoded_cbor_map_key_order vcmd /\ Spec.command_message vcmd /\ ( let Array [Int64 _ cid'; vargs'] = vcmd in cid == cid' /\ vargs == vargs' ) /\ Seq.length rem == 0
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Parse.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 21, "end_line": 166, "start_col": 0, "start_line": 154 }
(* Copyright 2023 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 DPE.Messages.Parse open Pulse.Lib.Pervasives open CBOR.Spec open CBOR.Pulse open CDDL.Pulse module Spec = DPE.Messages.Spec module SZ = FStar.SizeT module U8 = FStar.UInt8 module A = Pulse.Lib.Array #push-options "--ext 'pulse:env_on_err'" assume val dbg : vprop open Pulse.Lib.Stick ```pulse ghost fn elim_implies (#p #q:vprop) () requires (p @==> q) ** p ensures q { open Pulse.Lib.Stick; rewrite (p @==> q) as (stick p q); elim_stick p q; } ``` inline_for_extraction noextract [@@noextract_to "krml"] let impl_session_message1 : impl_typ Spec.session_message = impl_t_array ( impl_array_group3_concat (impl_array_group3_item (impl_uint ())) (impl_array_group3_item (impl_bytes ())) ) (* ```pulse fn impl_session_message0 (c: cbor) (#p: perm) (#v: Ghost.erased raw_data_item) requires (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) )) returns res: bool ensures (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) /\ res == Spec.session_message v )) { eval_impl_typ impl_session_message1 c } ``` *) noextract [@@noextract_to "krml"] assume val impl_session_message : impl_typ Spec.session_message inline_for_extraction noextract [@@noextract_to "krml"] let impl_command_id: impl_typ Spec.command_id = impl_uint_literal Spec.get_profile `impl_t_choice_none` impl_uint_literal Spec.open_session `impl_t_choice_none` impl_uint_literal Spec.close_session `impl_t_choice_none` impl_uint_literal Spec.sync_session `impl_t_choice_none` impl_uint_literal Spec.export_session `impl_t_choice_none` impl_uint_literal Spec.import_session `impl_t_choice_none` impl_uint_literal Spec.initialize_context `impl_t_choice_none` impl_uint_literal Spec.derive_child `impl_t_choice_none` impl_uint_literal Spec.certify_key `impl_t_choice_none` impl_uint_literal Spec.sign `impl_t_choice_none` impl_uint_literal Spec.seal `impl_t_choice_none` impl_uint_literal Spec.unseal `impl_t_choice_none` impl_uint_literal Spec.derive_sealing_public_key `impl_t_choice_none` impl_uint_literal Spec.rotate_context_handle `impl_t_choice_none` impl_uint_literal Spec.destroy_context inline_for_extraction noextract [@@noextract_to "krml"] let impl_default_args_group : impl_matches_map_group Spec.default_args_group = impl_matches_map_group_no_restricted ( impl_matches_map_entry_zero_or_more_cons (CDDL.Spec.uint `CDDL.Spec.MapGroupEntry` CDDL.Spec.any) (impl_uint ()) (impl_any ()) (impl_matches_map_entry_zero_or_more_nil _) ) () inline_for_extraction noextract [@@noextract_to "krml"] let impl_command_message1 : impl_typ Spec.command_message = // Wow, the equivalence with command_message' seems to work out of the box impl_t_array ( impl_array_group3_item impl_command_id `impl_array_group3_concat` impl_array_group3_item (impl_t_map impl_default_args_group) ) (* ```pulse fn impl_command_message0 (c: cbor) (#p: perm) (#v: Ghost.erased raw_data_item) requires (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) )) returns res: bool ensures (raw_data_item_match p c v ** pure ( opt_precedes (Ghost.reveal v) (None #raw_data_item) /\ res == Spec.command_message v )) { eval_impl_typ impl_command_message1 c } ``` *) noextract [@@noextract_to "krml"] assume val impl_command_message : impl_typ Spec.command_message module U64 = FStar.UInt64 noeq type dpe_cmd = { dpe_cmd_sid: U64.t; dpe_cmd_cid: U64.t; dpe_cmd_args: cbor; } #push-options "--z3rlimit 64 --query_stats" // to let z3 cope with CDDL specs #restart-solver
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Stick.fsti.checked", "Pulse.Lib.Pervasives.fst.checked", "Pulse.Lib.Array.fsti.checked", "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.SizeT.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "DPE.Messages.Spec.fst.checked", "CDDL.Spec.fsti.checked", "CDDL.Pulse.fst.checked", "CBOR.Spec.fsti.checked", "CBOR.Pulse.fst.checked" ], "interface_file": false, "source_file": "DPE.Messages.Parse.fst" }
[ { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": false, "full_module": "Pulse.Lib.Stick", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Lib.Array", "short_module": "A" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "SZ" }, { "abbrev": true, "full_module": "DPE.Messages.Spec", "short_module": "Spec" }, { "abbrev": false, "full_module": "CDDL.Pulse", "short_module": null }, { "abbrev": false, "full_module": "CBOR.Pulse", "short_module": null }, { "abbrev": false, "full_module": "CBOR.Spec", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "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": 64, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
cid: FStar.UInt64.t -> vargs: CBOR.Spec.Type.raw_data_item -> vcmd: CBOR.Spec.Type.raw_data_item -> rem: FStar.Seq.Base.seq FStar.UInt8.t -> Prims.prop
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.t", "CBOR.Spec.Type.raw_data_item", "FStar.Seq.Base.seq", "FStar.UInt8.t", "Prims.l_and", "Prims.b2t", "CBOR.Spec.Type.data_item_wf", "FStar.Ghost.reveal", "Prims.bool", "CBOR.Spec.deterministically_encoded_cbor_map_key_order", "DPE.Messages.Spec.command_message", "CBOR.Spec.Constants.major_type_uint64_or_neg_int64", "Prims.eq2", "Prims.logical", "Prims.int", "FStar.Seq.Base.length", "Prims.prop" ]
[]
false
false
false
true
true
let parse_dpe_cmd_args_postcond (cid: U64.t) (vargs vcmd: raw_data_item) (rem: Seq.seq U8.t) : Tot prop =
data_item_wf deterministically_encoded_cbor_map_key_order vcmd /\ Spec.command_message vcmd /\ (let Array [Int64 _ cid' ; vargs'] = vcmd in cid == cid' /\ vargs == vargs') /\ Seq.length rem == 0
false
Vale.Interop.X64.fsti
Vale.Interop.X64.reg_nat
val reg_nat : n: Prims.nat -> Type0
let reg_nat (n:nat) = i:nat{i < n}
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 33, "start_col": 0, "start_line": 33 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) )
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
n: Prims.nat -> Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.b2t", "Prims.op_LessThan" ]
[]
false
false
false
true
true
let reg_nat (n: nat) =
i: nat{i < n}
false
Vale.Interop.X64.fsti
Vale.Interop.X64.registers
val registers : Type0
let registers = MS.reg_64 -> MS.nat64
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 37, "end_line": 64, "start_col": 0, "start_line": 64 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
Type0
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.Machine_s.reg_64", "Vale.X64.Machine_s.nat64" ]
[]
false
false
false
true
true
let registers =
MS.reg_64 -> MS.nat64
false
Vale.Interop.X64.fsti
Vale.Interop.X64.arg_list_sb
val arg_list_sb : Type0
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 53, "end_line": 41, "start_col": 0, "start_line": 41 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*)
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.list", "Vale.Interop.Base.arg", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.List.Tot.Base.length" ]
[]
false
false
false
true
true
let arg_list_sb =
l: list arg {List.Tot.length l <= 21}
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_four_fw_acc0
val lexp_four_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4
val lexp_four_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4
let lexp_four_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc; lexp_double_fw_acc0 len ctx_len k l table_len table_inv3 table_inv4 pow_a_to_small_b3 pow_a_to_small_b4 ctx a3 bLen bBits b3 a4 b4 table3 table4 tmp; k.lmul ctx acc tmp acc; pop_frame ()
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 507, "start_col": 0, "start_line": 498 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame () inline_for_extraction noextract let lexp_double_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@ inline_let] let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@inline_let] let spec (h:mem) = S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) in [@inline_let] let inv h (i:nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_double_fw_f len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp ); pop_frame () let mk_lexp_double_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res = assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res else k.lone ctx res; lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res //----------------------------------- inline_for_extraction noextract val lexp_double_fw_gen: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len{1 < v table_len /\ v table_len == pow2 (v l)} -> lprecomp_get:pow_a_to_small_b_st a_t len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) -> lexp_double_fw_st a_t len ctx_len k l #push-options "--z3rlimit 150" let lexp_double_fw_gen #a_t len ctx_len k l table_len lprecomp_get ctx a1 bLen bBits b1 a2 b2 acc = push_frame (); lemma_pow2_is_divisible_by_2 (v l); let table1 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a1 table_len table1; let h0 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h0 a1) (as_seq h0 table1)); let table2 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a2 table_len table2; let h1 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a1) (as_seq h1 table1)); assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a2) (as_seq h1 table2)); mk_lexp_double_fw_tables len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) (table_inv_precomp len ctx_len k l table_len) lprecomp_get lprecomp_get ctx a1 bLen bBits b1 a2 b2 (to_const table1) (to_const table2) acc; pop_frame () #pop-options let lexp_double_fw_vartime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_vartime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc let lexp_double_fw_consttime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_consttime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc //-------------------------------------------------- inline_for_extraction noextract let lexp_four_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) (table_inv3:table_inv_t a_t len table_len) (table_inv4:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> a3:lbuffer (uint_t a_t SEC) len -> b3:lbuffer (uint_t a_t SEC) bLen -> a4:lbuffer (uint_t a_t SEC) len -> b4:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> table3:clbuffer (uint_t a_t SEC) (table_len *! len) -> table4:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp a3 /\ disjoint tmp a4 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp b3 /\ disjoint tmp b4 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ disjoint tmp table3 /\ disjoint tmp table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_four_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_four_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 let lexp_four_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 i acc tmp = lexp_double_fw_f len ctx_len k l table_len table_inv3 table_inv4 pow_a_to_small_b3 pow_a_to_small_b4 ctx a3 bLen bBits b3 a4 b4 table3 table4 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_four_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) (table_inv3:table_inv_t a_t len table_len) (table_inv4:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> a3:lbuffer (uint_t a_t SEC) len -> b3:lbuffer (uint_t a_t SEC) bLen -> a4:lbuffer (uint_t a_t SEC) len -> b4:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> table3:clbuffer (uint_t a_t SEC) (table_len *! len) -> table4:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_four_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l)) inline_for_extraction noextract val lexp_four_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> table_inv3:table_inv_t a_t len table_len -> table_inv4:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> lexp_four_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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
len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv3: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv4: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> pow_a_to_small_b1: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> pow_a_to_small_b3: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv3 -> pow_a_to_small_b4: Hacl.Impl.Exponentiation.pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv4 -> Hacl.Impl.MultiExponentiation.lexp_four_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Hacl.Impl.Exponentiation.pow_a_to_small_b_st", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.l_and", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkconcrete_ops__item__lmul", "Hacl.Impl.MultiExponentiation.lexp_double_fw_acc0", "Lib.Buffer.lbuffer_t", "Lib.Buffer.MUT", "Lib.IntTypes.int_t", "Lib.Buffer.create", "Lib.IntTypes.uint", "FStar.HyperStack.ST.push_frame" ]
[]
false
false
false
false
false
let lexp_four_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 table_inv3 table_inv4 pow_a_to_small_b1 pow_a_to_small_b2 pow_a_to_small_b3 pow_a_to_small_b4 ctx a1 bLen bBits b1 a2 b2 a3 b3 a4 b4 table1 table2 table3 table4 acc =
push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc; lexp_double_fw_acc0 len ctx_len k l table_len table_inv3 table_inv4 pow_a_to_small_b3 pow_a_to_small_b4 ctx a3 bLen bBits b3 a4 b4 table3 table4 tmp; k.lmul ctx acc tmp acc; pop_frame ()
false
Vale.Interop.X64.fsti
Vale.Interop.X64.arity_ok
val arity_ok : n: Prims.int -> 'a: Type -> Type
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 56, "end_line": 34, "start_col": 0, "start_line": 34 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) )
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
n: Prims.int -> 'a: Type -> Type
Prims.Tot
[ "total" ]
[]
[ "Prims.int", "Prims.list", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.List.Tot.Base.length" ]
[]
false
false
false
true
true
let arity_ok n 'a =
l: list 'a {List.Tot.length l <= n}
false
Hacl.Impl.MultiExponentiation.fst
Hacl.Impl.MultiExponentiation.lexp_four_fw_f_st
val lexp_four_fw_f_st : a_t: Hacl.Impl.Exponentiation.Definitions.inttype_a -> len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv3: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv4: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> Type0
let lexp_four_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) (table_inv3:table_inv_t a_t len table_len) (table_inv4:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> a3:lbuffer (uint_t a_t SEC) len -> b3:lbuffer (uint_t a_t SEC) bLen -> a4:lbuffer (uint_t a_t SEC) len -> b4:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> table3:clbuffer (uint_t a_t SEC) (table_len *! len) -> table4:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp a3 /\ disjoint tmp a4 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp b3 /\ disjoint tmp b4 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ disjoint tmp table3 /\ disjoint tmp table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_four_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l) (v i) (k.to.refl (as_seq h0 acc)))
{ "file_name": "code/bignum/Hacl.Impl.MultiExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 89, "end_line": 384, "start_col": 0, "start_line": 314 }
module Hacl.Impl.MultiExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module Loops = Lib.LoopCombinators module S = Lib.Exponentiation module BD = Hacl.Bignum.Definitions module PT = Hacl.Impl.PrecompTable friend Hacl.Impl.Exponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let lexp_double_fw_f_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> i:size_t{v i < v bBits / v l} -> acc:lbuffer (uint_t a_t SEC) len -> tmp:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) (v i) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_f: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_f_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_f #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp = lexp_fw_f len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 i acc tmp; lmul_acc_pow_a_bits_l len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 i acc tmp inline_for_extraction noextract let lexp_double_fw_acc0_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{0 < v bBits /\ (v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> v bBits % v l <> 0 /\ live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_double_fw_acc0 #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) inline_for_extraction noextract val lexp_double_fw_acc0: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_acc0_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_acc0 #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in lexp_fw_acc0 len ctx_len k l table_len table_inv1 pow_a_to_small_b1 ctx a1 bLen bBits b1 table1 acc; lexp_fw_acc0 len ctx_len k l table_len table_inv2 pow_a_to_small_b2 ctx a2 bLen bBits b2 table2 tmp; k.lmul ctx acc tmp acc; pop_frame () inline_for_extraction noextract let lexp_double_fw_loop_st (a_t:inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (k:concrete_ops a_t len ctx_len) (l:size_window_t a_t len) (table_len:table_len_t len) (table_inv1:table_inv_t a_t len table_len) (table_inv2:table_inv_t a_t len table_len) = ctx:lbuffer (uint_t a_t SEC) ctx_len -> a1:lbuffer (uint_t a_t SEC) len -> bLen:size_t -> bBits:size_t{(v bBits - 1) / bits a_t < v bLen} -> b1:lbuffer (uint_t a_t SEC) bLen -> a2:lbuffer (uint_t a_t SEC) len -> b2:lbuffer (uint_t a_t SEC) bLen -> table1:clbuffer (uint_t a_t SEC) (table_len *! len) -> table2:clbuffer (uint_t a_t SEC) (table_len *! len) -> acc:lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ eq_or_disjoint a1 a2 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint b1 acc /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint b2 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2)) (ensures fun h0 _ h1 -> modifies (loc acc) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == Loops.repeati (v bBits / v l) (S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l)) (k.to.refl (as_seq h0 acc))) inline_for_extraction noextract val lexp_double_fw_loop: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len -> table_inv1:table_inv_t a_t len table_len -> table_inv2:table_inv_t a_t len table_len -> pow_a_to_small_b1:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv1 -> pow_a_to_small_b2:pow_a_to_small_b_st a_t len ctx_len k l table_len table_inv2 -> lexp_double_fw_loop_st a_t len ctx_len k l table_len table_inv1 table_inv2 let lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 acc = push_frame (); let tmp = create len (uint #a_t #SEC 0) in let h0 = ST.get () in [@ inline_let] let refl1 i : GTot k.to.a_spec = k.to.refl (as_seq h0 acc) in [@inline_let] let spec (h:mem) = S.exp_double_fw_f k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (v l) in [@inline_let] let inv h (i:nat{i <= v bBits / v l}) = modifies (loc acc |+| loc tmp) h0 h /\ k.to.linv (as_seq h acc) /\ k.to.refl (as_seq h acc) == Loops.repeati i (spec h0) (refl1 0) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) in Loops.eq_repeati0 (v bBits / v l) (spec h0) (refl1 0); Lib.Loops.for 0ul (bBits /. l) inv (fun i -> Loops.unfold_repeati (v bBits / v l) (spec h0) (refl1 0) (v i); lexp_double_fw_f len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 i acc tmp ); pop_frame () let mk_lexp_double_fw_tables #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res = assert (v (bBits %. l) == v bBits % v l); if bBits %. l <> 0ul then lexp_double_fw_acc0 len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res else k.lone ctx res; lexp_double_fw_loop #a_t len ctx_len k l table_len table_inv1 table_inv2 pow_a_to_small_b1 pow_a_to_small_b2 ctx a1 bLen bBits b1 a2 b2 table1 table2 res //----------------------------------- inline_for_extraction noextract val lexp_double_fw_gen: #a_t:inttype_a -> len:size_t{v len > 0} -> ctx_len:size_t -> k:concrete_ops a_t len ctx_len -> l:size_window_t a_t len -> table_len:table_len_t len{1 < v table_len /\ v table_len == pow2 (v l)} -> lprecomp_get:pow_a_to_small_b_st a_t len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) -> lexp_double_fw_st a_t len ctx_len k l #push-options "--z3rlimit 150" let lexp_double_fw_gen #a_t len ctx_len k l table_len lprecomp_get ctx a1 bLen bBits b1 a2 b2 acc = push_frame (); lemma_pow2_is_divisible_by_2 (v l); let table1 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a1 table_len table1; let h0 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h0 a1) (as_seq h0 table1)); let table2 = create (table_len *! len) (uint #a_t #SEC 0) in PT.lprecomp_table #a_t len ctx_len k ctx a2 table_len table2; let h1 = ST.get () in assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a1) (as_seq h1 table1)); assert (table_inv_precomp len ctx_len k l table_len (as_seq h1 a2) (as_seq h1 table2)); mk_lexp_double_fw_tables len ctx_len k l table_len (table_inv_precomp len ctx_len k l table_len) (table_inv_precomp len ctx_len k l table_len) lprecomp_get lprecomp_get ctx a1 bLen bBits b1 a2 b2 (to_const table1) (to_const table2) acc; pop_frame () #pop-options let lexp_double_fw_vartime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_vartime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc let lexp_double_fw_consttime #a_t len ctx_len k l ctx a1 bLen bBits b1 a2 b2 acc = [@inline_let] let table_len = 1ul <<. l in assert (v table_len == pow2 (v l)); Math.Lemmas.pow2_le_compat (v l) 1; assert (1 < v table_len /\ v table_len * v len <= max_size_t); lexp_double_fw_gen len ctx_len k l table_len (lprecomp_get_consttime len ctx_len k l table_len) ctx a1 bLen bBits b1 a2 b2 acc //--------------------------------------------------
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Loops.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.PrecompTable.fsti.checked", "Hacl.Impl.Exponentiation.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Impl.MultiExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Impl.PrecompTable", "short_module": "PT" }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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.Exponentiation", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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_t: Hacl.Impl.Exponentiation.Definitions.inttype_a -> len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> ctx_len: Lib.IntTypes.size_t -> k: Hacl.Impl.Exponentiation.Definitions.concrete_ops a_t len ctx_len -> l: Hacl.Impl.Exponentiation.size_window_t a_t len -> table_len: Hacl.Impl.Exponentiation.table_len_t len -> table_inv1: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv2: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv3: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> table_inv4: Hacl.Impl.Exponentiation.table_inv_t a_t len table_len -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Exponentiation.Definitions.inttype_a", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.Exponentiation.Definitions.concrete_ops", "Hacl.Impl.Exponentiation.size_window_t", "Hacl.Impl.Exponentiation.table_len_t", "Hacl.Impl.Exponentiation.table_inv_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Prims.op_LessThan", "Prims.op_Division", "Prims.op_Subtraction", "Lib.IntTypes.bits", "Lib.Buffer.clbuffer", "Lib.IntTypes.op_Star_Bang", "Prims.unit", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "Lib.Buffer.live", "Lib.Buffer.MUT", "Lib.Buffer.CONST", "Lib.Buffer.disjoint", "Lib.Buffer.eq_or_disjoint", "Hacl.Bignum.Definitions.bn_v", "Prims.pow2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv_ctx", "FStar.Ghost.reveal", "Hacl.Impl.Exponentiation.Definitions.to_comm_monoid", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkconcrete_ops__item__to", "Lib.Buffer.as_seq", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__linv", "Lib.Buffer.modifies", "Lib.Buffer.op_Bar_Plus_Bar", "Lib.Buffer.loc", "Prims.eq2", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__a_spec", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__refl", "Lib.Exponentiation.exp_four_fw_f", "Hacl.Impl.Exponentiation.Definitions.__proj__Mkto_comm_monoid__item__comm_monoid" ]
[]
false
false
false
false
true
let lexp_four_fw_f_st (a_t: inttype_a) (len: size_t{v len > 0}) (ctx_len: size_t) (k: concrete_ops a_t len ctx_len) (l: size_window_t a_t len) (table_len: table_len_t len) (table_inv1 table_inv2 table_inv3 table_inv4: table_inv_t a_t len table_len) =
ctx: lbuffer (uint_t a_t SEC) ctx_len -> a1: lbuffer (uint_t a_t SEC) len -> bLen: size_t -> bBits: size_t{(v bBits - 1) / bits a_t < v bLen} -> b1: lbuffer (uint_t a_t SEC) bLen -> a2: lbuffer (uint_t a_t SEC) len -> b2: lbuffer (uint_t a_t SEC) bLen -> a3: lbuffer (uint_t a_t SEC) len -> b3: lbuffer (uint_t a_t SEC) bLen -> a4: lbuffer (uint_t a_t SEC) len -> b4: lbuffer (uint_t a_t SEC) bLen -> table1: clbuffer (uint_t a_t SEC) (table_len *! len) -> table2: clbuffer (uint_t a_t SEC) (table_len *! len) -> table3: clbuffer (uint_t a_t SEC) (table_len *! len) -> table4: clbuffer (uint_t a_t SEC) (table_len *! len) -> i: size_t{v i < v bBits / v l} -> acc: lbuffer (uint_t a_t SEC) len -> tmp: lbuffer (uint_t a_t SEC) len -> Stack unit (requires fun h -> live h a1 /\ live h b1 /\ live h a2 /\ live h b2 /\ live h a3 /\ live h b3 /\ live h a4 /\ live h b4 /\ live h acc /\ live h ctx /\ live h table1 /\ live h table2 /\ live h table3 /\ live h table4 /\ live h tmp /\ disjoint tmp a1 /\ disjoint tmp a2 /\ disjoint tmp a3 /\ disjoint tmp a4 /\ disjoint tmp b1 /\ disjoint tmp b2 /\ disjoint tmp b3 /\ disjoint tmp b4 /\ disjoint tmp acc /\ disjoint tmp ctx /\ disjoint tmp table1 /\ disjoint tmp table2 /\ disjoint tmp table3 /\ disjoint tmp table4 /\ eq_or_disjoint a1 a2 /\ eq_or_disjoint a1 a3 /\ eq_or_disjoint a1 a4 /\ eq_or_disjoint a2 a3 /\ eq_or_disjoint a2 a4 /\ eq_or_disjoint a3 a4 /\ disjoint a1 acc /\ disjoint a1 ctx /\ disjoint a2 acc /\ disjoint a2 ctx /\ disjoint a3 acc /\ disjoint a3 ctx /\ disjoint a4 acc /\ disjoint a4 ctx /\ disjoint b1 acc /\ disjoint b2 acc /\ disjoint b3 acc /\ disjoint b4 acc /\ disjoint acc ctx /\ disjoint acc table1 /\ disjoint acc table2 /\ disjoint acc table3 /\ disjoint acc table4 /\ BD.bn_v h b1 < pow2 (v bBits) /\ BD.bn_v h b2 < pow2 (v bBits) /\ BD.bn_v h b3 < pow2 (v bBits) /\ BD.bn_v h b4 < pow2 (v bBits) /\ k.to.linv_ctx (as_seq h ctx) /\ k.to.linv (as_seq h a1) /\ k.to.linv (as_seq h a2) /\ k.to.linv (as_seq h a3) /\ k.to.linv (as_seq h a4) /\ k.to.linv (as_seq h acc) /\ table_inv1 (as_seq h a1) (as_seq h table1) /\ table_inv2 (as_seq h a2) (as_seq h table2) /\ table_inv3 (as_seq h a3) (as_seq h table3) /\ table_inv4 (as_seq h a4) (as_seq h table4)) (ensures fun h0 _ h1 -> modifies (loc acc |+| loc tmp) h0 h1 /\ k.to.linv (as_seq h1 acc) /\ k.to.refl (as_seq h1 acc) == S.exp_four_fw_f #k.to.a_spec k.to.comm_monoid (k.to.refl (as_seq h0 a1)) (v bBits) (BD.bn_v h0 b1) (k.to.refl (as_seq h0 a2)) (BD.bn_v h0 b2) (k.to.refl (as_seq h0 a3)) (BD.bn_v h0 b3) (k.to.refl (as_seq h0 a4)) (BD.bn_v h0 b4) (v l) (v i) (k.to.refl (as_seq h0 acc)))
false
Vale.Interop.X64.fsti
Vale.Interop.X64.arg_list
val arg_list : Type0
let arg_list = l:list arg{List.Tot.length l <= 20}
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 50, "end_line": 40, "start_col": 0, "start_line": 40 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed.
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.list", "Vale.Interop.Base.arg", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.List.Tot.Base.length" ]
[]
false
false
false
true
true
let arg_list =
l: list arg {List.Tot.length l <= 20}
false
Vale.Interop.X64.fsti
Vale.Interop.X64.injective
val injective : f: (_: _ -> _) -> Prims.logical
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 70, "end_line": 44, "start_col": 0, "start_line": 44 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21}
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
f: (_: _ -> _) -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Prims.l_Forall", "Prims.l_imp", "Prims.eq2", "Prims.logical" ]
[]
false
false
false
true
true
let injective f =
forall x y. {:pattern f x; f y} f x == f y ==> x == y
false
Vale.Interop.X64.fsti
Vale.Interop.X64.update_regs
val update_regs (n: nat) (arg_reg: arg_reg_relation n) (x: arg) (i: reg_nat n) (regs: registers) : GTot registers
val update_regs (n: nat) (arg_reg: arg_reg_relation n) (x: arg) (i: reg_nat n) (regs: registers) : GTot registers
let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x)
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 45, "end_line": 98, "start_col": 0, "start_line": 92 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
n: Prims.nat -> arg_reg: Vale.Interop.X64.arg_reg_relation n -> x: Vale.Interop.Base.arg -> i: Vale.Interop.X64.reg_nat n -> regs: Vale.Interop.X64.registers -> Prims.GTot Vale.Interop.X64.registers
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.nat", "Vale.Interop.X64.arg_reg_relation", "Vale.Interop.Base.arg", "Vale.Interop.X64.reg_nat", "Vale.Interop.X64.registers", "Vale.Interop.X64.upd_reg", "Vale.Interop.X64.arg_as_nat64" ]
[]
false
false
false
false
false
let update_regs (n: nat) (arg_reg: arg_reg_relation n) (x: arg) (i: reg_nat n) (regs: registers) : GTot registers =
upd_reg n arg_reg regs i (arg_as_nat64 x)
false
Vale.Interop.X64.fsti
Vale.Interop.X64.taint_map
val taint_map : Type0
let taint_map = b8 -> GTot taint
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 32, "end_line": 139, "start_col": 0, "start_line": 139 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
Type0
Prims.Tot
[ "total" ]
[]
[ "Vale.Interop.Types.b8", "Vale.Arch.HeapTypes_s.taint" ]
[]
false
false
false
true
true
let taint_map =
b8 -> GTot taint
false
Vale.Interop.X64.fsti
Vale.Interop.X64.upd_taint_map_b8
val upd_taint_map_b8 (tm: taint_map) (x: b8) (tnt: taint) : taint_map
val upd_taint_map_b8 (tm: taint_map) (x: b8) (tnt: taint) : taint_map
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 145, "start_col": 0, "start_line": 141 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
tm: Vale.Interop.X64.taint_map -> x: Vale.Interop.Types.b8 -> tnt: Vale.Arch.HeapTypes_s.taint -> Vale.Interop.X64.taint_map
Prims.Tot
[ "total" ]
[]
[ "Vale.Interop.X64.taint_map", "Vale.Interop.Types.b8", "Vale.Arch.HeapTypes_s.taint", "FStar.StrongExcludedMiddle.strong_excluded_middle", "Prims.eq2", "Prims.bool" ]
[]
false
false
false
true
false
let upd_taint_map_b8 (tm: taint_map) (x: b8) (tnt: taint) : taint_map =
fun (y: b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y
false
Vale.Interop.X64.fsti
Vale.Interop.X64.init_taint
val init_taint:taint_map
val init_taint:taint_map
let init_taint : taint_map = fun r -> Public
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 44, "end_line": 157, "start_col": 0, "start_line": 157 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
Vale.Interop.X64.taint_map
Prims.Tot
[ "total" ]
[]
[ "Vale.Interop.Types.b8", "Vale.Arch.HeapTypes_s.Public", "Vale.Arch.HeapTypes_s.taint" ]
[]
false
false
false
true
false
let init_taint:taint_map =
fun r -> Public
false
Vale.Interop.X64.fsti
Vale.Interop.X64.mk_taint
val mk_taint (args: arg_list_sb) (tm: taint_map) : GTot taint_map
val mk_taint (args: arg_list_sb) (tm: taint_map) : GTot taint_map
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 56, "end_line": 161, "start_col": 0, "start_line": 160 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
args: Vale.Interop.X64.arg_list_sb -> tm: Vale.Interop.X64.taint_map -> Prims.GTot Vale.Interop.X64.taint_map
Prims.GTot
[ "sometrivial" ]
[]
[ "Vale.Interop.X64.arg_list_sb", "Vale.Interop.X64.taint_map", "FStar.List.Tot.Base.fold_right_gtot", "Vale.Interop.Base.arg", "Vale.Interop.X64.upd_taint_map_arg", "Vale.Interop.X64.init_taint" ]
[]
false
false
false
false
false
let mk_taint (args: arg_list_sb) (tm: taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
false
Vale.Interop.X64.fsti
Vale.Interop.X64.calling_conventions
val calling_conventions : s0: Vale.X64.Machine_Semantics_s.machine_state -> s1: Vale.X64.Machine_Semantics_s.machine_state -> regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) -> xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool) -> Prims.logical
let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) )
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 31, "start_col": 0, "start_line": 19 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping ////////////////////////////////////////////////////////////////////////////////
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
s0: Vale.X64.Machine_Semantics_s.machine_state -> s1: Vale.X64.Machine_Semantics_s.machine_state -> regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) -> xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool) -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.Machine_Semantics_s.machine_state", "Vale.X64.Machine_s.reg_64", "Prims.bool", "Vale.X64.Machine_s.reg_xmm", "Prims.l_and", "Prims.b2t", "Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_ok", "Prims.eq2", "Vale.X64.Machine_s.t_reg", "Vale.X64.Machine_s.reg_Rsp", "Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_regs", "Prims.l_Forall", "Vale.X64.Machine_s.reg", "Vale.X64.Machine_s.reg_id", "Prims.l_imp", "Prims.op_Negation", "Vale.X64.Machine_s.Reg", "Prims.logical" ]
[]
false
false
false
true
true
let calling_conventions (s0 s1: BS.machine_state) (regs_modified: (MS.reg_64 -> bool)) (xmms_modified: (MS.reg_xmm -> bool)) =
let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r: MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r))
false
Vale.Interop.X64.fsti
Vale.Interop.X64.taint_of_arg
val taint_of_arg : a: Vale.Interop.Base.arg -> FStar.Pervasives.Native.option Vale.Arch.HeapTypes_s.taint
let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 13, "end_line": 170, "start_col": 0, "start_line": 163 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
a: Vale.Interop.Base.arg -> FStar.Pervasives.Native.option Vale.Arch.HeapTypes_s.taint
Prims.Tot
[ "total" ]
[]
[ "Vale.Interop.Base.arg", "Vale.Interop.Base.td", "Vale.Interop.Base.td_as_type", "Vale.Arch.HeapTypes_s.base_typ", "Prims.bool", "Vale.Arch.HeapTypes_s.taint", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option" ]
[]
false
false
false
true
false
let taint_of_arg (a: arg) =
let (| tag , x |) = a in match tag with | TD_ImmBuffer _ TUInt64 { taint = tnt } | TD_ImmBuffer _ TUInt128 { taint = tnt } | TD_Buffer _ TUInt64 { taint = tnt } | TD_Buffer _ TUInt128 { taint = tnt } -> Some tnt | _ -> None
false
Vale.Interop.X64.fsti
Vale.Interop.X64.state_builder_t
val state_builder_t : max_arity: Prims.nat -> args: Vale.Interop.X64.arg_list -> codom: Type -> Type
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 206, "start_col": 0, "start_line": 204 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl ////////////////////////////////////////////////////////////////////////////////
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
max_arity: Prims.nat -> args: Vale.Interop.X64.arg_list -> codom: Type -> Type
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Vale.Interop.X64.arg_list", "FStar.Monotonic.HyperStack.mem", "Vale.Interop.Base.mem_roots_p" ]
[]
false
false
false
true
true
let state_builder_t (max_arity: nat) (args: arg_list) (codom: Type) =
h0: HS.mem{mem_roots_p h0 args} -> GTot codom
false
Vale.Interop.X64.fsti
Vale.Interop.X64.prediction_pre_rel_t
val prediction_pre_rel_t : c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> Type
let prediction_pre_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> prop
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 8, "end_line": 247, "start_col": 0, "start_line": 245 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB) // and another that just creates the vale state, a view upon the trusted one let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem)
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> Type
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.Machine_Semantics_s.code", "Vale.Interop.X64.arg_list", "Vale.Interop.Base.mem_roots", "Prims.prop" ]
[]
false
false
false
true
true
let prediction_pre_rel_t (c: BS.code) (args: arg_list) =
h0: mem_roots args -> prop
false
Vale.Interop.X64.fsti
Vale.Interop.X64.prediction_pre
val prediction_pre : n: Prims.nat -> arg_reg: Vale.Interop.X64.arg_reg_relation n -> c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> pre_rel: Vale.Interop.X64.prediction_pre_rel_t c args -> h0: Vale.Interop.Base.mem_roots args -> s0: Vale.X64.Machine_Semantics_s.machine_state -> Prims.logical
let prediction_pre (n:nat) (arg_reg:arg_reg_relation n) (c:BS.code) (args:arg_list) (pre_rel: prediction_pre_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) = pre_rel h0 /\ s0 == fst (create_initial_trusted_state n arg_reg args h0)
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 60, "end_line": 271, "start_col": 0, "start_line": 261 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB) // and another that just creates the vale state, a view upon the trusted one let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem) //////////////////////////////////////////////////////////////////////////////// let prediction_pre_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> prop let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} let return_val (sn:BS.machine_state) : return_val_t sn = UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn) let prediction_post_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> s0:BS.machine_state -> (UInt64.t & nat & interop_heap) -> sn:BS.machine_state -> prop
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
n: Prims.nat -> arg_reg: Vale.Interop.X64.arg_reg_relation n -> c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> pre_rel: Vale.Interop.X64.prediction_pre_rel_t c args -> h0: Vale.Interop.Base.mem_roots args -> s0: Vale.X64.Machine_Semantics_s.machine_state -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Vale.Interop.X64.arg_reg_relation", "Vale.X64.Machine_Semantics_s.code", "Vale.Interop.X64.arg_list", "Vale.Interop.X64.prediction_pre_rel_t", "Vale.Interop.Base.mem_roots", "Vale.X64.Machine_Semantics_s.machine_state", "Prims.l_and", "Prims.eq2", "FStar.Pervasives.Native.fst", "Vale.Interop.Heap_s.interop_heap", "Vale.Interop.X64.create_initial_trusted_state", "Prims.logical" ]
[]
false
false
false
false
true
let prediction_pre (n: nat) (arg_reg: arg_reg_relation n) (c: BS.code) (args: arg_list) (pre_rel: prediction_pre_rel_t c args) (h0: mem_roots args) (s0: BS.machine_state) =
pre_rel h0 /\ s0 == fst (create_initial_trusted_state n arg_reg args h0)
false
Vale.Interop.X64.fsti
Vale.Interop.X64.prediction_post_rel_t
val prediction_post_rel_t : c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> Type
let prediction_post_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> s0:BS.machine_state -> (UInt64.t & nat & interop_heap) -> sn:BS.machine_state -> prop
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 8, "end_line": 258, "start_col": 0, "start_line": 253 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB) // and another that just creates the vale state, a view upon the trusted one let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem) //////////////////////////////////////////////////////////////////////////////// let prediction_pre_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> prop let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} let return_val (sn:BS.machine_state) : return_val_t sn = UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> Type
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.Machine_Semantics_s.code", "Vale.Interop.X64.arg_list", "Vale.Interop.Base.mem_roots", "Vale.X64.Machine_Semantics_s.machine_state", "FStar.Pervasives.Native.tuple3", "FStar.UInt64.t", "Prims.nat", "Vale.Interop.Heap_s.interop_heap", "Prims.prop" ]
[]
false
false
false
true
true
let prediction_post_rel_t (c: BS.code) (args: arg_list) =
h0: mem_roots args -> s0: BS.machine_state -> (UInt64.t & nat & interop_heap) -> sn: BS.machine_state -> prop
false
Vale.Interop.X64.fsti
Vale.Interop.X64.prediction
val prediction : n: Prims.nat -> arg_reg: Vale.Interop.X64.arg_reg_relation n -> regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) -> xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool) -> c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> pre_rel: Vale.Interop.X64.prediction_pre_rel_t c args -> post_rel: Vale.Interop.X64.prediction_post_rel_t c args -> Type
let prediction (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (pre_rel:prediction_pre_rel_t c args) (post_rel:prediction_post_rel_t c args) = h0:mem_roots args{pre_rel h0} -> s0:BS.machine_state -> Ghost (UInt64.t & nat & interop_heap) (requires prediction_pre n arg_reg c args pre_rel h0 s0) (ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 81, "end_line": 310, "start_col": 0, "start_line": 297 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB) // and another that just creates the vale state, a view upon the trusted one let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem) //////////////////////////////////////////////////////////////////////////////// let prediction_pre_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> prop let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} let return_val (sn:BS.machine_state) : return_val_t sn = UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn) let prediction_post_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> s0:BS.machine_state -> (UInt64.t & nat & interop_heap) -> sn:BS.machine_state -> prop [@__reduce__] let prediction_pre (n:nat) (arg_reg:arg_reg_relation n) (c:BS.code) (args:arg_list) (pre_rel: prediction_pre_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) = pre_rel h0 /\ s0 == fst (create_initial_trusted_state n arg_reg args h0) [@__reduce__] let prediction_post (n:nat) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (post_rel: prediction_post_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) (rax_fuel_mem:(UInt64.t & nat & interop_heap)) = let (rax, fuel, final_mem) = rax_fuel_mem in Some? (BS.machine_eval_code c fuel s0) /\ ( let s1 = Some?.v (BS.machine_eval_code c fuel s0) in let h1 = hs_of_mem final_mem in FStar.HyperStack.ST.equal_domains h0 h1 /\ B.modifies (loc_modified_args args) h0 h1 /\ mem_roots_p h1 args /\ heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\ calling_conventions s0 s1 regs_modified xmms_modified /\ rax == return_val s1 /\ post_rel h0 s0 rax_fuel_mem s1 )
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
n: Prims.nat -> arg_reg: Vale.Interop.X64.arg_reg_relation n -> regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) -> xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool) -> c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> pre_rel: Vale.Interop.X64.prediction_pre_rel_t c args -> post_rel: Vale.Interop.X64.prediction_post_rel_t c args -> Type
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Vale.Interop.X64.arg_reg_relation", "Vale.X64.Machine_s.reg_64", "Prims.bool", "Vale.X64.Machine_s.reg_xmm", "Vale.X64.Machine_Semantics_s.code", "Vale.Interop.X64.arg_list", "Vale.Interop.X64.prediction_pre_rel_t", "Vale.Interop.X64.prediction_post_rel_t", "Vale.Interop.Base.mem_roots", "Vale.X64.Machine_Semantics_s.machine_state", "FStar.Pervasives.Native.tuple3", "FStar.UInt64.t", "Vale.Interop.Heap_s.interop_heap", "Vale.Interop.X64.prediction_pre", "Vale.Interop.X64.prediction_post" ]
[]
false
false
false
false
true
let prediction (n: nat) (arg_reg: arg_reg_relation n) (regs_modified: (MS.reg_64 -> bool)) (xmms_modified: (MS.reg_xmm -> bool)) (c: BS.code) (args: arg_list) (pre_rel: prediction_pre_rel_t c args) (post_rel: prediction_post_rel_t c args) =
h0: mem_roots args {pre_rel h0} -> s0: BS.machine_state -> Ghost (UInt64.t & nat & interop_heap) (requires prediction_pre n arg_reg c args pre_rel h0 s0) (ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
false
Vale.Interop.X64.fsti
Vale.Interop.X64.arg_reg_relation
val arg_reg_relation : n: Prims.nat -> Type0
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 105, "end_line": 62, "start_col": 0, "start_line": 60 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
n: Prims.nat -> Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Vale.Interop.X64.arg_reg_relation'", "Prims.l_Forall", "Vale.X64.Machine_s.reg_64", "Prims.l_imp", "Prims.b2t", "FStar.Pervasives.Native.uu___is_Some", "Vale.Interop.X64.reg_nat", "Vale.Interop.X64.__proj__Rel__item__of_reg", "Prims.op_Equality", "Vale.Interop.X64.__proj__Rel__item__of_arg", "FStar.Pervasives.Native.__proj__Some__item__v" ]
[]
false
false
false
true
true
let arg_reg_relation (n: nat) =
(v: arg_reg_relation' n { forall (r: MS.reg_64). {:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r })
false
Vale.Interop.X64.fsti
Vale.Interop.X64.als_ret
val als_ret : Type
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 56, "end_line": 321, "start_col": 0, "start_line": 321 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB) // and another that just creates the vale state, a view upon the trusted one let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem) //////////////////////////////////////////////////////////////////////////////// let prediction_pre_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> prop let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} let return_val (sn:BS.machine_state) : return_val_t sn = UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn) let prediction_post_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> s0:BS.machine_state -> (UInt64.t & nat & interop_heap) -> sn:BS.machine_state -> prop [@__reduce__] let prediction_pre (n:nat) (arg_reg:arg_reg_relation n) (c:BS.code) (args:arg_list) (pre_rel: prediction_pre_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) = pre_rel h0 /\ s0 == fst (create_initial_trusted_state n arg_reg args h0) [@__reduce__] let prediction_post (n:nat) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (post_rel: prediction_post_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) (rax_fuel_mem:(UInt64.t & nat & interop_heap)) = let (rax, fuel, final_mem) = rax_fuel_mem in Some? (BS.machine_eval_code c fuel s0) /\ ( let s1 = Some?.v (BS.machine_eval_code c fuel s0) in let h1 = hs_of_mem final_mem in FStar.HyperStack.ST.equal_domains h0 h1 /\ B.modifies (loc_modified_args args) h0 h1 /\ mem_roots_p h1 args /\ heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\ calling_conventions s0 s1 regs_modified xmms_modified /\ rax == return_val s1 /\ post_rel h0 s0 rax_fuel_mem s1 ) let prediction (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (pre_rel:prediction_pre_rel_t c args) (post_rel:prediction_post_rel_t c args) = h0:mem_roots args{pre_rel h0} -> s0:BS.machine_state -> Ghost (UInt64.t & nat & interop_heap) (requires prediction_pre n arg_reg c args pre_rel h0 s0) (ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0) noeq type as_lowstar_sig_ret = | As_lowstar_sig_ret : n:nat -> args:arg_list -> fuel:nat -> final_mem:interop_heap -> as_lowstar_sig_ret
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
Type
Prims.Tot
[ "total" ]
[]
[ "FStar.Pervasives.Native.tuple2", "FStar.UInt64.t", "FStar.Ghost.erased", "Vale.Interop.X64.as_lowstar_sig_ret" ]
[]
false
false
false
true
true
let als_ret =
UInt64.t & Ghost.erased as_lowstar_sig_ret
false
Vale.Interop.X64.fsti
Vale.Interop.X64.register_of_args
val register_of_args (max_arity: nat) (arg_reg: arg_reg_relation max_arity) (n: nat) (args: arg_list{List.Tot.length args = n}) (regs: registers) : GTot (regs': registers{regs MS.rRsp == regs' MS.rRsp})
val register_of_args (max_arity: nat) (arg_reg: arg_reg_relation max_arity) (n: nat) (args: arg_list{List.Tot.length args = n}) (regs: registers) : GTot (regs': registers{regs MS.rRsp == regs' MS.rRsp})
let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 101, "end_line": 113, "start_col": 0, "start_line": 101 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x)
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
max_arity: Prims.nat -> arg_reg: Vale.Interop.X64.arg_reg_relation max_arity -> n: Prims.nat -> args: Vale.Interop.X64.arg_list{FStar.List.Tot.Base.length args = n} -> regs: Vale.Interop.X64.registers -> Prims.GTot (regs': Vale.Interop.X64.registers{regs Vale.X64.Machine_s.rRsp == regs' Vale.X64.Machine_s.rRsp})
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.nat", "Vale.Interop.X64.arg_reg_relation", "Vale.Interop.X64.arg_list", "Prims.b2t", "Prims.op_Equality", "FStar.List.Tot.Base.length", "Vale.Interop.Base.arg", "Vale.Interop.X64.registers", "Prims.list", "Prims.op_GreaterThan", "Vale.Interop.X64.register_of_args", "Prims.op_Subtraction", "Prims.bool", "Vale.Interop.X64.update_regs", "Prims.eq2", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.rRsp" ]
[ "recursion" ]
false
false
false
false
false
let rec register_of_args (max_arity: nat) (arg_reg: arg_reg_relation max_arity) (n: nat) (args: arg_list{List.Tot.length args = n}) (regs: registers) : GTot (regs': registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with | [] -> regs | hd :: tl -> if n > max_arity then register_of_args max_arity arg_reg (n - 1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
false
Vale.Interop.X64.fsti
Vale.Interop.X64.elim_rel_gen_t_nil
val elim_rel_gen_t_nil (#c #args #f: _) (x: rel_gen_t c [] args f) : f args
val elim_rel_gen_t_nil (#c #args #f: _) (x: rel_gen_t c [] args f) : f args
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f) : f args = x
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 5, "end_line": 414, "start_col": 0, "start_line": 412 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB) // and another that just creates the vale state, a view upon the trusted one let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem) //////////////////////////////////////////////////////////////////////////////// let prediction_pre_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> prop let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} let return_val (sn:BS.machine_state) : return_val_t sn = UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn) let prediction_post_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> s0:BS.machine_state -> (UInt64.t & nat & interop_heap) -> sn:BS.machine_state -> prop [@__reduce__] let prediction_pre (n:nat) (arg_reg:arg_reg_relation n) (c:BS.code) (args:arg_list) (pre_rel: prediction_pre_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) = pre_rel h0 /\ s0 == fst (create_initial_trusted_state n arg_reg args h0) [@__reduce__] let prediction_post (n:nat) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (post_rel: prediction_post_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) (rax_fuel_mem:(UInt64.t & nat & interop_heap)) = let (rax, fuel, final_mem) = rax_fuel_mem in Some? (BS.machine_eval_code c fuel s0) /\ ( let s1 = Some?.v (BS.machine_eval_code c fuel s0) in let h1 = hs_of_mem final_mem in FStar.HyperStack.ST.equal_domains h0 h1 /\ B.modifies (loc_modified_args args) h0 h1 /\ mem_roots_p h1 args /\ heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\ calling_conventions s0 s1 regs_modified xmms_modified /\ rax == return_val s1 /\ post_rel h0 s0 rax_fuel_mem s1 ) let prediction (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (pre_rel:prediction_pre_rel_t c args) (post_rel:prediction_post_rel_t c args) = h0:mem_roots args{pre_rel h0} -> s0:BS.machine_state -> Ghost (UInt64.t & nat & interop_heap) (requires prediction_pre n arg_reg c args pre_rel h0 s0) (ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0) noeq type as_lowstar_sig_ret = | As_lowstar_sig_ret : n:nat -> args:arg_list -> fuel:nat -> final_mem:interop_heap -> as_lowstar_sig_ret let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret [@__reduce__] let as_lowstar_sig_post (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (h0:mem_roots args) (#pre_rel:_) (#post_rel: _) (predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret:als_ret) (h1:HS.mem) = (* write it this way to be reduction friendly *) let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in h1 == hs_of_mem final_mem /\ prediction_pre n arg_reg c args pre_rel h0 s0 /\ (rax, fuel, final_mem) == predict h0 s0 /\ prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\ FStar.HyperStack.ST.equal_domains h0 h1) [@__reduce__] let as_lowstar_sig_post_weak (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (h0:mem_roots args) (#pre_rel:_) (#post_rel: _) (predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret:als_ret) (h1:HS.mem) = (* write it this way to be reduction friendly *) let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in (exists fuel final_mem s1. h1 == hs_of_mem final_mem /\ rax == return_val s1 /\ post_rel h0 s0 (return_val s1, fuel, final_mem) s1)) [@__reduce__] let as_lowstar_sig (c:BS.code) = n:nat -> arg_reg:arg_reg_relation n -> regs_modified:(MS.reg_64 -> bool) -> xmms_modified:(MS.reg_xmm -> bool) -> args:arg_list -> #pre_rel:_ -> #post_rel:_ -> predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1) val wrap_variadic (c:BS.code) : as_lowstar_sig c [@__reduce__] let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args [@__reduce__] let rec rel_gen_t (c:BS.code) (td:list td) (args:arg_list{List.length args + List.length td <= 20}) (f: arg_list -> Type) = match td with | [] -> f args | hd::tl -> x:td_as_type hd -> rel_gen_t c tl (x++args) f
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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.Interop.X64.rel_gen_t c [] args f -> f args
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.Machine_Semantics_s.code", "Vale.Interop.X64.arg_list", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Addition", "FStar.List.Tot.Base.length", "Vale.Interop.Base.arg", "Vale.Interop.Base.td", "Prims.Nil", "Vale.Interop.X64.rel_gen_t" ]
[]
false
false
false
false
false
let elim_rel_gen_t_nil #c #args #f (x: rel_gen_t c [] args f) : f args =
x
false
Vale.Interop.X64.fsti
Vale.Interop.X64.as_lowstar_sig_post_weak
val as_lowstar_sig_post_weak : n: Prims.nat -> arg_reg: Vale.Interop.X64.arg_reg_relation n -> regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) -> xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool) -> c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> h0: Vale.Interop.Base.mem_roots args -> predict: Vale.Interop.X64.prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel -> ret: Vale.Interop.X64.als_ret -> h1: FStar.Monotonic.HyperStack.mem -> Prims.logical
let as_lowstar_sig_post_weak (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (h0:mem_roots args) (#pre_rel:_) (#post_rel: _) (predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret:als_ret) (h1:HS.mem) = (* write it this way to be reduction friendly *) let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in (exists fuel final_mem s1. h1 == hs_of_mem final_mem /\ rax == return_val s1 /\ post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 57, "end_line": 378, "start_col": 0, "start_line": 352 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB) // and another that just creates the vale state, a view upon the trusted one let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem) //////////////////////////////////////////////////////////////////////////////// let prediction_pre_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> prop let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} let return_val (sn:BS.machine_state) : return_val_t sn = UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn) let prediction_post_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> s0:BS.machine_state -> (UInt64.t & nat & interop_heap) -> sn:BS.machine_state -> prop [@__reduce__] let prediction_pre (n:nat) (arg_reg:arg_reg_relation n) (c:BS.code) (args:arg_list) (pre_rel: prediction_pre_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) = pre_rel h0 /\ s0 == fst (create_initial_trusted_state n arg_reg args h0) [@__reduce__] let prediction_post (n:nat) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (post_rel: prediction_post_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) (rax_fuel_mem:(UInt64.t & nat & interop_heap)) = let (rax, fuel, final_mem) = rax_fuel_mem in Some? (BS.machine_eval_code c fuel s0) /\ ( let s1 = Some?.v (BS.machine_eval_code c fuel s0) in let h1 = hs_of_mem final_mem in FStar.HyperStack.ST.equal_domains h0 h1 /\ B.modifies (loc_modified_args args) h0 h1 /\ mem_roots_p h1 args /\ heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\ calling_conventions s0 s1 regs_modified xmms_modified /\ rax == return_val s1 /\ post_rel h0 s0 rax_fuel_mem s1 ) let prediction (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (pre_rel:prediction_pre_rel_t c args) (post_rel:prediction_post_rel_t c args) = h0:mem_roots args{pre_rel h0} -> s0:BS.machine_state -> Ghost (UInt64.t & nat & interop_heap) (requires prediction_pre n arg_reg c args pre_rel h0 s0) (ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0) noeq type as_lowstar_sig_ret = | As_lowstar_sig_ret : n:nat -> args:arg_list -> fuel:nat -> final_mem:interop_heap -> as_lowstar_sig_ret let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret [@__reduce__] let as_lowstar_sig_post (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (h0:mem_roots args) (#pre_rel:_) (#post_rel: _) (predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret:als_ret) (h1:HS.mem) = (* write it this way to be reduction friendly *) let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in h1 == hs_of_mem final_mem /\ prediction_pre n arg_reg c args pre_rel h0 s0 /\ (rax, fuel, final_mem) == predict h0 s0 /\ prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\ FStar.HyperStack.ST.equal_domains h0 h1)
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
n: Prims.nat -> arg_reg: Vale.Interop.X64.arg_reg_relation n -> regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) -> xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool) -> c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> h0: Vale.Interop.Base.mem_roots args -> predict: Vale.Interop.X64.prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel -> ret: Vale.Interop.X64.als_ret -> h1: FStar.Monotonic.HyperStack.mem -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Vale.Interop.X64.arg_reg_relation", "Vale.X64.Machine_s.reg_64", "Prims.bool", "Vale.X64.Machine_s.reg_xmm", "Vale.X64.Machine_Semantics_s.code", "Vale.Interop.X64.arg_list", "Vale.Interop.Base.mem_roots", "Vale.Interop.X64.prediction_pre_rel_t", "Vale.Interop.X64.prediction_post_rel_t", "Vale.Interop.X64.prediction", "Vale.Interop.X64.als_ret", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "Prims.eq2", "Vale.Interop.X64.__proj__As_lowstar_sig_ret__item__args", "Vale.Interop.X64.__proj__As_lowstar_sig_ret__item__n", "Prims.l_Exists", "Vale.Interop.Heap_s.interop_heap", "Vale.X64.Machine_Semantics_s.machine_state", "Vale.Interop.Heap_s.hs_of_mem", "FStar.UInt64.t", "Vale.Interop.X64.return_val", "FStar.Pervasives.Native.Mktuple3", "FStar.Pervasives.Native.fst", "Vale.Interop.X64.create_initial_trusted_state", "Vale.Interop.X64.__proj__As_lowstar_sig_ret__item__final_mem", "Vale.Interop.X64.__proj__As_lowstar_sig_ret__item__fuel", "Vale.Interop.X64.as_lowstar_sig_ret", "FStar.Ghost.reveal", "FStar.Pervasives.Native.snd", "FStar.Ghost.erased", "Prims.logical" ]
[]
false
false
false
false
true
let as_lowstar_sig_post_weak (n: nat) (arg_reg: arg_reg_relation n) (regs_modified: (MS.reg_64 -> bool)) (xmms_modified: (MS.reg_xmm -> bool)) (c: BS.code) (args: arg_list) (h0: mem_roots args) (#pre_rel #post_rel: _) (predict: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret: als_ret) (h1: HS.mem) =
let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in (exists fuel final_mem s1. h1 == hs_of_mem final_mem /\ rax == return_val s1 /\ post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
false
Vale.Interop.X64.fsti
Vale.Interop.X64.return_val_t
val return_val_t : sn: Vale.X64.Machine_Semantics_s.machine_state -> Type0
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 92, "end_line": 249, "start_col": 0, "start_line": 249 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB) // and another that just creates the vale state, a view upon the trusted one let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem) //////////////////////////////////////////////////////////////////////////////// let prediction_pre_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> prop
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
sn: Vale.X64.Machine_Semantics_s.machine_state -> Type0
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.Machine_Semantics_s.machine_state", "FStar.UInt64.t", "Prims.eq2", "Prims.int", "Prims.l_or", "FStar.UInt.size", "FStar.UInt64.n", "Prims.l_and", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "Prims.op_LessThan", "Vale.Def.Words_s.pow2_64", "FStar.UInt64.v", "Vale.X64.Machine_Semantics_s.eval_reg_64", "Vale.X64.Machine_s.rRax" ]
[]
false
false
false
true
true
let return_val_t (sn: BS.machine_state) =
r: UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
false
Vale.Interop.X64.fsti
Vale.Interop.X64.stack_of_args
val stack_of_args (max_arity n: nat) (rsp: int) (args: arg_list{List.Tot.length args = n}) (st: Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8)
val stack_of_args (max_arity n: nat) (rsp: int) (args: arg_list{List.Tot.length args = n}) (st: Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8)
let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 32, "end_line": 136, "start_col": 0, "start_line": 118 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
max_arity: Prims.nat -> n: Prims.nat -> rsp: Prims.int -> args: Vale.Interop.X64.arg_list{FStar.List.Tot.Base.length args = n} -> st: FStar.Map.t Prims.int Vale.Def.Words_s.nat8 -> Prims.GTot (FStar.Map.t Prims.int Vale.Def.Words_s.nat8)
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.nat", "Prims.int", "Vale.Interop.X64.arg_list", "Prims.b2t", "Prims.op_Equality", "FStar.List.Tot.Base.length", "Vale.Interop.Base.arg", "FStar.Map.t", "Vale.Def.Words_s.nat8", "Prims.list", "Prims.op_LessThanOrEqual", "Prims.bool", "Vale.Arch.MachineHeap_s.update_heap64", "Vale.Def.Words_s.nat64", "Vale.Interop.X64.arg_as_nat64", "Vale.Interop.X64.stack_of_args", "Prims.op_Subtraction", "Prims.op_Addition", "FStar.Mul.op_Star", "Vale.Interop.Assumptions.win" ]
[ "recursion" ]
false
false
false
false
false
let rec stack_of_args (max_arity n: nat) (rsp: int) (args: arg_list{List.Tot.length args = n}) (st: Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with | [] -> st | hd :: tl -> if n <= max_arity then st else let ptr = ((n - max_arity) - 1) * 8 + (if IA.win then 32 else 0) + 8 + rsp in let st1 = stack_of_args max_arity (n - 1) rsp tl st in let v = arg_as_nat64 hd in BS.update_heap64 ptr v st1
false
Vale.Interop.X64.fsti
Vale.Interop.X64.max_stdcall
val max_stdcall:nat
val max_stdcall:nat
let max_stdcall : nat = if IA.win then 4 else 6
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 47, "end_line": 648, "start_col": 0, "start_line": 648 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB) // and another that just creates the vale state, a view upon the trusted one let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem) //////////////////////////////////////////////////////////////////////////////// let prediction_pre_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> prop let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} let return_val (sn:BS.machine_state) : return_val_t sn = UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn) let prediction_post_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> s0:BS.machine_state -> (UInt64.t & nat & interop_heap) -> sn:BS.machine_state -> prop [@__reduce__] let prediction_pre (n:nat) (arg_reg:arg_reg_relation n) (c:BS.code) (args:arg_list) (pre_rel: prediction_pre_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) = pre_rel h0 /\ s0 == fst (create_initial_trusted_state n arg_reg args h0) [@__reduce__] let prediction_post (n:nat) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (post_rel: prediction_post_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) (rax_fuel_mem:(UInt64.t & nat & interop_heap)) = let (rax, fuel, final_mem) = rax_fuel_mem in Some? (BS.machine_eval_code c fuel s0) /\ ( let s1 = Some?.v (BS.machine_eval_code c fuel s0) in let h1 = hs_of_mem final_mem in FStar.HyperStack.ST.equal_domains h0 h1 /\ B.modifies (loc_modified_args args) h0 h1 /\ mem_roots_p h1 args /\ heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\ calling_conventions s0 s1 regs_modified xmms_modified /\ rax == return_val s1 /\ post_rel h0 s0 rax_fuel_mem s1 ) let prediction (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (pre_rel:prediction_pre_rel_t c args) (post_rel:prediction_post_rel_t c args) = h0:mem_roots args{pre_rel h0} -> s0:BS.machine_state -> Ghost (UInt64.t & nat & interop_heap) (requires prediction_pre n arg_reg c args pre_rel h0 s0) (ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0) noeq type as_lowstar_sig_ret = | As_lowstar_sig_ret : n:nat -> args:arg_list -> fuel:nat -> final_mem:interop_heap -> as_lowstar_sig_ret let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret [@__reduce__] let as_lowstar_sig_post (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (h0:mem_roots args) (#pre_rel:_) (#post_rel: _) (predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret:als_ret) (h1:HS.mem) = (* write it this way to be reduction friendly *) let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in h1 == hs_of_mem final_mem /\ prediction_pre n arg_reg c args pre_rel h0 s0 /\ (rax, fuel, final_mem) == predict h0 s0 /\ prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\ FStar.HyperStack.ST.equal_domains h0 h1) [@__reduce__] let as_lowstar_sig_post_weak (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (h0:mem_roots args) (#pre_rel:_) (#post_rel: _) (predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret:als_ret) (h1:HS.mem) = (* write it this way to be reduction friendly *) let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in (exists fuel final_mem s1. h1 == hs_of_mem final_mem /\ rax == return_val s1 /\ post_rel h0 s0 (return_val s1, fuel, final_mem) s1)) [@__reduce__] let as_lowstar_sig (c:BS.code) = n:nat -> arg_reg:arg_reg_relation n -> regs_modified:(MS.reg_64 -> bool) -> xmms_modified:(MS.reg_xmm -> bool) -> args:arg_list -> #pre_rel:_ -> #post_rel:_ -> predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1) val wrap_variadic (c:BS.code) : as_lowstar_sig c [@__reduce__] let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args [@__reduce__] let rec rel_gen_t (c:BS.code) (td:list td) (args:arg_list{List.length args + List.length td <= 20}) (f: arg_list -> Type) = match td with | [] -> f args | hd::tl -> x:td_as_type hd -> rel_gen_t c tl (x++args) f [@__reduce__] let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f) : f args = x [@__reduce__] let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f) : (x:td_as_type hd -> rel_gen_t c tl (x++args) f) = p let rec prediction_t (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:arg_list{List.length dom + List.length args <= 20}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) = match dom with | [] -> prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel | hd::tl -> x:td_as_type hd -> prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) [@__reduce__] let elim_predict_t_nil (#n:nat) (#arg_reg:arg_reg_relation n) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (#c:BS.code) (#args:arg_list) (#pre_rel:_) (#post_rel:_) (p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel) : prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel = p [@__reduce__] let elim_predict_t_cons (#n:nat) (#arg_reg:arg_reg_relation n) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (#c:BS.code) (hd:td) (tl:list td) (#args:arg_list{List.length args + List.length tl <= 19}) (#pre_rel:_) (#post_rel:_) (p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel) : x:td_as_type hd -> prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) = p [@__reduce__] let rec as_lowstar_sig_t (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:arg_list{List.length args + List.length dom <= 20}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) = match dom with | [] -> (unit -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ elim_rel_gen_t_nil pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 #pre_rel #post_rel (elim_predict_t_nil predict) ret h1)) | hd::tl -> x:td_as_type hd -> as_lowstar_sig_t n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) (elim_predict_t_cons hd tl predict x) private val wrap' (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td{List.length dom <= 20}) (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c)) (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel) : as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict [@__reduce__] private let rec as_lowstar_sig_t_weak' (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:list arg{List.length args + List.length dom <= 20}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) = match dom with | [] -> (unit -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ elim_rel_gen_t_nil pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0 #pre_rel #post_rel (elim_predict_t_nil predict) ret h1)) | hd::tl -> x:td_as_type hd -> as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) (elim_predict_t_cons hd tl predict x) private val wrap_weak' (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td{List.length dom <= 20}) (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c)) (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel) : as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict (* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *) [@__reduce__] let as_lowstar_sig_t_weak (n:nat{n <= 20}) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:list arg{List.length args + List.length dom <= n}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) = as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict val wrap_weak (n:nat{n <= 20}) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:arity_ok n td) (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c)) (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel) : as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 = let open MS in if IA.win then match i with | 0 -> rRcx | 1 -> rRdx | 2 -> rR8 | 3 -> rR9 else match i with | 0 -> rRdi | 1 -> rRsi | 2 -> rRdx | 3 -> rRcx | 4 -> rR8 | 5 -> rR9 //A partial inverse of the above function [@__reduce__] let arg_of_register (r:MS.reg_64) : option (reg_nat (if IA.win then 4 else 6)) = let open MS in if IA.win then match r with | 2 -> Some 0 // rcx | 3 -> Some 1 // rdx | 8 -> Some 2 // r8 | 9 -> Some 3 // r9 | _ -> None else match r with | 5 -> Some 0 // rdi | 4 -> Some 1 // rsi | 3 -> Some 2 // rdx | 2 -> Some 3 // rcx | 8 -> Some 4 // r8 | 9 -> Some 5 // r9 | _ -> None
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
Prims.nat
Prims.Tot
[ "total" ]
[]
[ "Vale.Interop.Assumptions.win", "Prims.bool", "Prims.nat" ]
[]
false
false
false
true
false
let max_stdcall:nat =
if IA.win then 4 else 6
false
Vale.Interop.X64.fsti
Vale.Interop.X64.upd_taint_map_arg
val upd_taint_map_arg (a: arg) (tm: taint_map) : GTot taint_map
val upd_taint_map_arg (a: arg) (tm: taint_map) : GTot taint_map
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 8, "end_line": 155, "start_col": 0, "start_line": 148 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
a: Vale.Interop.Base.arg -> tm: Vale.Interop.X64.taint_map -> Prims.GTot Vale.Interop.X64.taint_map
Prims.GTot
[ "sometrivial" ]
[]
[ "Vale.Interop.Base.arg", "Vale.Interop.X64.taint_map", "Vale.Arch.HeapTypes_s.base_typ", "Prims.bool", "Vale.Arch.HeapTypes_s.taint", "Vale.Interop.Base.td_as_type", "Vale.Interop.Base.TD_Buffer", "Vale.Interop.Base.Mkbuffer_qualifiers", "Vale.Interop.X64.upd_taint_map_b8", "Vale.Interop.Types.Buffer", "Vale.Interop.Base.TD_ImmBuffer", "Vale.Interop.Base.imm_to_b8", "Vale.Interop.Base.valid_base_type", "Vale.Interop.Base.TD_Base" ]
[]
false
false
false
false
false
let upd_taint_map_arg (a: arg) (tm: taint_map) : GTot taint_map =
match a with | (| TD_Buffer _ _ { taint = tnt } , x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ { taint = tnt } , x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _ , _ |) -> tm
false
Vale.Interop.X64.fsti
Vale.Interop.X64.taint_arg_b8
val taint_arg_b8 (a: arg{Some? (taint_of_arg a)}) : GTot b8
val taint_arg_b8 (a: arg{Some? (taint_of_arg a)}) : GTot b8
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 43, "end_line": 176, "start_col": 0, "start_line": 172 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
a: Vale.Interop.Base.arg{Some? (Vale.Interop.X64.taint_of_arg a)} -> Prims.GTot Vale.Interop.Types.b8
Prims.GTot
[ "sometrivial" ]
[]
[ "Vale.Interop.Base.arg", "Prims.b2t", "FStar.Pervasives.Native.uu___is_Some", "Vale.Arch.HeapTypes_s.taint", "Vale.Interop.X64.taint_of_arg", "Vale.Interop.Base.td", "Vale.Interop.Base.td_as_type", "Vale.Arch.HeapTypes_s.base_typ", "Vale.Interop.Base.buffer_qualifiers", "Vale.Interop.Types.Buffer", "LowStar.Buffer.buffer", "Vale.Interop.Types.base_typ_as_type", "Vale.Interop.Base.imm_to_b8", "Vale.Interop.Types.b8" ]
[]
false
false
false
false
false
let taint_arg_b8 (a: arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag , x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x
false
Vale.Interop.X64.fsti
Vale.Interop.X64.arg_as_nat64
val arg_as_nat64 (a: arg) : GTot MS.nat64
val arg_as_nat64 (a: arg) : GTot MS.nat64
let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 62, "end_line": 89, "start_col": 0, "start_line": 75 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
a: Vale.Interop.Base.arg -> Prims.GTot Vale.X64.Machine_s.nat64
Prims.GTot
[ "sometrivial" ]
[]
[ "Vale.Interop.Base.arg", "Vale.Interop.Base.td", "Vale.Interop.Base.td_as_type", "FStar.UInt8.v", "FStar.UInt16.v", "FStar.UInt32.v", "FStar.UInt64.v", "Vale.Arch.HeapTypes_s.base_typ", "Vale.Interop.Base.buffer_qualifiers", "Vale.Interop.Heap_s.global_addrs_map", "Vale.Interop.Types.b8", "Vale.Interop.Types.Buffer", "LowStar.Buffer.buffer", "Vale.Interop.Types.base_typ_as_type", "Vale.Interop.Base.imm_to_b8", "Vale.X64.Machine_s.nat64" ]
[]
false
false
false
false
false
let arg_as_nat64 (a: arg) : GTot MS.nat64 =
let (| tag , x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
false
Vale.Interop.X64.fsti
Vale.Interop.X64.create_initial_trusted_state
val create_initial_trusted_state (max_arity: nat) (arg_reg: arg_reg_relation max_arity) (args: arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap)
val create_initial_trusted_state (max_arity: nat) (arg_reg: arg_reg_relation max_arity) (args: arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap)
let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem)
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 13, "end_line": 242, "start_col": 0, "start_line": 211 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB)
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
max_arity: Prims.nat -> arg_reg: Vale.Interop.X64.arg_reg_relation max_arity -> args: Vale.Interop.X64.arg_list -> Vale.Interop.X64.state_builder_t max_arity args (Vale.X64.Machine_Semantics_s.machine_state * Vale.Interop.Heap_s.interop_heap)
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Vale.Interop.X64.arg_reg_relation", "Vale.Interop.X64.arg_list", "FStar.Monotonic.HyperStack.mem", "Vale.Interop.Base.mem_roots_p", "FStar.Pervasives.Native.Mktuple2", "Vale.X64.Machine_Semantics_s.machine_state", "Vale.Interop.Heap_s.interop_heap", "Vale.X64.Machine_Semantics_s.Mkmachine_state", "Vale.Arch.Heap.heap_create_impl", "Vale.X64.Machine_Semantics_s.Machine_stack", "FStar.Map.const", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.Arch.HeapTypes_s.Public", "Prims.Nil", "Vale.X64.Machine_s.observation", "Vale.Arch.HeapTypes_s.memTaint_t", "Vale.Interop.Base.create_memtaint", "Vale.Interop.Base.args_b8", "Vale.Interop.X64.mk_taint", "Vale.Interop.X64.init_taint", "Vale.Interop.Base.mk_mem", "FStar.Map.t", "Vale.Def.Words_s.nat8", "Vale.Interop.X64.stack_of_args", "FStar.List.Tot.Base.length", "Vale.Interop.Base.arg", "FStar.Map.const_on", "FStar.Set.empty", "FStar.FunctionalExtensionality.restricted_t", "Vale.X64.Machine_s.reg", "Vale.X64.Machine_s.t_reg", "FStar.FunctionalExtensionality.on_dom", "Vale.X64.Machine_s.reg_id", "Vale.Def.Words_s.nat64", "Vale.X64.Machine_s.rRsp", "Vale.X64.Machine_s.flag", "FStar.Pervasives.Native.option", "Prims.bool", "FStar.FunctionalExtensionality.on", "Vale.X64.Machine_Semantics_s.flag_val_t", "Vale.Interop.Assumptions.init_flags", "Vale.X64.Machine_s.reg_xmm", "Vale.Def.Types_s.quad32", "Vale.Interop.Assumptions.init_xmms", "Vale.Interop.X64.registers", "Prims.eq2", "Vale.Interop.Assumptions.init_regs", "Vale.Interop.X64.register_of_args", "FStar.Pervasives.Native.tuple2", "Vale.Interop.X64.state_builder_t" ]
[]
false
false
false
false
false
let create_initial_trusted_state (max_arity: nat) (arg_reg: arg_reg_relation max_arity) (args: arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (function | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in let stack = Map.const_on Set.empty 0 in let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let s0:BS.machine_state = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = [] } in (s0, mem)
false
Vale.Interop.X64.fsti
Vale.Interop.X64.arity_ok_stdcall
val arity_ok_stdcall : 'a: Type -> Type
let arity_ok_stdcall = arity_ok max_stdcall
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 43, "end_line": 649, "start_col": 0, "start_line": 649 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB) // and another that just creates the vale state, a view upon the trusted one let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem) //////////////////////////////////////////////////////////////////////////////// let prediction_pre_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> prop let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} let return_val (sn:BS.machine_state) : return_val_t sn = UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn) let prediction_post_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> s0:BS.machine_state -> (UInt64.t & nat & interop_heap) -> sn:BS.machine_state -> prop [@__reduce__] let prediction_pre (n:nat) (arg_reg:arg_reg_relation n) (c:BS.code) (args:arg_list) (pre_rel: prediction_pre_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) = pre_rel h0 /\ s0 == fst (create_initial_trusted_state n arg_reg args h0) [@__reduce__] let prediction_post (n:nat) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (post_rel: prediction_post_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) (rax_fuel_mem:(UInt64.t & nat & interop_heap)) = let (rax, fuel, final_mem) = rax_fuel_mem in Some? (BS.machine_eval_code c fuel s0) /\ ( let s1 = Some?.v (BS.machine_eval_code c fuel s0) in let h1 = hs_of_mem final_mem in FStar.HyperStack.ST.equal_domains h0 h1 /\ B.modifies (loc_modified_args args) h0 h1 /\ mem_roots_p h1 args /\ heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\ calling_conventions s0 s1 regs_modified xmms_modified /\ rax == return_val s1 /\ post_rel h0 s0 rax_fuel_mem s1 ) let prediction (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (pre_rel:prediction_pre_rel_t c args) (post_rel:prediction_post_rel_t c args) = h0:mem_roots args{pre_rel h0} -> s0:BS.machine_state -> Ghost (UInt64.t & nat & interop_heap) (requires prediction_pre n arg_reg c args pre_rel h0 s0) (ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0) noeq type as_lowstar_sig_ret = | As_lowstar_sig_ret : n:nat -> args:arg_list -> fuel:nat -> final_mem:interop_heap -> as_lowstar_sig_ret let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret [@__reduce__] let as_lowstar_sig_post (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (h0:mem_roots args) (#pre_rel:_) (#post_rel: _) (predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret:als_ret) (h1:HS.mem) = (* write it this way to be reduction friendly *) let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in h1 == hs_of_mem final_mem /\ prediction_pre n arg_reg c args pre_rel h0 s0 /\ (rax, fuel, final_mem) == predict h0 s0 /\ prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\ FStar.HyperStack.ST.equal_domains h0 h1) [@__reduce__] let as_lowstar_sig_post_weak (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (h0:mem_roots args) (#pre_rel:_) (#post_rel: _) (predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret:als_ret) (h1:HS.mem) = (* write it this way to be reduction friendly *) let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in (exists fuel final_mem s1. h1 == hs_of_mem final_mem /\ rax == return_val s1 /\ post_rel h0 s0 (return_val s1, fuel, final_mem) s1)) [@__reduce__] let as_lowstar_sig (c:BS.code) = n:nat -> arg_reg:arg_reg_relation n -> regs_modified:(MS.reg_64 -> bool) -> xmms_modified:(MS.reg_xmm -> bool) -> args:arg_list -> #pre_rel:_ -> #post_rel:_ -> predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1) val wrap_variadic (c:BS.code) : as_lowstar_sig c [@__reduce__] let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args [@__reduce__] let rec rel_gen_t (c:BS.code) (td:list td) (args:arg_list{List.length args + List.length td <= 20}) (f: arg_list -> Type) = match td with | [] -> f args | hd::tl -> x:td_as_type hd -> rel_gen_t c tl (x++args) f [@__reduce__] let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f) : f args = x [@__reduce__] let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f) : (x:td_as_type hd -> rel_gen_t c tl (x++args) f) = p let rec prediction_t (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:arg_list{List.length dom + List.length args <= 20}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) = match dom with | [] -> prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel | hd::tl -> x:td_as_type hd -> prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) [@__reduce__] let elim_predict_t_nil (#n:nat) (#arg_reg:arg_reg_relation n) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (#c:BS.code) (#args:arg_list) (#pre_rel:_) (#post_rel:_) (p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel) : prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel = p [@__reduce__] let elim_predict_t_cons (#n:nat) (#arg_reg:arg_reg_relation n) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (#c:BS.code) (hd:td) (tl:list td) (#args:arg_list{List.length args + List.length tl <= 19}) (#pre_rel:_) (#post_rel:_) (p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel) : x:td_as_type hd -> prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) = p [@__reduce__] let rec as_lowstar_sig_t (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:arg_list{List.length args + List.length dom <= 20}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) = match dom with | [] -> (unit -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ elim_rel_gen_t_nil pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 #pre_rel #post_rel (elim_predict_t_nil predict) ret h1)) | hd::tl -> x:td_as_type hd -> as_lowstar_sig_t n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) (elim_predict_t_cons hd tl predict x) private val wrap' (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td{List.length dom <= 20}) (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c)) (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel) : as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict [@__reduce__] private let rec as_lowstar_sig_t_weak' (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:list arg{List.length args + List.length dom <= 20}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) = match dom with | [] -> (unit -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ elim_rel_gen_t_nil pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0 #pre_rel #post_rel (elim_predict_t_nil predict) ret h1)) | hd::tl -> x:td_as_type hd -> as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) (elim_predict_t_cons hd tl predict x) private val wrap_weak' (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td{List.length dom <= 20}) (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c)) (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel) : as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict (* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *) [@__reduce__] let as_lowstar_sig_t_weak (n:nat{n <= 20}) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:list arg{List.length args + List.length dom <= n}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) = as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict val wrap_weak (n:nat{n <= 20}) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:arity_ok n td) (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c)) (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel) : as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 = let open MS in if IA.win then match i with | 0 -> rRcx | 1 -> rRdx | 2 -> rR8 | 3 -> rR9 else match i with | 0 -> rRdi | 1 -> rRsi | 2 -> rRdx | 3 -> rRcx | 4 -> rR8 | 5 -> rR9 //A partial inverse of the above function [@__reduce__] let arg_of_register (r:MS.reg_64) : option (reg_nat (if IA.win then 4 else 6)) = let open MS in if IA.win then match r with | 2 -> Some 0 // rcx | 3 -> Some 1 // rdx | 8 -> Some 2 // r8 | 9 -> Some 3 // r9 | _ -> None else match r with | 5 -> Some 0 // rdi | 4 -> Some 1 // rsi | 3 -> Some 2 // rdx | 2 -> Some 3 // rcx | 8 -> Some 4 // r8 | 9 -> Some 5 // r9 | _ -> None
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
'a: Type -> Type
Prims.Tot
[ "total" ]
[]
[ "Vale.Interop.X64.arity_ok", "Vale.Interop.X64.max_stdcall" ]
[]
false
false
false
true
true
let arity_ok_stdcall =
arity_ok max_stdcall
false
Vale.Interop.X64.fsti
Vale.Interop.X64.xmms_modified_stdcall
val xmms_modified_stdcall: MS.reg_xmm -> bool
val xmms_modified_stdcall: MS.reg_xmm -> bool
let xmms_modified_stdcall:MS.reg_xmm -> bool = fun (x:MS.reg_xmm) -> let open MS in if IA.win then ( // These xmms are callee-saved on Windows if x = 6 || x = 7 || x = 8 || x = 9 || x = 10 || x = 11 || x = 12 || x = 13 || x = 14 || x = 15 then false else true ) else // No xmm needs to be callee-saved on Linux true
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 8, "end_line": 676, "start_col": 0, "start_line": 668 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB) // and another that just creates the vale state, a view upon the trusted one let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem) //////////////////////////////////////////////////////////////////////////////// let prediction_pre_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> prop let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} let return_val (sn:BS.machine_state) : return_val_t sn = UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn) let prediction_post_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> s0:BS.machine_state -> (UInt64.t & nat & interop_heap) -> sn:BS.machine_state -> prop [@__reduce__] let prediction_pre (n:nat) (arg_reg:arg_reg_relation n) (c:BS.code) (args:arg_list) (pre_rel: prediction_pre_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) = pre_rel h0 /\ s0 == fst (create_initial_trusted_state n arg_reg args h0) [@__reduce__] let prediction_post (n:nat) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (post_rel: prediction_post_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) (rax_fuel_mem:(UInt64.t & nat & interop_heap)) = let (rax, fuel, final_mem) = rax_fuel_mem in Some? (BS.machine_eval_code c fuel s0) /\ ( let s1 = Some?.v (BS.machine_eval_code c fuel s0) in let h1 = hs_of_mem final_mem in FStar.HyperStack.ST.equal_domains h0 h1 /\ B.modifies (loc_modified_args args) h0 h1 /\ mem_roots_p h1 args /\ heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\ calling_conventions s0 s1 regs_modified xmms_modified /\ rax == return_val s1 /\ post_rel h0 s0 rax_fuel_mem s1 ) let prediction (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (pre_rel:prediction_pre_rel_t c args) (post_rel:prediction_post_rel_t c args) = h0:mem_roots args{pre_rel h0} -> s0:BS.machine_state -> Ghost (UInt64.t & nat & interop_heap) (requires prediction_pre n arg_reg c args pre_rel h0 s0) (ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0) noeq type as_lowstar_sig_ret = | As_lowstar_sig_ret : n:nat -> args:arg_list -> fuel:nat -> final_mem:interop_heap -> as_lowstar_sig_ret let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret [@__reduce__] let as_lowstar_sig_post (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (h0:mem_roots args) (#pre_rel:_) (#post_rel: _) (predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret:als_ret) (h1:HS.mem) = (* write it this way to be reduction friendly *) let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in h1 == hs_of_mem final_mem /\ prediction_pre n arg_reg c args pre_rel h0 s0 /\ (rax, fuel, final_mem) == predict h0 s0 /\ prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\ FStar.HyperStack.ST.equal_domains h0 h1) [@__reduce__] let as_lowstar_sig_post_weak (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (h0:mem_roots args) (#pre_rel:_) (#post_rel: _) (predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret:als_ret) (h1:HS.mem) = (* write it this way to be reduction friendly *) let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in (exists fuel final_mem s1. h1 == hs_of_mem final_mem /\ rax == return_val s1 /\ post_rel h0 s0 (return_val s1, fuel, final_mem) s1)) [@__reduce__] let as_lowstar_sig (c:BS.code) = n:nat -> arg_reg:arg_reg_relation n -> regs_modified:(MS.reg_64 -> bool) -> xmms_modified:(MS.reg_xmm -> bool) -> args:arg_list -> #pre_rel:_ -> #post_rel:_ -> predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1) val wrap_variadic (c:BS.code) : as_lowstar_sig c [@__reduce__] let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args [@__reduce__] let rec rel_gen_t (c:BS.code) (td:list td) (args:arg_list{List.length args + List.length td <= 20}) (f: arg_list -> Type) = match td with | [] -> f args | hd::tl -> x:td_as_type hd -> rel_gen_t c tl (x++args) f [@__reduce__] let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f) : f args = x [@__reduce__] let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f) : (x:td_as_type hd -> rel_gen_t c tl (x++args) f) = p let rec prediction_t (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:arg_list{List.length dom + List.length args <= 20}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) = match dom with | [] -> prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel | hd::tl -> x:td_as_type hd -> prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) [@__reduce__] let elim_predict_t_nil (#n:nat) (#arg_reg:arg_reg_relation n) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (#c:BS.code) (#args:arg_list) (#pre_rel:_) (#post_rel:_) (p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel) : prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel = p [@__reduce__] let elim_predict_t_cons (#n:nat) (#arg_reg:arg_reg_relation n) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (#c:BS.code) (hd:td) (tl:list td) (#args:arg_list{List.length args + List.length tl <= 19}) (#pre_rel:_) (#post_rel:_) (p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel) : x:td_as_type hd -> prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) = p [@__reduce__] let rec as_lowstar_sig_t (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:arg_list{List.length args + List.length dom <= 20}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) = match dom with | [] -> (unit -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ elim_rel_gen_t_nil pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 #pre_rel #post_rel (elim_predict_t_nil predict) ret h1)) | hd::tl -> x:td_as_type hd -> as_lowstar_sig_t n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) (elim_predict_t_cons hd tl predict x) private val wrap' (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td{List.length dom <= 20}) (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c)) (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel) : as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict [@__reduce__] private let rec as_lowstar_sig_t_weak' (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:list arg{List.length args + List.length dom <= 20}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) = match dom with | [] -> (unit -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ elim_rel_gen_t_nil pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0 #pre_rel #post_rel (elim_predict_t_nil predict) ret h1)) | hd::tl -> x:td_as_type hd -> as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) (elim_predict_t_cons hd tl predict x) private val wrap_weak' (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td{List.length dom <= 20}) (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c)) (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel) : as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict (* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *) [@__reduce__] let as_lowstar_sig_t_weak (n:nat{n <= 20}) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:list arg{List.length args + List.length dom <= n}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) = as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict val wrap_weak (n:nat{n <= 20}) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:arity_ok n td) (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c)) (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel) : as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 = let open MS in if IA.win then match i with | 0 -> rRcx | 1 -> rRdx | 2 -> rR8 | 3 -> rR9 else match i with | 0 -> rRdi | 1 -> rRsi | 2 -> rRdx | 3 -> rRcx | 4 -> rR8 | 5 -> rR9 //A partial inverse of the above function [@__reduce__] let arg_of_register (r:MS.reg_64) : option (reg_nat (if IA.win then 4 else 6)) = let open MS in if IA.win then match r with | 2 -> Some 0 // rcx | 3 -> Some 1 // rdx | 8 -> Some 2 // r8 | 9 -> Some 3 // r9 | _ -> None else match r with | 5 -> Some 0 // rdi | 4 -> Some 1 // rsi | 3 -> Some 2 // rdx | 2 -> Some 3 // rcx | 8 -> Some 4 // r8 | 9 -> Some 5 // r9 | _ -> None let max_stdcall : nat = if IA.win then 4 else 6 let arity_ok_stdcall = arity_ok max_stdcall let arg_reg_stdcall : arg_reg_relation max_stdcall = Rel arg_of_register register_of_arg_i let regs_modified_stdcall:MS.reg_64 -> bool = fun (r:MS.reg_64) -> let open MS in if IA.win then ( // These registers are callee-saved on Windows if r = rRbx || r = rRbp || r = rRdi || r = rRsi || r = rRsp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false // All the other ones may be modified else true ) else ( // These registers are callee-saved on Linux if r = rRbx || r = rRbp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false // All the other ones may be modified else true )
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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.X64.Machine_s.reg_xmm -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.Machine_s.reg_xmm", "Vale.Interop.Assumptions.win", "Prims.op_BarBar", "Prims.op_Equality", "Prims.int", "Prims.bool" ]
[]
false
false
false
true
false
let xmms_modified_stdcall: MS.reg_xmm -> bool =
fun (x: MS.reg_xmm) -> let open MS in if IA.win then (if x = 6 || x = 7 || x = 8 || x = 9 || x = 10 || x = 11 || x = 12 || x = 13 || x = 14 || x = 15 then false else true) else true
false
Vale.Interop.X64.fsti
Vale.Interop.X64.wrap_weak_stdcall
val wrap_weak_stdcall : c: Vale.X64.Machine_Semantics_s.code -> dom: Prims.list Vale.Interop.Base.td {FStar.List.Tot.Base.length dom <= 20} -> predict: Vale.Interop.X64.prediction_t Vale.Interop.X64.max_stdcall Vale.Interop.X64.arg_reg_stdcall Vale.Interop.X64.regs_modified_stdcall Vale.Interop.X64.xmms_modified_stdcall c dom [] pre_rel post_rel -> Vale.Interop.X64.as_lowstar_sig_t_weak' Vale.Interop.X64.max_stdcall Vale.Interop.X64.arg_reg_stdcall Vale.Interop.X64.regs_modified_stdcall Vale.Interop.X64.xmms_modified_stdcall c dom [] pre_rel post_rel predict
let wrap_weak_stdcall = wrap_weak' max_stdcall arg_reg_stdcall regs_modified_stdcall xmms_modified_stdcall
{ "file_name": "vale/specs/interop/Vale.Interop.X64.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 106, "end_line": 682, "start_col": 0, "start_line": 682 }
module Vale.Interop.X64 open FStar.Mul open Vale.Interop.Base open Vale.Arch.HeapTypes_s open Vale.Arch.Heap module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module List = FStar.List.Tot //////////////////////////////////////////////////////////////////////////////// //The calling convention w.r.t the register mapping //////////////////////////////////////////////////////////////////////////////// let calling_conventions (s0 s1:BS.machine_state) (regs_modified: MS.reg_64 -> bool) (xmms_modified: MS.reg_xmm -> bool) = let s0 = s0 in let s1 = s1 in s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\ (forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)} match r with | MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r) | MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r) ) let reg_nat (n:nat) = i:nat{i < n} let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } (* We limit the number of args we can pass through the interop wrappers to an arbitrary 20. This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited. for extra arguments + the extra slots needed. Note that this number can be increased if needed*) let arg_list = l:list arg{List.Tot.length l <= 20} let arg_list_sb = l:list arg{List.Tot.length l <= 21} unfold let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y noeq type arg_reg_relation' (n:nat) = | Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) -> of_arg:(reg_nat n -> MS.reg_64){ // This function should be injective injective of_arg /\ // rRsp is not a valid register to store paramters (forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\ // of_reg should always return Some when the register corresponds to an of_arg (forall (i:reg_nat n).{:pattern of_arg i} Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} -> arg_reg_relation' n unfold let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{ // of_reg is a partial inverse of of_arg forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) let registers = MS.reg_64 -> MS.nat64 let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers = fun (r:MS.reg_64) -> match arg_reg.of_reg r with | Some j -> if i = j then v else regs r | _ -> regs r [@__reduce__] let arg_as_nat64 (a:arg) : GTot MS.nat64 = let (| tag, x |) = a in match tag with | TD_Base TUInt8 -> UInt8.v x | TD_Base TUInt16 -> UInt16.v x | TD_Base TUInt32 -> UInt32.v x | TD_Base TUInt64 -> UInt64.v x | TD_Buffer src _ _ -> let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in global_addrs_map b | TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x) [@__reduce__] let update_regs (n:nat) (arg_reg:arg_reg_relation n) (x:arg) (i:reg_nat n) (regs:registers) : GTot registers = upd_reg n arg_reg regs i (arg_as_nat64 x) [@__reduce__] let rec register_of_args (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (n:nat) (args:arg_list{List.Tot.length args = n}) (regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) = match args with | [] -> regs | hd::tl -> if n > max_arity then // This arguments will be passed on the stack register_of_args max_arity arg_reg (n-1) tl regs else update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs) // Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that // this only happens for stdcalls [@__reduce__] let rec stack_of_args (max_arity:nat) (n:nat) (rsp:int) (args:arg_list{List.Tot.length args = n}) (st:Map.t int Vale.Def.Words_s.nat8) : GTot (Map.t int Vale.Def.Words_s.nat8) = match args with | [] -> st | hd::tl -> if n <= max_arity then st // We can pass the remaining args in registers else let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left + (if IA.win then 32 else 0) // The shadow space on Windows comes next + 8 // The return address is then pushed on the stack + rsp // And we then have all the extra slots required for the Vale procedure in let st1 = stack_of_args max_arity (n-1) rsp tl st in let v = arg_as_nat64 hd in // We will store the arg hd BS.update_heap64 ptr v st1 //////////////////////////////////////////////////////////////////////////////// let taint_map = b8 -> GTot taint let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map = fun (y:b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y [@__reduce__] let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map = match a with | (| TD_Buffer _ _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (Buffer true x) tnt | (| TD_ImmBuffer src _ {taint=tnt}, x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt | (| TD_Base _, _ |) -> tm let init_taint : taint_map = fun r -> Public [@__reduce__] let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map = List.fold_right_gtot args upd_taint_map_arg init_taint let taint_of_arg (a:arg) = let (| tag, x |) = a in match tag with | TD_ImmBuffer _ TUInt64 {taint=tnt} | TD_ImmBuffer _ TUInt128 {taint=tnt} | TD_Buffer _ TUInt64 {taint=tnt} | TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt | _ -> None let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 = let (| tag, x |) = a in match tag with | TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src)) | TD_ImmBuffer src _ _ -> imm_to_b8 src x let rec taint_arg_args_b8_mem (args:arg_list) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> List.memP (taint_arg_b8 a) (args_b8 args)) = match args with | [] -> () | hd::tl -> taint_arg_args_b8_mem tl a let rec mk_taint_equiv (args:arg_list_sb{disjoint_or_eq args}) (a:arg) : Lemma (List.memP a args /\ Some? (taint_of_arg a) ==> Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a)) = match args with | [] -> () | hd::tl -> mk_taint_equiv tl a; let (| tag, x |) = hd in match tag with | TD_Base _ -> () | TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ -> disjoint_or_eq_cons hd tl; BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl //////////////////////////////////////////////////////////////////////////////// let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) = h0:HS.mem{mem_roots_p h0 args} -> GTot codom // Splitting the construction of the initial state into two functions // one that creates the initial trusted state (i.e., part of our TCB) // and another that just creates the vale state, a view upon the trusted one let create_initial_trusted_state (max_arity:nat) (arg_reg:arg_reg_relation max_arity) (args:arg_list) : state_builder_t max_arity args (BS.machine_state & interop_heap) = fun h0 -> let open MS in let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in let xmms = IA.init_xmms in let flags = FunctionalExtensionality.on flag IA.init_flags in let init_rsp = regs_64 rRsp in let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r -> match r with | Reg 0 r -> regs_64 r | Reg 1 r -> xmms r) in // Create an initial empty stack let stack = Map.const_on Set.empty 0 in // Spill additional arguments on the stack let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in let mem:interop_heap = mk_mem args h0 in let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in let (s0:BS.machine_state) = { BS.ms_ok = true; BS.ms_regs = regs; BS.ms_flags = flags; BS.ms_heap = heap_create_impl mem memTaint; BS.ms_stack = BS.Machine_stack init_rsp stack; BS.ms_stackTaint = Map.const Public; BS.ms_trace = []; } in (s0, mem) //////////////////////////////////////////////////////////////////////////////// let prediction_pre_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> prop let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} let return_val (sn:BS.machine_state) : return_val_t sn = UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn) let prediction_post_rel_t (c:BS.code) (args:arg_list) = h0:mem_roots args -> s0:BS.machine_state -> (UInt64.t & nat & interop_heap) -> sn:BS.machine_state -> prop [@__reduce__] let prediction_pre (n:nat) (arg_reg:arg_reg_relation n) (c:BS.code) (args:arg_list) (pre_rel: prediction_pre_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) = pre_rel h0 /\ s0 == fst (create_initial_trusted_state n arg_reg args h0) [@__reduce__] let prediction_post (n:nat) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (post_rel: prediction_post_rel_t c args) (h0:mem_roots args) (s0:BS.machine_state) (rax_fuel_mem:(UInt64.t & nat & interop_heap)) = let (rax, fuel, final_mem) = rax_fuel_mem in Some? (BS.machine_eval_code c fuel s0) /\ ( let s1 = Some?.v (BS.machine_eval_code c fuel s0) in let h1 = hs_of_mem final_mem in FStar.HyperStack.ST.equal_domains h0 h1 /\ B.modifies (loc_modified_args args) h0 h1 /\ mem_roots_p h1 args /\ heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\ calling_conventions s0 s1 regs_modified xmms_modified /\ rax == return_val s1 /\ post_rel h0 s0 rax_fuel_mem s1 ) let prediction (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (pre_rel:prediction_pre_rel_t c args) (post_rel:prediction_post_rel_t c args) = h0:mem_roots args{pre_rel h0} -> s0:BS.machine_state -> Ghost (UInt64.t & nat & interop_heap) (requires prediction_pre n arg_reg c args pre_rel h0 s0) (ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0) noeq type as_lowstar_sig_ret = | As_lowstar_sig_ret : n:nat -> args:arg_list -> fuel:nat -> final_mem:interop_heap -> as_lowstar_sig_ret let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret [@__reduce__] let as_lowstar_sig_post (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (h0:mem_roots args) (#pre_rel:_) (#post_rel: _) (predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret:als_ret) (h1:HS.mem) = (* write it this way to be reduction friendly *) let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in h1 == hs_of_mem final_mem /\ prediction_pre n arg_reg c args pre_rel h0 s0 /\ (rax, fuel, final_mem) == predict h0 s0 /\ prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\ FStar.HyperStack.ST.equal_domains h0 h1) [@__reduce__] let as_lowstar_sig_post_weak (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (args:arg_list) (h0:mem_roots args) (#pre_rel:_) (#post_rel: _) (predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) (ret:als_ret) (h1:HS.mem) = (* write it this way to be reduction friendly *) let rax = fst ret in let ret = Ghost.reveal (snd ret) in args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\ (let fuel = As_lowstar_sig_ret?.fuel ret in let final_mem = As_lowstar_sig_ret?.final_mem ret in let s0 = fst (create_initial_trusted_state n arg_reg args h0) in (exists fuel final_mem s1. h1 == hs_of_mem final_mem /\ rax == return_val s1 /\ post_rel h0 s0 (return_val s1, fuel, final_mem) s1)) [@__reduce__] let as_lowstar_sig (c:BS.code) = n:nat -> arg_reg:arg_reg_relation n -> regs_modified:(MS.reg_64 -> bool) -> xmms_modified:(MS.reg_xmm -> bool) -> args:arg_list -> #pre_rel:_ -> #post_rel:_ -> predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1) val wrap_variadic (c:BS.code) : as_lowstar_sig c [@__reduce__] let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args [@__reduce__] let rec rel_gen_t (c:BS.code) (td:list td) (args:arg_list{List.length args + List.length td <= 20}) (f: arg_list -> Type) = match td with | [] -> f args | hd::tl -> x:td_as_type hd -> rel_gen_t c tl (x++args) f [@__reduce__] let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f) : f args = x [@__reduce__] let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f) : (x:td_as_type hd -> rel_gen_t c tl (x++args) f) = p let rec prediction_t (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:arg_list{List.length dom + List.length args <= 20}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) = match dom with | [] -> prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel | hd::tl -> x:td_as_type hd -> prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) [@__reduce__] let elim_predict_t_nil (#n:nat) (#arg_reg:arg_reg_relation n) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (#c:BS.code) (#args:arg_list) (#pre_rel:_) (#post_rel:_) (p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel) : prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel = p [@__reduce__] let elim_predict_t_cons (#n:nat) (#arg_reg:arg_reg_relation n) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (#c:BS.code) (hd:td) (tl:list td) (#args:arg_list{List.length args + List.length tl <= 19}) (#pre_rel:_) (#post_rel:_) (p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel) : x:td_as_type hd -> prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) = p [@__reduce__] let rec as_lowstar_sig_t (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:arg_list{List.length args + List.length dom <= 20}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) = match dom with | [] -> (unit -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ elim_rel_gen_t_nil pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 #pre_rel #post_rel (elim_predict_t_nil predict) ret h1)) | hd::tl -> x:td_as_type hd -> as_lowstar_sig_t n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) (elim_predict_t_cons hd tl predict x) private val wrap' (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td{List.length dom <= 20}) (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c)) (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel) : as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict [@__reduce__] private let rec as_lowstar_sig_t_weak' (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:list arg{List.length args + List.length dom <= 20}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) = match dom with | [] -> (unit -> FStar.HyperStack.ST.Stack als_ret (requires (fun h0 -> mem_roots_p h0 args /\ elim_rel_gen_t_nil pre_rel h0)) (ensures fun h0 ret h1 -> as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0 #pre_rel #post_rel (elim_predict_t_nil predict) ret h1)) | hd::tl -> x:td_as_type hd -> as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c tl (x ++ args) (elim_rel_gen_t_cons hd tl pre_rel x) (elim_rel_gen_t_cons hd tl post_rel x) (elim_predict_t_cons hd tl predict x) private val wrap_weak' (n:nat) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td{List.length dom <= 20}) (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c)) (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel) : as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict (* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *) [@__reduce__] let as_lowstar_sig_t_weak (n:nat{n <= 20}) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:list td) (args:list arg{List.length args + List.length dom <= n}) (pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c)) (post_rel:rel_gen_t c dom args (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) = as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict val wrap_weak (n:nat{n <= 20}) (arg_reg:arg_reg_relation n) (regs_modified:MS.reg_64 -> bool) (xmms_modified:MS.reg_xmm -> bool) (c:BS.code) (dom:arity_ok n td) (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c)) (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c)) (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel) : as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 = let open MS in if IA.win then match i with | 0 -> rRcx | 1 -> rRdx | 2 -> rR8 | 3 -> rR9 else match i with | 0 -> rRdi | 1 -> rRsi | 2 -> rRdx | 3 -> rRcx | 4 -> rR8 | 5 -> rR9 //A partial inverse of the above function [@__reduce__] let arg_of_register (r:MS.reg_64) : option (reg_nat (if IA.win then 4 else 6)) = let open MS in if IA.win then match r with | 2 -> Some 0 // rcx | 3 -> Some 1 // rdx | 8 -> Some 2 // r8 | 9 -> Some 3 // r9 | _ -> None else match r with | 5 -> Some 0 // rdi | 4 -> Some 1 // rsi | 3 -> Some 2 // rdx | 2 -> Some 3 // rcx | 8 -> Some 4 // r8 | 9 -> Some 5 // r9 | _ -> None let max_stdcall : nat = if IA.win then 4 else 6 let arity_ok_stdcall = arity_ok max_stdcall let arg_reg_stdcall : arg_reg_relation max_stdcall = Rel arg_of_register register_of_arg_i let regs_modified_stdcall:MS.reg_64 -> bool = fun (r:MS.reg_64) -> let open MS in if IA.win then ( // These registers are callee-saved on Windows if r = rRbx || r = rRbp || r = rRdi || r = rRsi || r = rRsp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false // All the other ones may be modified else true ) else ( // These registers are callee-saved on Linux if r = rRbx || r = rRbp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false // All the other ones may be modified else true ) let xmms_modified_stdcall:MS.reg_xmm -> bool = fun (x:MS.reg_xmm) -> let open MS in if IA.win then ( // These xmms are callee-saved on Windows if x = 6 || x = 7 || x = 8 || x = 9 || x = 10 || x = 11 || x = 12 || x = 13 || x = 14 || x = 15 then false else true ) else // No xmm needs to be callee-saved on Linux true // For stdcalls, we do not have the arity_ok restriction: We can pass as many arguments as we want, the extra arguments will be passed on the stack [@__reduce__] let as_lowstar_sig_t_weak_stdcall = as_lowstar_sig_t_weak' max_stdcall arg_reg_stdcall regs_modified_stdcall xmms_modified_stdcall
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.Heap.fsti.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.StrongExcludedMiddle.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked", "FStar.FunctionalExtensionality.fsti.checked", "FStar.BigOps.fsti.checked" ], "interface_file": false, "source_file": "Vale.Interop.X64.fsti" }
[ { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "List" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Arch.Heap", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapTypes_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "short_module": null }, { "abbrev": false, "full_module": "Vale.Interop", "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
c: Vale.X64.Machine_Semantics_s.code -> dom: Prims.list Vale.Interop.Base.td {FStar.List.Tot.Base.length dom <= 20} -> predict: Vale.Interop.X64.prediction_t Vale.Interop.X64.max_stdcall Vale.Interop.X64.arg_reg_stdcall Vale.Interop.X64.regs_modified_stdcall Vale.Interop.X64.xmms_modified_stdcall c dom [] pre_rel post_rel -> Vale.Interop.X64.as_lowstar_sig_t_weak' Vale.Interop.X64.max_stdcall Vale.Interop.X64.arg_reg_stdcall Vale.Interop.X64.regs_modified_stdcall Vale.Interop.X64.xmms_modified_stdcall c dom [] pre_rel post_rel predict
Prims.Tot
[ "total" ]
[]
[ "Vale.Interop.X64.wrap_weak'", "Vale.Interop.X64.max_stdcall", "Vale.Interop.X64.arg_reg_stdcall", "Vale.Interop.X64.regs_modified_stdcall", "Vale.Interop.X64.xmms_modified_stdcall" ]
[]
false
false
false
false
false
let wrap_weak_stdcall =
wrap_weak' max_stdcall arg_reg_stdcall regs_modified_stdcall xmms_modified_stdcall
false