effect
stringclasses 48
values | original_source_type
stringlengths 0
23k
| opens_and_abbrevs
listlengths 2
92
| isa_cross_project_example
bool 1
class | source_definition
stringlengths 9
57.9k
| partial_definition
stringlengths 7
23.3k
| is_div
bool 2
classes | is_type
null | is_proof
bool 2
classes | completed_definiton
stringlengths 1
250k
| dependencies
dict | effect_flags
sequencelengths 0
2
| ideal_premises
sequencelengths 0
236
| mutual_with
sequencelengths 0
11
| file_context
stringlengths 0
407k
| interleaved
bool 1
class | is_simply_typed
bool 2
classes | file_name
stringlengths 5
48
| vconfig
dict | is_simple_lemma
null | source_type
stringlengths 10
23k
| proof_features
sequencelengths 0
1
| name
stringlengths 8
95
| source
dict | verbose_type
stringlengths 1
7.42k
| source_range
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Prims.Pure | val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let shift_arithmetic_right a s = Mk (shift_arithmetic_right (v a) (UInt32.v s)) | val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
let shift_arithmetic_right a s = | false | null | false | Mk (shift_arithmetic_right (v a) (UInt32.v s)) | {
"checked_file": "FStar.Int64.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Int64.fst"
} | [] | [
"FStar.Int64.t",
"FStar.UInt32.t",
"FStar.Int64.Mk",
"FStar.Int.shift_arithmetic_right",
"FStar.Int64.n",
"FStar.Int64.v",
"FStar.UInt32.v"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int64
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
type t : eqtype =
| Mk: v:int_t n -> t
let v x = x.v
let int_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = int_to_t 0
let one =
FStar.Math.Lemmas.pow2_lt_compat (n - 1) 1;
int_to_t 1
let add a b = Mk (add (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let div a b = Mk (div (v a) (v b))
let rem a b = Mk (mod (v a) (v b))
let logand x y = Mk (logand (v x) (v y))
let logxor x y = Mk (logxor (v x) (v y))
let logor x y = Mk (logor (v x) (v y))
let lognot x = Mk (lognot (v x))
let shift_right a s = Mk (shift_right (v a) (UInt32.v s))
let shift_left a s = Mk (shift_left (v a) (UInt32.v s)) | false | false | FStar.Int64.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) | [] | FStar.Int64.shift_arithmetic_right | {
"file_name": "ulib/FStar.Int64.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int64.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int64.t | {
"end_col": 79,
"end_line": 70,
"start_col": 33,
"start_line": 70
} |
Prims.Pure | val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let div a b = Mk (div (v a) (v b)) | val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c))
let div a b = | false | null | false | Mk (div (v a) (v b)) | {
"checked_file": "FStar.Int64.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Int64.fst"
} | [] | [
"FStar.Int64.t",
"Prims.b2t",
"Prims.op_disEquality",
"Prims.int",
"FStar.Int64.v",
"FStar.Int64.Mk",
"FStar.Int.div",
"FStar.Int64.n"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int64
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
type t : eqtype =
| Mk: v:int_t n -> t
let v x = x.v
let int_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = int_to_t 0
let one =
FStar.Math.Lemmas.pow2_lt_compat (n - 1) 1;
int_to_t 1
let add a b = Mk (add (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let mul a b = Mk (mul (v a) (v b)) | false | false | FStar.Int64.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val div (a:t) (b:t{v b <> 0}) : Pure t
// division overflows on INT_MIN / -1
(requires (size (v a / v b) n))
(ensures (fun c -> v a / v b = v c)) | [] | FStar.Int64.div | {
"file_name": "ulib/FStar.Int64.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int64.t -> b: FStar.Int64.t{FStar.Int64.v b <> 0} -> Prims.Pure FStar.Int64.t | {
"end_col": 34,
"end_line": 54,
"start_col": 14,
"start_line": 54
} |
Prims.Pure | val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let logand x y = Mk (logand (v x) (v y)) | val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
let logand x y = | false | null | false | Mk (logand (v x) (v y)) | {
"checked_file": "FStar.Int64.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Int64.fst"
} | [] | [
"FStar.Int64.t",
"FStar.Int64.Mk",
"FStar.Int.logand",
"FStar.Int64.n",
"FStar.Int64.v"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int64
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
type t : eqtype =
| Mk: v:int_t n -> t
let v x = x.v
let int_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = int_to_t 0
let one =
FStar.Math.Lemmas.pow2_lt_compat (n - 1) 1;
int_to_t 1
let add a b = Mk (add (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let div a b = Mk (div (v a) (v b))
let rem a b = Mk (mod (v a) (v b)) | false | false | FStar.Int64.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z)) | [] | FStar.Int64.logand | {
"file_name": "ulib/FStar.Int64.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.Int64.t -> y: FStar.Int64.t -> Prims.Pure FStar.Int64.t | {
"end_col": 40,
"end_line": 58,
"start_col": 17,
"start_line": 58
} |
Prims.Pure | val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rem a b = Mk (mod (v a) (v b)) | val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))
let rem a b = | false | null | false | Mk (mod (v a) (v b)) | {
"checked_file": "FStar.Int64.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Int64.fst"
} | [] | [
"FStar.Int64.t",
"Prims.b2t",
"Prims.op_disEquality",
"Prims.int",
"FStar.Int64.v",
"FStar.Int64.Mk",
"FStar.Int.mod",
"FStar.Int64.n"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int64
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
type t : eqtype =
| Mk: v:int_t n -> t
let v x = x.v
let int_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = int_to_t 0
let one =
FStar.Math.Lemmas.pow2_lt_compat (n - 1) 1;
int_to_t 1
let add a b = Mk (add (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let div a b = Mk (div (v a) (v b)) | false | false | FStar.Int64.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires (size (v a / v b) n))
(ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) | [] | FStar.Int64.rem | {
"file_name": "ulib/FStar.Int64.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int64.t -> b: FStar.Int64.t{FStar.Int64.v b <> 0} -> Prims.Pure FStar.Int64.t | {
"end_col": 34,
"end_line": 56,
"start_col": 14,
"start_line": 56
} |
Prims.Pure | val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let shift_left a s = Mk (shift_left (v a) (UInt32.v s)) | val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))
let shift_left a s = | false | null | false | Mk (shift_left (v a) (UInt32.v s)) | {
"checked_file": "FStar.Int64.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Int64.fst"
} | [] | [
"FStar.Int64.t",
"FStar.UInt32.t",
"FStar.Int64.Mk",
"FStar.Int.shift_left",
"FStar.Int64.n",
"FStar.Int64.v",
"FStar.UInt32.v"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Int64
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.Int
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly
* a copy-paste of this module. *)
type t : eqtype =
| Mk: v:int_t n -> t
let v x = x.v
let int_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = int_to_t 0
let one =
FStar.Math.Lemmas.pow2_lt_compat (n - 1) 1;
int_to_t 1
let add a b = Mk (add (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let div a b = Mk (div (v a) (v b))
let rem a b = Mk (mod (v a) (v b))
let logand x y = Mk (logand (v x) (v y))
let logxor x y = Mk (logxor (v x) (v y))
let logor x y = Mk (logor (v x) (v y))
let lognot x = Mk (lognot (v x))
let shift_right a s = Mk (shift_right (v a) (UInt32.v s)) | false | false | FStar.Int64.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n))
(ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) | [] | FStar.Int64.shift_left | {
"file_name": "ulib/FStar.Int64.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int64.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int64.t | {
"end_col": 55,
"end_line": 68,
"start_col": 21,
"start_line": 68
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2 | let list_disjoint_or_eq_def (ptrs: list b8) = | false | null | false | forall (p1: b8) (p2: b8). {:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\ L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2 | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"total"
] | [
"Prims.list",
"Vale.Interop.Types.b8",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.l_and",
"FStar.List.Tot.Base.memP",
"Vale.Interop.Heap_s.disjoint_or_eq_b8",
"Prims.logical"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2 | false | true | Vale.Interop.Heap_s.fst | {
"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"
} | null | val list_disjoint_or_eq_def : ptrs: Prims.list Vale.Interop.Types.b8 -> Prims.logical | [] | Vale.Interop.Heap_s.list_disjoint_or_eq_def | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptrs: Prims.list Vale.Interop.Types.b8 -> Prims.logical | {
"end_col": 46,
"end_line": 20,
"start_col": 2,
"start_line": 18
} |
|
Prims.Tot | val addrs_of_mem (m: interop_heap) : addr_map | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let addrs_of_mem (m:interop_heap) : addr_map = InteropHeap?.addrs m | val addrs_of_mem (m: interop_heap) : addr_map
let addrs_of_mem (m: interop_heap) : addr_map = | false | null | false | InteropHeap?.addrs m | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"total"
] | [
"Vale.Interop.Heap_s.interop_heap",
"Vale.Interop.Heap_s.__proj__InteropHeap__item__addrs",
"Vale.Interop.Types.addr_map"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2
[@"opaque_to_smt"] let list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def
irreducible let list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def
unfold
let list_live mem (ptrs:list b8) =
forall (p:b8).{:pattern (L.memP p ptrs)} L.memP p ptrs ==> B.live mem p.bsrc
assume val global_addrs_map : addr_map
let mk_addr_map (ptrs:list b8{list_disjoint_or_eq ptrs}) : GTot addr_map =
global_addrs_map
noeq type interop_heap =
| InteropHeap :
ptrs : list b8{list_disjoint_or_eq ptrs} ->
addrs : addr_map{addrs == mk_addr_map ptrs} ->
hs : HS.mem{list_live hs ptrs} ->
interop_heap
unfold let hs_of_mem (m:interop_heap) : HS.mem = InteropHeap?.hs m | false | true | Vale.Interop.Heap_s.fst | {
"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"
} | null | val addrs_of_mem (m: interop_heap) : addr_map | [] | Vale.Interop.Heap_s.addrs_of_mem | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | m: Vale.Interop.Heap_s.interop_heap -> Vale.Interop.Types.addr_map | {
"end_col": 74,
"end_line": 42,
"start_col": 54,
"start_line": 42
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def | let list_disjoint_or_eq = | false | null | false | opaque_make list_disjoint_or_eq_def | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"total"
] | [
"Vale.Def.Opaque_s.opaque_make",
"Prims.list",
"Vale.Interop.Types.b8",
"Prims.logical",
"Vale.Interop.Heap_s.list_disjoint_or_eq_def"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\ | false | true | Vale.Interop.Heap_s.fst | {
"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"
} | null | val list_disjoint_or_eq : _: Prims.list Vale.Interop.Types.b8 -> Prims.logical | [] | Vale.Interop.Heap_s.list_disjoint_or_eq | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.list Vale.Interop.Types.b8 -> Prims.logical | {
"end_col": 80,
"end_line": 21,
"start_col": 45,
"start_line": 21
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2 | let disjoint_or_eq_b8 (ptr1 ptr2: b8) = | false | null | false | B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/ ptr1 == ptr2 | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"total"
] | [
"Vale.Interop.Types.b8",
"Prims.l_or",
"LowStar.Monotonic.Buffer.loc_disjoint",
"LowStar.Monotonic.Buffer.loc_buffer",
"Vale.Interop.Types.base_typ_as_type",
"Vale.Interop.Types.__proj__Buffer__item__src",
"Vale.Interop.Types.b8_preorder",
"Vale.Interop.Types.__proj__Buffer__item__writeable",
"Vale.Interop.Types.__proj__Buffer__item__bsrc",
"Prims.eq2",
"Prims.logical"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__] | false | true | Vale.Interop.Heap_s.fst | {
"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"
} | null | val disjoint_or_eq_b8 : ptr1: Vale.Interop.Types.b8 -> ptr2: Vale.Interop.Types.b8 -> Prims.logical | [] | Vale.Interop.Heap_s.disjoint_or_eq_b8 | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr1: Vale.Interop.Types.b8 -> ptr2: Vale.Interop.Types.b8 -> Prims.logical | {
"end_col": 14,
"end_line": 15,
"start_col": 2,
"start_line": 14
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let correct_down (mem:interop_heap) (h:machine_heap) =
Set.equal (addrs_set mem) (Map.domain h) /\
(forall p.{:pattern (L.memP p (ptrs_of_mem mem))}
L.memP p (ptrs_of_mem mem) ==> correct_down_p mem h p) | let correct_down (mem: interop_heap) (h: machine_heap) = | false | null | false | Set.equal (addrs_set mem) (Map.domain h) /\
(forall p. {:pattern (L.memP p (ptrs_of_mem mem))}
L.memP p (ptrs_of_mem mem) ==> correct_down_p mem h p) | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"total"
] | [
"Vale.Interop.Heap_s.interop_heap",
"Vale.Arch.MachineHeap_s.machine_heap",
"Prims.l_and",
"FStar.Set.equal",
"Prims.int",
"Vale.Interop.Heap_s.addrs_set",
"FStar.Map.domain",
"Vale.Def.Types_s.nat8",
"Prims.l_Forall",
"Vale.Interop.Types.b8",
"Prims.l_imp",
"FStar.List.Tot.Base.memP",
"Vale.Interop.Heap_s.ptrs_of_mem",
"Vale.Interop.Heap_s.correct_down_p",
"Prims.logical"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2
[@"opaque_to_smt"] let list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def
irreducible let list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def
unfold
let list_live mem (ptrs:list b8) =
forall (p:b8).{:pattern (L.memP p ptrs)} L.memP p ptrs ==> B.live mem p.bsrc
assume val global_addrs_map : addr_map
let mk_addr_map (ptrs:list b8{list_disjoint_or_eq ptrs}) : GTot addr_map =
global_addrs_map
noeq type interop_heap =
| InteropHeap :
ptrs : list b8{list_disjoint_or_eq ptrs} ->
addrs : addr_map{addrs == mk_addr_map ptrs} ->
hs : HS.mem{list_live hs ptrs} ->
interop_heap
unfold let hs_of_mem (m:interop_heap) : HS.mem = InteropHeap?.hs m
unfold let ptrs_of_mem (m:interop_heap) : l:list b8{list_disjoint_or_eq l} = InteropHeap?.ptrs m
unfold let addrs_of_mem (m:interop_heap) : addr_map = InteropHeap?.addrs m
let rec addrs_ptr (i:nat) (addrs:addr_map) (ptr:b8{i <= DV.length (get_downview ptr.bsrc)}) (acc:Set.set int)
: GTot (Set.set int)
(decreases (DV.length (get_downview ptr.bsrc) - i))
=
if i = DV.length (get_downview ptr.bsrc) then acc
else addrs_ptr (i + 1) addrs ptr (Set.union (Set.singleton (addrs ptr + i)) acc)
let addrs_set (mem:interop_heap) : GTot (Set.set int) =
L.fold_right_gtot (ptrs_of_mem mem) (addrs_ptr 0 (addrs_of_mem mem)) Set.empty
let correct_down_p (mem:interop_heap) (h:machine_heap) (p:b8) =
let b = get_downview p.bsrc in
let length = DV.length b in
let contents = DV.as_seq (hs_of_mem mem) b in
let addr = addrs_of_mem mem p in
(forall i.{:pattern (Seq.index contents i)} 0 <= i /\ i < length ==>
h.[addr + i] == UInt8.v (FStar.Seq.index contents i)) | false | true | Vale.Interop.Heap_s.fst | {
"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"
} | null | val correct_down : mem: Vale.Interop.Heap_s.interop_heap -> h: Vale.Arch.MachineHeap_s.machine_heap -> Prims.logical | [] | Vale.Interop.Heap_s.correct_down | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | mem: Vale.Interop.Heap_s.interop_heap -> h: Vale.Arch.MachineHeap_s.machine_heap -> Prims.logical | {
"end_col": 58,
"end_line": 65,
"start_col": 2,
"start_line": 63
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let down_mem_t = m:interop_heap -> GTot (h:machine_heap{correct_down m h}) | let down_mem_t = | false | null | false | m: interop_heap -> GTot (h: machine_heap{correct_down m h}) | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"total"
] | [
"Vale.Interop.Heap_s.interop_heap",
"Vale.Arch.MachineHeap_s.machine_heap",
"Vale.Interop.Heap_s.correct_down"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2
[@"opaque_to_smt"] let list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def
irreducible let list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def
unfold
let list_live mem (ptrs:list b8) =
forall (p:b8).{:pattern (L.memP p ptrs)} L.memP p ptrs ==> B.live mem p.bsrc
assume val global_addrs_map : addr_map
let mk_addr_map (ptrs:list b8{list_disjoint_or_eq ptrs}) : GTot addr_map =
global_addrs_map
noeq type interop_heap =
| InteropHeap :
ptrs : list b8{list_disjoint_or_eq ptrs} ->
addrs : addr_map{addrs == mk_addr_map ptrs} ->
hs : HS.mem{list_live hs ptrs} ->
interop_heap
unfold let hs_of_mem (m:interop_heap) : HS.mem = InteropHeap?.hs m
unfold let ptrs_of_mem (m:interop_heap) : l:list b8{list_disjoint_or_eq l} = InteropHeap?.ptrs m
unfold let addrs_of_mem (m:interop_heap) : addr_map = InteropHeap?.addrs m
let rec addrs_ptr (i:nat) (addrs:addr_map) (ptr:b8{i <= DV.length (get_downview ptr.bsrc)}) (acc:Set.set int)
: GTot (Set.set int)
(decreases (DV.length (get_downview ptr.bsrc) - i))
=
if i = DV.length (get_downview ptr.bsrc) then acc
else addrs_ptr (i + 1) addrs ptr (Set.union (Set.singleton (addrs ptr + i)) acc)
let addrs_set (mem:interop_heap) : GTot (Set.set int) =
L.fold_right_gtot (ptrs_of_mem mem) (addrs_ptr 0 (addrs_of_mem mem)) Set.empty
let correct_down_p (mem:interop_heap) (h:machine_heap) (p:b8) =
let b = get_downview p.bsrc in
let length = DV.length b in
let contents = DV.as_seq (hs_of_mem mem) b in
let addr = addrs_of_mem mem p in
(forall i.{:pattern (Seq.index contents i)} 0 <= i /\ i < length ==>
h.[addr + i] == UInt8.v (FStar.Seq.index contents i))
let correct_down (mem:interop_heap) (h:machine_heap) =
Set.equal (addrs_set mem) (Map.domain h) /\
(forall p.{:pattern (L.memP p (ptrs_of_mem mem))}
L.memP p (ptrs_of_mem mem) ==> correct_down_p mem h p) | false | true | Vale.Interop.Heap_s.fst | {
"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"
} | null | val down_mem_t : Type | [] | Vale.Interop.Heap_s.down_mem_t | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type | {
"end_col": 74,
"end_line": 67,
"start_col": 17,
"start_line": 67
} |
|
FStar.Pervasives.Lemma | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def | let list_disjoint_or_eq_reveal = | false | null | true | opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"lemma"
] | [
"Vale.Def.Opaque_s.opaque_revealer",
"Prims.list",
"Vale.Interop.Types.b8",
"Prims.logical",
"Vale.Interop.Heap_s.list_disjoint_or_eq",
"Vale.Interop.Heap_s.list_disjoint_or_eq_def"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2 | false | false | Vale.Interop.Heap_s.fst | {
"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"
} | null | val list_disjoint_or_eq_reveal : _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Interop.Heap_s.list_disjoint_or_eq == Vale.Interop.Heap_s.list_disjoint_or_eq_def) | [] | Vale.Interop.Heap_s.list_disjoint_or_eq_reveal | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.Interop.Heap_s.list_disjoint_or_eq == Vale.Interop.Heap_s.list_disjoint_or_eq_def) | {
"end_col": 128,
"end_line": 22,
"start_col": 45,
"start_line": 22
} |
|
Prims.Tot | val hs_of_mem (m: interop_heap) : HS.mem | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let hs_of_mem (m:interop_heap) : HS.mem = InteropHeap?.hs m | val hs_of_mem (m: interop_heap) : HS.mem
let hs_of_mem (m: interop_heap) : HS.mem = | false | null | false | InteropHeap?.hs m | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"total"
] | [
"Vale.Interop.Heap_s.interop_heap",
"Vale.Interop.Heap_s.__proj__InteropHeap__item__hs",
"FStar.Monotonic.HyperStack.mem"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2
[@"opaque_to_smt"] let list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def
irreducible let list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def
unfold
let list_live mem (ptrs:list b8) =
forall (p:b8).{:pattern (L.memP p ptrs)} L.memP p ptrs ==> B.live mem p.bsrc
assume val global_addrs_map : addr_map
let mk_addr_map (ptrs:list b8{list_disjoint_or_eq ptrs}) : GTot addr_map =
global_addrs_map
noeq type interop_heap =
| InteropHeap :
ptrs : list b8{list_disjoint_or_eq ptrs} ->
addrs : addr_map{addrs == mk_addr_map ptrs} ->
hs : HS.mem{list_live hs ptrs} ->
interop_heap | false | true | Vale.Interop.Heap_s.fst | {
"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"
} | null | val hs_of_mem (m: interop_heap) : HS.mem | [] | Vale.Interop.Heap_s.hs_of_mem | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | m: Vale.Interop.Heap_s.interop_heap -> FStar.Monotonic.HyperStack.mem | {
"end_col": 66,
"end_line": 40,
"start_col": 49,
"start_line": 40
} |
Prims.GTot | val mk_addr_map (ptrs: list b8 {list_disjoint_or_eq ptrs}) : GTot addr_map | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let mk_addr_map (ptrs:list b8{list_disjoint_or_eq ptrs}) : GTot addr_map =
global_addrs_map | val mk_addr_map (ptrs: list b8 {list_disjoint_or_eq ptrs}) : GTot addr_map
let mk_addr_map (ptrs: list b8 {list_disjoint_or_eq ptrs}) : GTot addr_map = | false | null | false | global_addrs_map | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"sometrivial"
] | [
"Prims.list",
"Vale.Interop.Types.b8",
"Vale.Interop.Heap_s.list_disjoint_or_eq",
"Vale.Interop.Heap_s.global_addrs_map",
"Vale.Interop.Types.addr_map"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2
[@"opaque_to_smt"] let list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def
irreducible let list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def
unfold
let list_live mem (ptrs:list b8) =
forall (p:b8).{:pattern (L.memP p ptrs)} L.memP p ptrs ==> B.live mem p.bsrc
assume val global_addrs_map : addr_map | false | false | Vale.Interop.Heap_s.fst | {
"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"
} | null | val mk_addr_map (ptrs: list b8 {list_disjoint_or_eq ptrs}) : GTot addr_map | [] | Vale.Interop.Heap_s.mk_addr_map | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptrs: Prims.list Vale.Interop.Types.b8 {Vale.Interop.Heap_s.list_disjoint_or_eq ptrs}
-> Prims.GTot Vale.Interop.Types.addr_map | {
"end_col": 18,
"end_line": 31,
"start_col": 2,
"start_line": 31
} |
Prims.GTot | val mem_of_hs_roots (ptrs: list b8 {list_disjoint_or_eq ptrs}) (h: HS.mem{list_live h ptrs})
: GTot interop_heap | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let mem_of_hs_roots (ptrs:list b8{list_disjoint_or_eq ptrs}) (h:HS.mem{list_live h ptrs})
: GTot interop_heap
=
InteropHeap ptrs (mk_addr_map ptrs) h | val mem_of_hs_roots (ptrs: list b8 {list_disjoint_or_eq ptrs}) (h: HS.mem{list_live h ptrs})
: GTot interop_heap
let mem_of_hs_roots (ptrs: list b8 {list_disjoint_or_eq ptrs}) (h: HS.mem{list_live h ptrs})
: GTot interop_heap = | false | null | false | InteropHeap ptrs (mk_addr_map ptrs) h | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"sometrivial"
] | [
"Prims.list",
"Vale.Interop.Types.b8",
"Vale.Interop.Heap_s.list_disjoint_or_eq",
"FStar.Monotonic.HyperStack.mem",
"Vale.Interop.Heap_s.list_live",
"Vale.Interop.Heap_s.InteropHeap",
"Vale.Interop.Heap_s.mk_addr_map",
"Vale.Interop.Heap_s.interop_heap"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2
[@"opaque_to_smt"] let list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def
irreducible let list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def
unfold
let list_live mem (ptrs:list b8) =
forall (p:b8).{:pattern (L.memP p ptrs)} L.memP p ptrs ==> B.live mem p.bsrc
assume val global_addrs_map : addr_map
let mk_addr_map (ptrs:list b8{list_disjoint_or_eq ptrs}) : GTot addr_map =
global_addrs_map
noeq type interop_heap =
| InteropHeap :
ptrs : list b8{list_disjoint_or_eq ptrs} ->
addrs : addr_map{addrs == mk_addr_map ptrs} ->
hs : HS.mem{list_live hs ptrs} ->
interop_heap
unfold let hs_of_mem (m:interop_heap) : HS.mem = InteropHeap?.hs m
unfold let ptrs_of_mem (m:interop_heap) : l:list b8{list_disjoint_or_eq l} = InteropHeap?.ptrs m
unfold let addrs_of_mem (m:interop_heap) : addr_map = InteropHeap?.addrs m
let rec addrs_ptr (i:nat) (addrs:addr_map) (ptr:b8{i <= DV.length (get_downview ptr.bsrc)}) (acc:Set.set int)
: GTot (Set.set int)
(decreases (DV.length (get_downview ptr.bsrc) - i))
=
if i = DV.length (get_downview ptr.bsrc) then acc
else addrs_ptr (i + 1) addrs ptr (Set.union (Set.singleton (addrs ptr + i)) acc)
let addrs_set (mem:interop_heap) : GTot (Set.set int) =
L.fold_right_gtot (ptrs_of_mem mem) (addrs_ptr 0 (addrs_of_mem mem)) Set.empty
let correct_down_p (mem:interop_heap) (h:machine_heap) (p:b8) =
let b = get_downview p.bsrc in
let length = DV.length b in
let contents = DV.as_seq (hs_of_mem mem) b in
let addr = addrs_of_mem mem p in
(forall i.{:pattern (Seq.index contents i)} 0 <= i /\ i < length ==>
h.[addr + i] == UInt8.v (FStar.Seq.index contents i))
let correct_down (mem:interop_heap) (h:machine_heap) =
Set.equal (addrs_set mem) (Map.domain h) /\
(forall p.{:pattern (L.memP p (ptrs_of_mem mem))}
L.memP p (ptrs_of_mem mem) ==> correct_down_p mem h p)
let down_mem_t = m:interop_heap -> GTot (h:machine_heap{correct_down m h})
let mem_of_hs_roots (ptrs:list b8{list_disjoint_or_eq ptrs}) (h:HS.mem{list_live h ptrs})
: GTot interop_heap | false | false | Vale.Interop.Heap_s.fst | {
"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"
} | null | val mem_of_hs_roots (ptrs: list b8 {list_disjoint_or_eq ptrs}) (h: HS.mem{list_live h ptrs})
: GTot interop_heap | [] | Vale.Interop.Heap_s.mem_of_hs_roots | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ptrs: Prims.list Vale.Interop.Types.b8 {Vale.Interop.Heap_s.list_disjoint_or_eq ptrs} ->
h: FStar.Monotonic.HyperStack.mem{Vale.Interop.Heap_s.list_live h ptrs}
-> Prims.GTot Vale.Interop.Heap_s.interop_heap | {
"end_col": 39,
"end_line": 72,
"start_col": 2,
"start_line": 72
} |
Prims.Tot | val ptrs_of_mem (m: interop_heap) : l: list b8 {list_disjoint_or_eq l} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let ptrs_of_mem (m:interop_heap) : l:list b8{list_disjoint_or_eq l} = InteropHeap?.ptrs m | val ptrs_of_mem (m: interop_heap) : l: list b8 {list_disjoint_or_eq l}
let ptrs_of_mem (m: interop_heap) : l: list b8 {list_disjoint_or_eq l} = | false | null | false | InteropHeap?.ptrs m | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"total"
] | [
"Vale.Interop.Heap_s.interop_heap",
"Vale.Interop.Heap_s.__proj__InteropHeap__item__ptrs",
"Prims.list",
"Vale.Interop.Types.b8",
"Vale.Interop.Heap_s.list_disjoint_or_eq"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2
[@"opaque_to_smt"] let list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def
irreducible let list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def
unfold
let list_live mem (ptrs:list b8) =
forall (p:b8).{:pattern (L.memP p ptrs)} L.memP p ptrs ==> B.live mem p.bsrc
assume val global_addrs_map : addr_map
let mk_addr_map (ptrs:list b8{list_disjoint_or_eq ptrs}) : GTot addr_map =
global_addrs_map
noeq type interop_heap =
| InteropHeap :
ptrs : list b8{list_disjoint_or_eq ptrs} ->
addrs : addr_map{addrs == mk_addr_map ptrs} ->
hs : HS.mem{list_live hs ptrs} ->
interop_heap | false | false | Vale.Interop.Heap_s.fst | {
"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"
} | null | val ptrs_of_mem (m: interop_heap) : l: list b8 {list_disjoint_or_eq l} | [] | Vale.Interop.Heap_s.ptrs_of_mem | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | m: Vale.Interop.Heap_s.interop_heap
-> l: Prims.list Vale.Interop.Types.b8 {Vale.Interop.Heap_s.list_disjoint_or_eq l} | {
"end_col": 96,
"end_line": 41,
"start_col": 77,
"start_line": 41
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let list_live mem (ptrs:list b8) =
forall (p:b8).{:pattern (L.memP p ptrs)} L.memP p ptrs ==> B.live mem p.bsrc | let list_live mem (ptrs: list b8) = | false | null | false | forall (p: b8). {:pattern (L.memP p ptrs)} L.memP p ptrs ==> B.live mem p.bsrc | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"total"
] | [
"FStar.Monotonic.HyperStack.mem",
"Prims.list",
"Vale.Interop.Types.b8",
"Prims.l_Forall",
"Prims.l_imp",
"FStar.List.Tot.Base.memP",
"LowStar.Monotonic.Buffer.live",
"Vale.Interop.Types.base_typ_as_type",
"Vale.Interop.Types.__proj__Buffer__item__src",
"Vale.Interop.Types.b8_preorder",
"Vale.Interop.Types.__proj__Buffer__item__writeable",
"Vale.Interop.Types.__proj__Buffer__item__bsrc",
"Prims.logical"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2
[@"opaque_to_smt"] let list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def
irreducible let list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def
unfold | false | true | Vale.Interop.Heap_s.fst | {
"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"
} | null | val list_live : mem: FStar.Monotonic.HyperStack.mem -> ptrs: Prims.list Vale.Interop.Types.b8 -> Prims.logical | [] | Vale.Interop.Heap_s.list_live | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | mem: FStar.Monotonic.HyperStack.mem -> ptrs: Prims.list Vale.Interop.Types.b8 -> Prims.logical | {
"end_col": 78,
"end_line": 26,
"start_col": 2,
"start_line": 26
} |
|
Prims.GTot | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let correct_down_p (mem:interop_heap) (h:machine_heap) (p:b8) =
let b = get_downview p.bsrc in
let length = DV.length b in
let contents = DV.as_seq (hs_of_mem mem) b in
let addr = addrs_of_mem mem p in
(forall i.{:pattern (Seq.index contents i)} 0 <= i /\ i < length ==>
h.[addr + i] == UInt8.v (FStar.Seq.index contents i)) | let correct_down_p (mem: interop_heap) (h: machine_heap) (p: b8) = | false | null | false | let b = get_downview p.bsrc in
let length = DV.length b in
let contents = DV.as_seq (hs_of_mem mem) b in
let addr = addrs_of_mem mem p in
(forall i. {:pattern (Seq.index contents i)}
0 <= i /\ i < length ==> h.[ addr + i ] == UInt8.v (FStar.Seq.index contents i)) | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"sometrivial"
] | [
"Vale.Interop.Heap_s.interop_heap",
"Vale.Arch.MachineHeap_s.machine_heap",
"Vale.Interop.Types.b8",
"Prims.l_Forall",
"Prims.int",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"Prims.l_imp",
"Prims.op_LessThanOrEqual",
"Prims.eq2",
"Prims.l_or",
"FStar.UInt.size",
"FStar.UInt8.n",
"Vale.Def.Words_s.pow2_8",
"Vale.Arch.MachineHeap_s.op_String_Access",
"Vale.Def.Types_s.nat8",
"Prims.op_Addition",
"FStar.UInt8.v",
"FStar.Seq.Base.index",
"Vale.Def.Words_s.nat64",
"Vale.Interop.Heap_s.addrs_of_mem",
"FStar.Seq.Properties.lseq",
"LowStar.BufferView.Down.length",
"LowStar.BufferView.Down.as_seq",
"Vale.Interop.Heap_s.hs_of_mem",
"Prims.nat",
"LowStar.BufferView.Down.buffer",
"Vale.Interop.Types.get_downview",
"Vale.Interop.Types.__proj__Buffer__item__src",
"Vale.Interop.Types.b8_preorder",
"Vale.Interop.Types.__proj__Buffer__item__writeable",
"Vale.Interop.Types.base_typ_as_type",
"Vale.Interop.Types.__proj__Buffer__item__bsrc",
"Prims.logical"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2
[@"opaque_to_smt"] let list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def
irreducible let list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def
unfold
let list_live mem (ptrs:list b8) =
forall (p:b8).{:pattern (L.memP p ptrs)} L.memP p ptrs ==> B.live mem p.bsrc
assume val global_addrs_map : addr_map
let mk_addr_map (ptrs:list b8{list_disjoint_or_eq ptrs}) : GTot addr_map =
global_addrs_map
noeq type interop_heap =
| InteropHeap :
ptrs : list b8{list_disjoint_or_eq ptrs} ->
addrs : addr_map{addrs == mk_addr_map ptrs} ->
hs : HS.mem{list_live hs ptrs} ->
interop_heap
unfold let hs_of_mem (m:interop_heap) : HS.mem = InteropHeap?.hs m
unfold let ptrs_of_mem (m:interop_heap) : l:list b8{list_disjoint_or_eq l} = InteropHeap?.ptrs m
unfold let addrs_of_mem (m:interop_heap) : addr_map = InteropHeap?.addrs m
let rec addrs_ptr (i:nat) (addrs:addr_map) (ptr:b8{i <= DV.length (get_downview ptr.bsrc)}) (acc:Set.set int)
: GTot (Set.set int)
(decreases (DV.length (get_downview ptr.bsrc) - i))
=
if i = DV.length (get_downview ptr.bsrc) then acc
else addrs_ptr (i + 1) addrs ptr (Set.union (Set.singleton (addrs ptr + i)) acc)
let addrs_set (mem:interop_heap) : GTot (Set.set int) =
L.fold_right_gtot (ptrs_of_mem mem) (addrs_ptr 0 (addrs_of_mem mem)) Set.empty | false | false | Vale.Interop.Heap_s.fst | {
"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"
} | null | val correct_down_p : mem: Vale.Interop.Heap_s.interop_heap ->
h: Vale.Arch.MachineHeap_s.machine_heap ->
p: Vale.Interop.Types.b8
-> Prims.GTot Prims.logical | [] | Vale.Interop.Heap_s.correct_down_p | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
mem: Vale.Interop.Heap_s.interop_heap ->
h: Vale.Arch.MachineHeap_s.machine_heap ->
p: Vale.Interop.Types.b8
-> Prims.GTot Prims.logical | {
"end_col": 57,
"end_line": 60,
"start_col": 63,
"start_line": 54
} |
|
Prims.GTot | val addrs_set (mem: interop_heap) : GTot (Set.set int) | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let addrs_set (mem:interop_heap) : GTot (Set.set int) =
L.fold_right_gtot (ptrs_of_mem mem) (addrs_ptr 0 (addrs_of_mem mem)) Set.empty | val addrs_set (mem: interop_heap) : GTot (Set.set int)
let addrs_set (mem: interop_heap) : GTot (Set.set int) = | false | null | false | L.fold_right_gtot (ptrs_of_mem mem) (addrs_ptr 0 (addrs_of_mem mem)) Set.empty | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"sometrivial"
] | [
"Vale.Interop.Heap_s.interop_heap",
"FStar.List.Tot.Base.fold_right_gtot",
"Vale.Interop.Types.b8",
"FStar.Set.set",
"Prims.int",
"Vale.Interop.Heap_s.ptrs_of_mem",
"Vale.Interop.Heap_s.addrs_ptr",
"Vale.Interop.Heap_s.addrs_of_mem",
"FStar.Set.empty"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2
[@"opaque_to_smt"] let list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def
irreducible let list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def
unfold
let list_live mem (ptrs:list b8) =
forall (p:b8).{:pattern (L.memP p ptrs)} L.memP p ptrs ==> B.live mem p.bsrc
assume val global_addrs_map : addr_map
let mk_addr_map (ptrs:list b8{list_disjoint_or_eq ptrs}) : GTot addr_map =
global_addrs_map
noeq type interop_heap =
| InteropHeap :
ptrs : list b8{list_disjoint_or_eq ptrs} ->
addrs : addr_map{addrs == mk_addr_map ptrs} ->
hs : HS.mem{list_live hs ptrs} ->
interop_heap
unfold let hs_of_mem (m:interop_heap) : HS.mem = InteropHeap?.hs m
unfold let ptrs_of_mem (m:interop_heap) : l:list b8{list_disjoint_or_eq l} = InteropHeap?.ptrs m
unfold let addrs_of_mem (m:interop_heap) : addr_map = InteropHeap?.addrs m
let rec addrs_ptr (i:nat) (addrs:addr_map) (ptr:b8{i <= DV.length (get_downview ptr.bsrc)}) (acc:Set.set int)
: GTot (Set.set int)
(decreases (DV.length (get_downview ptr.bsrc) - i))
=
if i = DV.length (get_downview ptr.bsrc) then acc
else addrs_ptr (i + 1) addrs ptr (Set.union (Set.singleton (addrs ptr + i)) acc) | false | false | Vale.Interop.Heap_s.fst | {
"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"
} | null | val addrs_set (mem: interop_heap) : GTot (Set.set int) | [] | Vale.Interop.Heap_s.addrs_set | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | mem: Vale.Interop.Heap_s.interop_heap -> Prims.GTot (FStar.Set.set Prims.int) | {
"end_col": 80,
"end_line": 52,
"start_col": 2,
"start_line": 52
} |
Prims.GTot | val addrs_ptr
(i: nat)
(addrs: addr_map)
(ptr: b8{i <= DV.length (get_downview ptr.bsrc)})
(acc: Set.set int)
: GTot (Set.set int) (decreases (DV.length (get_downview ptr.bsrc) - i)) | [
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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
}
] | false | let rec addrs_ptr (i:nat) (addrs:addr_map) (ptr:b8{i <= DV.length (get_downview ptr.bsrc)}) (acc:Set.set int)
: GTot (Set.set int)
(decreases (DV.length (get_downview ptr.bsrc) - i))
=
if i = DV.length (get_downview ptr.bsrc) then acc
else addrs_ptr (i + 1) addrs ptr (Set.union (Set.singleton (addrs ptr + i)) acc) | val addrs_ptr
(i: nat)
(addrs: addr_map)
(ptr: b8{i <= DV.length (get_downview ptr.bsrc)})
(acc: Set.set int)
: GTot (Set.set int) (decreases (DV.length (get_downview ptr.bsrc) - i))
let rec addrs_ptr
(i: nat)
(addrs: addr_map)
(ptr: b8{i <= DV.length (get_downview ptr.bsrc)})
(acc: Set.set int)
: GTot (Set.set int) (decreases (DV.length (get_downview ptr.bsrc) - i)) = | false | null | false | if i = DV.length (get_downview ptr.bsrc)
then acc
else addrs_ptr (i + 1) addrs ptr (Set.union (Set.singleton (addrs ptr + i)) acc) | {
"checked_file": "Vale.Interop.Heap_s.fst.checked",
"dependencies": [
"Vale.Interop.Types.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.MachineHeap_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Heap_s.fst"
} | [
"sometrivial",
""
] | [
"Prims.nat",
"Vale.Interop.Types.addr_map",
"Vale.Interop.Types.b8",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"LowStar.BufferView.Down.length",
"FStar.UInt8.t",
"Vale.Interop.Types.get_downview",
"Vale.Interop.Types.__proj__Buffer__item__src",
"Vale.Interop.Types.b8_preorder",
"Vale.Interop.Types.__proj__Buffer__item__writeable",
"Vale.Interop.Types.base_typ_as_type",
"Vale.Interop.Types.__proj__Buffer__item__bsrc",
"FStar.Set.set",
"Prims.int",
"Prims.op_Equality",
"Prims.bool",
"Vale.Interop.Heap_s.addrs_ptr",
"Prims.op_Addition",
"FStar.Set.union",
"FStar.Set.singleton"
] | [] | module Vale.Interop.Heap_s
open FStar.Mul
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Arch.MachineHeap_s
include Vale.Interop.Types
module L = FStar.List.Tot
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
[@__reduce__]
let disjoint_or_eq_b8 (ptr1 ptr2:b8) =
B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \/
ptr1 == ptr2
let list_disjoint_or_eq_def (ptrs:list b8) =
forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}
L.memP p1 ptrs /\
L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2
[@"opaque_to_smt"] let list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def
irreducible let list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def
unfold
let list_live mem (ptrs:list b8) =
forall (p:b8).{:pattern (L.memP p ptrs)} L.memP p ptrs ==> B.live mem p.bsrc
assume val global_addrs_map : addr_map
let mk_addr_map (ptrs:list b8{list_disjoint_or_eq ptrs}) : GTot addr_map =
global_addrs_map
noeq type interop_heap =
| InteropHeap :
ptrs : list b8{list_disjoint_or_eq ptrs} ->
addrs : addr_map{addrs == mk_addr_map ptrs} ->
hs : HS.mem{list_live hs ptrs} ->
interop_heap
unfold let hs_of_mem (m:interop_heap) : HS.mem = InteropHeap?.hs m
unfold let ptrs_of_mem (m:interop_heap) : l:list b8{list_disjoint_or_eq l} = InteropHeap?.ptrs m
unfold let addrs_of_mem (m:interop_heap) : addr_map = InteropHeap?.addrs m
let rec addrs_ptr (i:nat) (addrs:addr_map) (ptr:b8{i <= DV.length (get_downview ptr.bsrc)}) (acc:Set.set int)
: GTot (Set.set int)
(decreases (DV.length (get_downview ptr.bsrc) - i)) | false | false | Vale.Interop.Heap_s.fst | {
"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"
} | null | val addrs_ptr
(i: nat)
(addrs: addr_map)
(ptr: b8{i <= DV.length (get_downview ptr.bsrc)})
(acc: Set.set int)
: GTot (Set.set int) (decreases (DV.length (get_downview ptr.bsrc) - i)) | [
"recursion"
] | Vale.Interop.Heap_s.addrs_ptr | {
"file_name": "vale/specs/interop/Vale.Interop.Heap_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
i: Prims.nat ->
addrs: Vale.Interop.Types.addr_map ->
ptr:
Vale.Interop.Types.b8
{i <= LowStar.BufferView.Down.length (Vale.Interop.Types.get_downview (Buffer?.bsrc ptr))} ->
acc: FStar.Set.set Prims.int
-> Prims.GTot (FStar.Set.set Prims.int) | {
"end_col": 82,
"end_line": 49,
"start_col": 2,
"start_line": 48
} |
FStar.HyperStack.ST.Stack | val sign_compute_s (r hs:lbuffer uint64 5ul) (a s:lbuffer uint8 32ul) : Stack unit
(requires fun h ->
live h r /\ live h hs /\ live h a /\ live h s /\
disjoint s r /\ disjoint s hs /\ disjoint s a /\
F56.scalar_inv_full_t h r /\ F56.scalar_inv_full_t h hs)
(ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\
as_seq h1 s == BSeq.nat_to_bytes_le 32 ((F56.as_nat h0 r +
(F56.as_nat h0 hs * BSeq.nat_from_bytes_le (as_seq h0 a)) % Spec.Ed25519.q) % Spec.Ed25519.q)) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.BignumQ.Definitions",
"short_module": "S56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.BignumQ.Mul",
"short_module": "F56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"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.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"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
}
] | false | let sign_compute_s r hs a s =
push_frame ();
let aq = create 5ul (u64 0) in
Hacl.Impl.Load56.load_32_bytes aq a;
Hacl.Impl.BignumQ.Mul.mul_modq aq hs aq;
Hacl.Impl.BignumQ.Mul.add_modq aq r aq;
assert_norm (0x100000000000000 == pow2 56);
Hacl.Impl.Store56.store_56 s aq;
pop_frame () | val sign_compute_s (r hs:lbuffer uint64 5ul) (a s:lbuffer uint8 32ul) : Stack unit
(requires fun h ->
live h r /\ live h hs /\ live h a /\ live h s /\
disjoint s r /\ disjoint s hs /\ disjoint s a /\
F56.scalar_inv_full_t h r /\ F56.scalar_inv_full_t h hs)
(ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\
as_seq h1 s == BSeq.nat_to_bytes_le 32 ((F56.as_nat h0 r +
(F56.as_nat h0 hs * BSeq.nat_from_bytes_le (as_seq h0 a)) % Spec.Ed25519.q) % Spec.Ed25519.q))
let sign_compute_s r hs a s = | true | null | false | push_frame ();
let aq = create 5ul (u64 0) in
Hacl.Impl.Load56.load_32_bytes aq a;
Hacl.Impl.BignumQ.Mul.mul_modq aq hs aq;
Hacl.Impl.BignumQ.Mul.add_modq aq r aq;
assert_norm (0x100000000000000 == pow2 56);
Hacl.Impl.Store56.store_56 s aq;
pop_frame () | {
"checked_file": "Hacl.Impl.Ed25519.Sign.fst.checked",
"dependencies": [
"Spec.Ed25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.BignumQ.Definitions.fst.checked",
"Hacl.Impl.Store56.fst.checked",
"Hacl.Impl.SHA512.ModQ.fst.checked",
"Hacl.Impl.Load56.fst.checked",
"Hacl.Impl.Ed25519.PointCompress.fst.checked",
"Hacl.Impl.Ed25519.Ladder.fsti.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Impl.BignumQ.Mul.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.Sign.fst"
} | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.uint8",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Hacl.Impl.Store56.store_56",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"Prims.pow2",
"Hacl.Impl.BignumQ.Mul.add_modq",
"Hacl.Impl.BignumQ.Mul.mul_modq",
"Hacl.Impl.Load56.load_32_bytes",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.create",
"Lib.IntTypes.u64",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Ed25519.Sign
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
module ST = FStar.HyperStack.ST
module BSeq = Lib.ByteSequence
module LSeq = Lib.Sequence
module F51 = Hacl.Impl.Ed25519.Field51
module F56 = Hacl.Impl.BignumQ.Mul
module S56 = Hacl.Spec.BignumQ.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
val point_mul_g_compress (out s:lbuffer uint8 32ul) : Stack unit
(requires fun h ->
live h out /\ live h s /\ disjoint s out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Ed25519.point_compress (Spec.Ed25519.point_mul_g (as_seq h0 s)))
[@CInline]
let point_mul_g_compress out s =
push_frame ();
let tmp = create 20ul (u64 0) in
Hacl.Impl.Ed25519.Ladder.point_mul_g tmp s;
Hacl.Impl.Ed25519.PointCompress.point_compress out tmp;
pop_frame ()
inline_for_extraction noextract
val sign_compute_s (r hs:lbuffer uint64 5ul) (a s:lbuffer uint8 32ul) : Stack unit
(requires fun h ->
live h r /\ live h hs /\ live h a /\ live h s /\
disjoint s r /\ disjoint s hs /\ disjoint s a /\
F56.scalar_inv_full_t h r /\ F56.scalar_inv_full_t h hs)
(ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\
as_seq h1 s == BSeq.nat_to_bytes_le 32 ((F56.as_nat h0 r +
(F56.as_nat h0 hs * BSeq.nat_from_bytes_le (as_seq h0 a)) % Spec.Ed25519.q) % Spec.Ed25519.q)) | false | false | Hacl.Impl.Ed25519.Sign.fst | {
"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"
} | null | val sign_compute_s (r hs:lbuffer uint64 5ul) (a s:lbuffer uint8 32ul) : Stack unit
(requires fun h ->
live h r /\ live h hs /\ live h a /\ live h s /\
disjoint s r /\ disjoint s hs /\ disjoint s a /\
F56.scalar_inv_full_t h r /\ F56.scalar_inv_full_t h hs)
(ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\
as_seq h1 s == BSeq.nat_to_bytes_le 32 ((F56.as_nat h0 r +
(F56.as_nat h0 hs * BSeq.nat_from_bytes_le (as_seq h0 a)) % Spec.Ed25519.q) % Spec.Ed25519.q)) | [] | Hacl.Impl.Ed25519.Sign.sign_compute_s | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.Sign.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
r: Lib.Buffer.lbuffer Lib.IntTypes.uint64 5ul ->
hs: Lib.Buffer.lbuffer Lib.IntTypes.uint64 5ul ->
a: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
s: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 14,
"end_line": 53,
"start_col": 2,
"start_line": 46
} |
FStar.HyperStack.ST.Stack | val point_mul_g_compress (out s:lbuffer uint8 32ul) : Stack unit
(requires fun h ->
live h out /\ live h s /\ disjoint s out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Ed25519.point_compress (Spec.Ed25519.point_mul_g (as_seq h0 s))) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.BignumQ.Definitions",
"short_module": "S56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.BignumQ.Mul",
"short_module": "F56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"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.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"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
}
] | false | let point_mul_g_compress out s =
push_frame ();
let tmp = create 20ul (u64 0) in
Hacl.Impl.Ed25519.Ladder.point_mul_g tmp s;
Hacl.Impl.Ed25519.PointCompress.point_compress out tmp;
pop_frame () | val point_mul_g_compress (out s:lbuffer uint8 32ul) : Stack unit
(requires fun h ->
live h out /\ live h s /\ disjoint s out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Ed25519.point_compress (Spec.Ed25519.point_mul_g (as_seq h0 s)))
let point_mul_g_compress out s = | true | null | false | push_frame ();
let tmp = create 20ul (u64 0) in
Hacl.Impl.Ed25519.Ladder.point_mul_g tmp s;
Hacl.Impl.Ed25519.PointCompress.point_compress out tmp;
pop_frame () | {
"checked_file": "Hacl.Impl.Ed25519.Sign.fst.checked",
"dependencies": [
"Spec.Ed25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.BignumQ.Definitions.fst.checked",
"Hacl.Impl.Store56.fst.checked",
"Hacl.Impl.SHA512.ModQ.fst.checked",
"Hacl.Impl.Load56.fst.checked",
"Hacl.Impl.Ed25519.PointCompress.fst.checked",
"Hacl.Impl.Ed25519.Ladder.fsti.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Impl.BignumQ.Mul.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.Sign.fst"
} | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Hacl.Impl.Ed25519.PointCompress.point_compress",
"Hacl.Impl.Ed25519.Ladder.point_mul_g",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.create",
"Lib.IntTypes.uint64",
"Lib.IntTypes.u64",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Ed25519.Sign
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
module ST = FStar.HyperStack.ST
module BSeq = Lib.ByteSequence
module LSeq = Lib.Sequence
module F51 = Hacl.Impl.Ed25519.Field51
module F56 = Hacl.Impl.BignumQ.Mul
module S56 = Hacl.Spec.BignumQ.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
val point_mul_g_compress (out s:lbuffer uint8 32ul) : Stack unit
(requires fun h ->
live h out /\ live h s /\ disjoint s out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Ed25519.point_compress (Spec.Ed25519.point_mul_g (as_seq h0 s)))
[@CInline] | false | false | Hacl.Impl.Ed25519.Sign.fst | {
"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"
} | null | val point_mul_g_compress (out s:lbuffer uint8 32ul) : Stack unit
(requires fun h ->
live h out /\ live h s /\ disjoint s out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Ed25519.point_compress (Spec.Ed25519.point_mul_g (as_seq h0 s))) | [] | Hacl.Impl.Ed25519.Sign.point_mul_g_compress | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.Sign.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> s: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 14,
"end_line": 32,
"start_col": 2,
"start_line": 28
} |
FStar.HyperStack.ST.Stack | val sign_expanded:
signature:lbuffer uint8 64ul
-> expanded_keys:lbuffer uint8 96ul
-> msg_len:size_t
-> msg:lbuffer uint8 msg_len ->
Stack unit
(requires fun h ->
live h signature /\ live h msg /\ live h expanded_keys /\
disjoint signature msg /\ disjoint signature expanded_keys)
(ensures fun h0 _ h1 -> modifies (loc signature) h0 h1 /\
as_seq h1 signature == Spec.Ed25519.sign_expanded
(as_seq h0 (gsub expanded_keys 0ul 32ul))
(as_seq h0 (gsub expanded_keys 32ul 32ul))
(as_seq h0 (gsub expanded_keys 64ul 32ul))
(as_seq h0 msg)) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.BignumQ.Definitions",
"short_module": "S56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.BignumQ.Mul",
"short_module": "F56"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"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.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"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
}
] | false | let sign_expanded signature expanded_keys msg_len msg =
push_frame ();
let rs = sub signature 0ul 32ul in
let ss = sub signature 32ul 32ul in
let rq = create 5ul (u64 0) in
let hq = create 5ul (u64 0) in
let rb = create 32ul (u8 0) in
// expanded_keys = [ public_key; s; prefix ]
let public_key = sub expanded_keys 0ul 32ul in
let s = sub expanded_keys 32ul 32ul in
let prefix = sub expanded_keys 64ul 32ul in
Hacl.Impl.SHA512.ModQ.store_sha512_modq_pre rb rq prefix msg_len msg;
point_mul_g_compress rs rb;
Hacl.Impl.SHA512.ModQ.sha512_modq_pre_pre2 hq rs public_key msg_len msg;
sign_compute_s rq hq s ss;
let h1 = ST.get () in
LSeq.eq_intro (as_seq h1 signature)
(Spec.Ed25519.sign_expanded (as_seq h1 public_key) (as_seq h1 s) (as_seq h1 prefix) (as_seq h1 msg));
pop_frame () | val sign_expanded:
signature:lbuffer uint8 64ul
-> expanded_keys:lbuffer uint8 96ul
-> msg_len:size_t
-> msg:lbuffer uint8 msg_len ->
Stack unit
(requires fun h ->
live h signature /\ live h msg /\ live h expanded_keys /\
disjoint signature msg /\ disjoint signature expanded_keys)
(ensures fun h0 _ h1 -> modifies (loc signature) h0 h1 /\
as_seq h1 signature == Spec.Ed25519.sign_expanded
(as_seq h0 (gsub expanded_keys 0ul 32ul))
(as_seq h0 (gsub expanded_keys 32ul 32ul))
(as_seq h0 (gsub expanded_keys 64ul 32ul))
(as_seq h0 msg))
let sign_expanded signature expanded_keys msg_len msg = | true | null | false | push_frame ();
let rs = sub signature 0ul 32ul in
let ss = sub signature 32ul 32ul in
let rq = create 5ul (u64 0) in
let hq = create 5ul (u64 0) in
let rb = create 32ul (u8 0) in
let public_key = sub expanded_keys 0ul 32ul in
let s = sub expanded_keys 32ul 32ul in
let prefix = sub expanded_keys 64ul 32ul in
Hacl.Impl.SHA512.ModQ.store_sha512_modq_pre rb rq prefix msg_len msg;
point_mul_g_compress rs rb;
Hacl.Impl.SHA512.ModQ.sha512_modq_pre_pre2 hq rs public_key msg_len msg;
sign_compute_s rq hq s ss;
let h1 = ST.get () in
LSeq.eq_intro (as_seq h1 signature)
(Spec.Ed25519.sign_expanded (as_seq h1 public_key)
(as_seq h1 s)
(as_seq h1 prefix)
(as_seq h1 msg));
pop_frame () | {
"checked_file": "Hacl.Impl.Ed25519.Sign.fst.checked",
"dependencies": [
"Spec.Ed25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.BignumQ.Definitions.fst.checked",
"Hacl.Impl.Store56.fst.checked",
"Hacl.Impl.SHA512.ModQ.fst.checked",
"Hacl.Impl.Load56.fst.checked",
"Hacl.Impl.Ed25519.PointCompress.fst.checked",
"Hacl.Impl.Ed25519.Ladder.fsti.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Impl.BignumQ.Mul.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.Sign.fst"
} | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Lib.Sequence.eq_intro",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Spec.Ed25519.sign_expanded",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Impl.Ed25519.Sign.sign_compute_s",
"Hacl.Impl.SHA512.ModQ.sha512_modq_pre_pre2",
"Hacl.Impl.Ed25519.Sign.point_mul_g_compress",
"Hacl.Impl.SHA512.ModQ.store_sha512_modq_pre",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub",
"Lib.Buffer.create",
"Lib.IntTypes.u8",
"Lib.IntTypes.U64",
"Lib.IntTypes.uint64",
"Lib.IntTypes.u64",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Ed25519.Sign
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
module ST = FStar.HyperStack.ST
module BSeq = Lib.ByteSequence
module LSeq = Lib.Sequence
module F51 = Hacl.Impl.Ed25519.Field51
module F56 = Hacl.Impl.BignumQ.Mul
module S56 = Hacl.Spec.BignumQ.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
val point_mul_g_compress (out s:lbuffer uint8 32ul) : Stack unit
(requires fun h ->
live h out /\ live h s /\ disjoint s out)
(ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Ed25519.point_compress (Spec.Ed25519.point_mul_g (as_seq h0 s)))
[@CInline]
let point_mul_g_compress out s =
push_frame ();
let tmp = create 20ul (u64 0) in
Hacl.Impl.Ed25519.Ladder.point_mul_g tmp s;
Hacl.Impl.Ed25519.PointCompress.point_compress out tmp;
pop_frame ()
inline_for_extraction noextract
val sign_compute_s (r hs:lbuffer uint64 5ul) (a s:lbuffer uint8 32ul) : Stack unit
(requires fun h ->
live h r /\ live h hs /\ live h a /\ live h s /\
disjoint s r /\ disjoint s hs /\ disjoint s a /\
F56.scalar_inv_full_t h r /\ F56.scalar_inv_full_t h hs)
(ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\
as_seq h1 s == BSeq.nat_to_bytes_le 32 ((F56.as_nat h0 r +
(F56.as_nat h0 hs * BSeq.nat_from_bytes_le (as_seq h0 a)) % Spec.Ed25519.q) % Spec.Ed25519.q))
let sign_compute_s r hs a s =
push_frame ();
let aq = create 5ul (u64 0) in
Hacl.Impl.Load56.load_32_bytes aq a;
Hacl.Impl.BignumQ.Mul.mul_modq aq hs aq;
Hacl.Impl.BignumQ.Mul.add_modq aq r aq;
assert_norm (0x100000000000000 == pow2 56);
Hacl.Impl.Store56.store_56 s aq;
pop_frame ()
inline_for_extraction noextract
val sign_expanded:
signature:lbuffer uint8 64ul
-> expanded_keys:lbuffer uint8 96ul
-> msg_len:size_t
-> msg:lbuffer uint8 msg_len ->
Stack unit
(requires fun h ->
live h signature /\ live h msg /\ live h expanded_keys /\
disjoint signature msg /\ disjoint signature expanded_keys)
(ensures fun h0 _ h1 -> modifies (loc signature) h0 h1 /\
as_seq h1 signature == Spec.Ed25519.sign_expanded
(as_seq h0 (gsub expanded_keys 0ul 32ul))
(as_seq h0 (gsub expanded_keys 32ul 32ul))
(as_seq h0 (gsub expanded_keys 64ul 32ul))
(as_seq h0 msg)) | false | false | Hacl.Impl.Ed25519.Sign.fst | {
"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"
} | null | val sign_expanded:
signature:lbuffer uint8 64ul
-> expanded_keys:lbuffer uint8 96ul
-> msg_len:size_t
-> msg:lbuffer uint8 msg_len ->
Stack unit
(requires fun h ->
live h signature /\ live h msg /\ live h expanded_keys /\
disjoint signature msg /\ disjoint signature expanded_keys)
(ensures fun h0 _ h1 -> modifies (loc signature) h0 h1 /\
as_seq h1 signature == Spec.Ed25519.sign_expanded
(as_seq h0 (gsub expanded_keys 0ul 32ul))
(as_seq h0 (gsub expanded_keys 32ul 32ul))
(as_seq h0 (gsub expanded_keys 64ul 32ul))
(as_seq h0 msg)) | [] | Hacl.Impl.Ed25519.Sign.sign_expanded | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.Sign.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
signature: Lib.Buffer.lbuffer Lib.IntTypes.uint8 64ul ->
expanded_keys: Lib.Buffer.lbuffer Lib.IntTypes.uint8 96ul ->
msg_len: Lib.IntTypes.size_t ->
msg: Lib.Buffer.lbuffer Lib.IntTypes.uint8 msg_len
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 14,
"end_line": 94,
"start_col": 2,
"start_line": 74
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data | let scratch_b_data
(rev_bytes rev_blocks: bool)
(scratch_in_b: buffer128)
(scratch_len count: int)
(heap_s: vale_heap)
(layout: vale_heap_layout)
(ptr: int)
(data: seq quad32)
= | false | null | false | validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Prims.bool",
"Vale.X64.Memory.buffer128",
"Prims.int",
"Vale.X64.InsBasic.vale_heap",
"Vale.Arch.HeapImpl.vale_heap_layout",
"FStar.Seq.Base.seq",
"Vale.X64.Decls.quad32",
"Prims.l_and",
"Vale.X64.Decls.validSrcAddrs128",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.AES.X64.AESopt2.scratch_b_blocks",
"Prims.logical"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32) | false | true | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val scratch_b_data : rev_bytes: Prims.bool ->
rev_blocks: Prims.bool ->
scratch_in_b: Vale.X64.Memory.buffer128 ->
scratch_len: Prims.int ->
count: Prims.int ->
heap_s: Vale.X64.InsBasic.vale_heap ->
layout: Vale.Arch.HeapImpl.vale_heap_layout ->
ptr: Prims.int ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32
-> Prims.logical | [] | Vale.AES.X64.AESopt2.scratch_b_data | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
rev_bytes: Prims.bool ->
rev_blocks: Prims.bool ->
scratch_in_b: Vale.X64.Memory.buffer128 ->
scratch_len: Prims.int ->
count: Prims.int ->
heap_s: Vale.X64.InsBasic.vale_heap ->
layout: Vale.Arch.HeapImpl.vale_heap_layout ->
ptr: Prims.int ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32
-> Prims.logical | {
"end_col": 82,
"end_line": 70,
"start_col": 2,
"start_line": 69
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_subscript_FStar__Seq__Base__seq = Seq.index | let va_subscript_FStar__Seq__Base__seq = | false | null | false | Seq.index | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"FStar.Seq.Base.index",
"FStar.Seq.Base.seq",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.length"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50" | false | false | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_subscript_FStar__Seq__Base__seq : s: FStar.Seq.Base.seq _ -> i: Prims.nat{i < FStar.Seq.Base.length s} -> _ | [] | Vale.AES.X64.AESopt2.va_subscript_FStar__Seq__Base__seq | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq _ -> i: Prims.nat{i < FStar.Seq.Base.length s} -> _ | {
"end_col": 57,
"end_line": 39,
"start_col": 48,
"start_line": 39
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6 | let hkeys_b_powers
(hkeys_b: buffer128)
(heap0: vale_heap)
(layout: vale_heap_layout)
(ptr: int)
(h: poly)
= | false | null | false | validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6 | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.buffer128",
"Vale.X64.InsBasic.vale_heap",
"Vale.Arch.HeapImpl.vale_heap_layout",
"Prims.int",
"Vale.Math.Poly2_s.poly",
"Prims.l_and",
"Vale.X64.Decls.validSrcAddrs128",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.eq2",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.X64.Decls.buffer128_read",
"Vale.AES.GHash.gf128_power",
"Prims.logical"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index | false | true | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val hkeys_b_powers : hkeys_b: Vale.X64.Memory.buffer128 ->
heap0: Vale.X64.InsBasic.vale_heap ->
layout: Vale.Arch.HeapImpl.vale_heap_layout ->
ptr: Prims.int ->
h: Vale.Math.Poly2_s.poly
-> Prims.logical | [] | Vale.AES.X64.AESopt2.hkeys_b_powers | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
hkeys_b: Vale.X64.Memory.buffer128 ->
heap0: Vale.X64.InsBasic.vale_heap ->
layout: Vale.Arch.HeapImpl.vale_heap_layout ->
ptr: Prims.int ->
h: Vale.Math.Poly2_s.poly
-> Prims.logical | {
"end_col": 63,
"end_line": 48,
"start_col": 2,
"start_line": 42
} |
|
Prims.Tot | val index_opt_rev (b: bool) (len n i: int) : int | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i | val index_opt_rev (b: bool) (len n i: int) : int
let index_opt_rev (b: bool) (len n i: int) : int = | false | null | false | if b then len - 1 - i else len - n + i | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Prims.bool",
"Prims.int",
"Prims.op_Subtraction",
"Prims.op_Addition"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q | false | true | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val index_opt_rev (b: bool) (len n i: int) : int | [] | Vale.AES.X64.AESopt2.index_opt_rev | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: Prims.bool -> len: Prims.int -> n: Prims.int -> i: Prims.int -> Prims.int | {
"end_col": 40,
"end_line": 54,
"start_col": 2,
"start_line": 54
} |
Prims.Tot | val quad32_opt_rev (b: bool) (q: quad32) : quad32 | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q | val quad32_opt_rev (b: bool) (q: quad32) : quad32
let quad32_opt_rev (b: bool) (q: quad32) : quad32 = | false | null | false | if b then reverse_bytes_quad32 q else q | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Prims.bool",
"Vale.X64.Decls.quad32",
"Vale.Def.Types_s.reverse_bytes_quad32"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6 | false | true | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val quad32_opt_rev (b: bool) (q: quad32) : quad32 | [] | Vale.AES.X64.AESopt2.quad32_opt_rev | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: Prims.bool -> q: Vale.X64.Decls.quad32 -> Vale.X64.Decls.quad32 | {
"end_col": 41,
"end_line": 51,
"start_col": 2,
"start_line": 51
} |
Prims.Tot | val va_wp_GhashUnroll_n
(rev_bytes rev_blocks exactly6: bool)
(scratch_len: nat64)
(hkeys_b scratch_in_b: buffer128)
(h_LE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_wp_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32)
(va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM = va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_flags va_x_efl va_s0)))))))))))
in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) ==>
va_k va_sM (()))) | val va_wp_GhashUnroll_n
(rev_bytes rev_blocks exactly6: bool)
(scratch_len: nat64)
(hkeys_b scratch_in_b: buffer128)
(h_LE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_GhashUnroll_n
(rev_bytes rev_blocks exactly6: bool)
(scratch_len: nat64)
(hkeys_b scratch_in_b: buffer128)
(h_LE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
(let h:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in
let prev:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev)
in
let pdata:(Prims.int -> Vale.AES.GHash.poly128) =
Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in
let n:Prims.nat = FStar.Seq.Base.length #quad32 data in
let scratch_index:int = index_opt_rev rev_blocks scratch_len n (n - 1) in
pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ (exactly6 ==> n == 6) /\
(~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0)
(va_get_reg64 rR9 va_s0 - 32)
h /\
scratch_b_data rev_bytes
rev_blocks
scratch_in_b
scratch_len
6
(va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0)
(va_get_reg64 rRdi va_s0)
data /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\
(~exactly6 ==> va_get_reg64 rRdx va_s0 == n) /\
va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_index /\
(~rev_bytes ==>
va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)) /\
(forall (va_x_efl: Vale.X64.Flags.t) (va_x_r10: nat64) (va_x_r11: nat64) (va_x_xmm0: quad32)
(va_x_xmm1: quad32) (va_x_xmm2: quad32) (va_x_xmm3: quad32) (va_x_xmm4: quad32)
(va_x_xmm5: quad32) (va_x_xmm6: quad32) (va_x_xmm7: quad32) (va_x_xmm8: quad32).
let va_sM =
va_upd_xmm 8
va_x_xmm8
(va_upd_xmm 7
va_x_xmm7
(va_upd_xmm 6
va_x_xmm6
(va_upd_xmm 5
va_x_xmm5
(va_upd_xmm 4
va_x_xmm4
(va_upd_xmm 3
va_x_xmm3
(va_upd_xmm 2
va_x_xmm2
(va_upd_xmm 1
va_x_xmm1
(va_upd_xmm 0
va_x_xmm0
(va_upd_reg64 rR11
va_x_r11
(va_upd_reg64 rR10
va_x_r10
(va_upd_flags va_x_efl va_s0)))))))))))
in
va_get_ok va_sM /\
(let h:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in
let prev:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev)
in
let pdata:(Prims.int -> Vale.AES.GHash.poly128) =
Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in
let n:Prims.nat = FStar.Seq.Base.length #quad32 data in
let scratch_index:int = index_opt_rev rev_blocks scratch_len n (n - 1) in
va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Prims.bool",
"Vale.X64.Memory.nat64",
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.quad32",
"FStar.Seq.Base.seq",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled",
"Vale.X64.CPU_Features_s.avx_enabled",
"Vale.X64.CPU_Features_s.sse_enabled",
"Prims.l_imp",
"Prims.eq2",
"Prims.int",
"Prims.l_not",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Vale.AES.X64.AESopt2.hkeys_b_powers",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_mem_layout",
"Prims.op_Subtraction",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.AES.X64.AESopt2.scratch_b_data",
"Vale.X64.Machine_s.rRdi",
"Prims.op_Addition",
"Prims.op_Multiply",
"Vale.X64.Machine_s.pow2_64",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.X64.Decls.va_get_xmm",
"Prims.nat",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rR11",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.Mkfour",
"Vale.AES.X64.AESopt2.index_opt_rev",
"FStar.Seq.Base.length",
"Vale.AES.GHash.poly128",
"Vale.AES.GHash.fun_seq_quad32_LE_poly128",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Prims.l_Forall",
"Vale.X64.Flags.t",
"Vale.Def.Types_s.quad32",
"Vale.AES.GHash.ghash_incremental",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR10",
"Vale.X64.Decls.va_upd_flags"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data
//-- MulAdd_step
val va_code_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm -> Tot va_code
val va_codegen_success_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm ->
a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm ->
c:va_operand_xmm -> Tot va_pbool
val va_lemma_MulAdd_step : va_b0:va_code -> va_s0:va_state -> m:nat -> power_index:int ->
a0:va_operand_xmm -> a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm ->
b:va_operand_xmm -> c:va_operand_xmm -> hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly ->
prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) va_s0 /\
va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = (if (m = 1) then va_eval_xmm va_s0
a1 else va_get_xmm 4 va_s0) in (m > 0 ==> add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128
data in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = (if (m = 0) then va_eval_xmm va_sM a0 else
va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) /\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 4 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_xmm c va_sM (va_update_operand_xmm b va_sM (va_update_operand_xmm a3 va_sM
(va_update_operand_xmm a2 va_sM (va_update_operand_xmm a1 va_sM (va_update_operand_xmm a0 va_sM
va_s0)))))))))))))))
[@ va_qattr]
let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = va_if (m = 1) (fun _ ->
va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in (m > 0 ==> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1))) /\ (forall
(va_x_a0:va_value_xmm) (va_x_a1:va_value_xmm) (va_x_a2:va_value_xmm) (va_x_a3:va_value_xmm)
(va_x_b:va_value_xmm) (va_x_c:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32)
(va_x_xmm4:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_operand_xmm c va_x_c (va_upd_operand_xmm
b va_x_b (va_upd_operand_xmm a3 va_x_a3 (va_upd_operand_xmm a2 va_x_a2 (va_upd_operand_xmm a1
va_x_a1 (va_upd_operand_xmm a0 va_x_a0 va_s0))))))))))) in va_get_ok va_sM /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _
-> va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) ==> va_k va_sM (())))
val va_wpProof_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm ->
hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly -> prev:poly -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b
scratch_b h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_step m power_index a0 a1 a2 a3
b c) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags;
va_mod_xmm c; va_mod_xmm b; va_mod_xmm a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) : (va_quickCode unit
(va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) =
(va_QProc (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags; va_mod_xmm c; va_mod_xmm b; va_mod_xmm
a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) (va_wp_MulAdd_step m power_index a0 a1 a2 a3
b c hkeys_b scratch_b h prev data) (va_wpProof_MulAdd_step m power_index a0 a1 a2 a3 b c
hkeys_b scratch_b h prev data))
//--
//-- ReduceLast
val va_code_ReduceLast : last_adds:bool -> Tot va_code
val va_codegen_success_ReduceLast : last_adds:bool -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> last_adds:bool -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast last_adds) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi = (if last_adds then
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) else add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_xmm 8 va_sM
(va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM
(va_update_xmm 3 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl
va_s0))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in let (n:Prims.nat) =
FStar.Seq.Base.length #quad32 data in let xi = va_if last_adds (fun _ ->
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (fun _ -> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : last_adds:bool -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ReduceLast last_adds h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast last_adds) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0;
va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast last_adds)) =
(va_QProc (va_code_ReduceLast last_adds) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0; va_Mod_flags]) (va_wp_ReduceLast last_adds h_LE
y_prev data) (va_wpProof_ReduceLast last_adds h_LE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot
va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> rev_bytes:bool -> rev_blocks:bool
-> exactly6:bool -> scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 ->
h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) /\
va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10
va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) | false | true | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_GhashUnroll_n
(rev_bytes rev_blocks exactly6: bool)
(scratch_len: nat64)
(hkeys_b scratch_in_b: buffer128)
(h_LE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.X64.AESopt2.va_wp_GhashUnroll_n | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
rev_bytes: Prims.bool ->
rev_blocks: Prims.bool ->
exactly6: Prims.bool ->
scratch_len: Vale.X64.Memory.nat64 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
scratch_in_b: Vale.X64.Memory.buffer128 ->
h_LE: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | {
"end_col": 21,
"end_line": 357,
"start_col": 2,
"start_line": 328
} |
Prims.Tot | val va_wp_Ghash_buffer
(hkeys_b in_b: buffer128)
(h_LE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_wp_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_LE:quad32) (y_prev:quad32)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled
/\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64
rR9 va_s0 - 32) h /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64
rRdi va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == va_get_reg64 rRdx va_s0 /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_xmm 8
va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 y_prev /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051) /\ (forall
(va_x_rdx:nat64) (va_x_r11:nat64) (va_x_r10:nat64) (va_x_efl:Vale.X64.Flags.t)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRdx va_x_rdx va_s0)))))))))))) in va_get_ok va_sM /\ (let (h:poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_get_xmm 8
va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental0 h_LE y_prev
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) /\ (va_get_reg64 rRdx va_s0 == 0 ==>
va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)) ==> va_k va_sM (()))) | val va_wp_Ghash_buffer
(hkeys_b in_b: buffer128)
(h_LE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_Ghash_buffer
(hkeys_b in_b: buffer128)
(h_LE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
(let h:poly = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in
pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\
hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0)
(va_get_reg64 rR9 va_s0 - 32)
h /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRdi va_s0)
in_b
(va_get_reg64 rRdx va_s0)
(va_get_mem_layout va_s0)
Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == va_get_reg64 rRdx va_s0 /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` (va_get_reg64 rRdx va_s0) < pow2_64 /\
va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 y_prev /\
va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051) /\
(forall (va_x_rdx: nat64) (va_x_r11: nat64) (va_x_r10: nat64) (va_x_efl: Vale.X64.Flags.t)
(va_x_xmm0: quad32) (va_x_xmm1: quad32) (va_x_xmm2: quad32) (va_x_xmm3: quad32)
(va_x_xmm4: quad32) (va_x_xmm5: quad32) (va_x_xmm6: quad32) (va_x_xmm7: quad32)
(va_x_xmm8: quad32).
let va_sM =
va_upd_xmm 8
va_x_xmm8
(va_upd_xmm 7
va_x_xmm7
(va_upd_xmm 6
va_x_xmm6
(va_upd_xmm 5
va_x_xmm5
(va_upd_xmm 4
va_x_xmm4
(va_upd_xmm 3
va_x_xmm3
(va_upd_xmm 2
va_x_xmm2
(va_upd_xmm 1
va_x_xmm1
(va_upd_xmm 0
va_x_xmm0
(va_upd_flags va_x_efl
(va_upd_reg64 rR10
va_x_r10
(va_upd_reg64 rR11
va_x_r11
(va_upd_reg64 rRdx va_x_rdx va_s0))))))))))))
in
va_get_ok va_sM /\
(let h:poly = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in
va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental0 h_LE
y_prev
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) /\
(va_get_reg64 rRdx va_s0 == 0 ==> va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.quad32",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled",
"Vale.X64.CPU_Features_s.avx_enabled",
"Vale.X64.CPU_Features_s.sse_enabled",
"Vale.AES.X64.AESopt2.hkeys_b_powers",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_mem_layout",
"Prims.op_Subtraction",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Decls.validSrcAddrs128",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Machine_s.rRdx",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.eq2",
"Prims.nat",
"Vale.X64.Decls.buffer_length",
"Vale.X64.Memory.vuint128",
"Prims.op_LessThan",
"Prims.op_Addition",
"Prims.op_Multiply",
"Vale.X64.Machine_s.pow2_64",
"Vale.Def.Types_s.quad32",
"Vale.X64.Decls.va_get_xmm",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.Mkfour",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Vale.AES.GHash.ghash_incremental0",
"Vale.X64.Decls.s128",
"Prims.int",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR10",
"Vale.X64.Machine_s.rR11"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data
//-- MulAdd_step
val va_code_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm -> Tot va_code
val va_codegen_success_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm ->
a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm ->
c:va_operand_xmm -> Tot va_pbool
val va_lemma_MulAdd_step : va_b0:va_code -> va_s0:va_state -> m:nat -> power_index:int ->
a0:va_operand_xmm -> a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm ->
b:va_operand_xmm -> c:va_operand_xmm -> hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly ->
prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) va_s0 /\
va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = (if (m = 1) then va_eval_xmm va_s0
a1 else va_get_xmm 4 va_s0) in (m > 0 ==> add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128
data in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = (if (m = 0) then va_eval_xmm va_sM a0 else
va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) /\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 4 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_xmm c va_sM (va_update_operand_xmm b va_sM (va_update_operand_xmm a3 va_sM
(va_update_operand_xmm a2 va_sM (va_update_operand_xmm a1 va_sM (va_update_operand_xmm a0 va_sM
va_s0)))))))))))))))
[@ va_qattr]
let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = va_if (m = 1) (fun _ ->
va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in (m > 0 ==> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1))) /\ (forall
(va_x_a0:va_value_xmm) (va_x_a1:va_value_xmm) (va_x_a2:va_value_xmm) (va_x_a3:va_value_xmm)
(va_x_b:va_value_xmm) (va_x_c:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32)
(va_x_xmm4:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_operand_xmm c va_x_c (va_upd_operand_xmm
b va_x_b (va_upd_operand_xmm a3 va_x_a3 (va_upd_operand_xmm a2 va_x_a2 (va_upd_operand_xmm a1
va_x_a1 (va_upd_operand_xmm a0 va_x_a0 va_s0))))))))))) in va_get_ok va_sM /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _
-> va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) ==> va_k va_sM (())))
val va_wpProof_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm ->
hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly -> prev:poly -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b
scratch_b h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_step m power_index a0 a1 a2 a3
b c) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags;
va_mod_xmm c; va_mod_xmm b; va_mod_xmm a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) : (va_quickCode unit
(va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) =
(va_QProc (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags; va_mod_xmm c; va_mod_xmm b; va_mod_xmm
a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) (va_wp_MulAdd_step m power_index a0 a1 a2 a3
b c hkeys_b scratch_b h prev data) (va_wpProof_MulAdd_step m power_index a0 a1 a2 a3 b c
hkeys_b scratch_b h prev data))
//--
//-- ReduceLast
val va_code_ReduceLast : last_adds:bool -> Tot va_code
val va_codegen_success_ReduceLast : last_adds:bool -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> last_adds:bool -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast last_adds) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi = (if last_adds then
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) else add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_xmm 8 va_sM
(va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM
(va_update_xmm 3 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl
va_s0))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in let (n:Prims.nat) =
FStar.Seq.Base.length #quad32 data in let xi = va_if last_adds (fun _ ->
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (fun _ -> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : last_adds:bool -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ReduceLast last_adds h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast last_adds) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0;
va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast last_adds)) =
(va_QProc (va_code_ReduceLast last_adds) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0; va_Mod_flags]) (va_wp_ReduceLast last_adds h_LE
y_prev data) (va_wpProof_ReduceLast last_adds h_LE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot
va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> rev_bytes:bool -> rev_blocks:bool
-> exactly6:bool -> scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 ->
h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) /\
va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10
va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32)
(va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM = va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_flags va_x_efl va_s0)))))))))))
in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) ==>
va_k va_sM (())))
val va_wpProof_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool ->
scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 -> h_LE:quad32 -> y_prev:quad32
-> data:(seq quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len
hkeys_b scratch_in_b h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll_n rev_bytes rev_blocks
exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6)) =
(va_QProc (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags]) (va_wp_GhashUnroll_n rev_bytes
rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE y_prev data)
(va_wpProof_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE
y_prev data))
//--
//-- Ghash_register
val va_code_Ghash_register : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_register : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_register : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> h_LE:quad32
-> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_register ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in pclmulqdq_enabled
/\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0) == prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
/\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))))))
[@ va_qattr]
let va_wp_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in pclmulqdq_enabled
/\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0) == prev) /\ (forall (va_x_efl:Vale.X64.Flags.t) (va_x_r11:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11 va_x_r11 (va_upd_flags va_x_efl va_s0)))))))))) in
va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
==> va_k va_sM (())))
val va_wpProof_Ghash_register : hkeys_b:buffer128 -> h_LE:quad32 -> y_prev:quad32 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Ghash_register hkeys_b h_LE y_prev va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_register ()) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) : (va_quickCode unit
(va_code_Ghash_register ())) =
(va_QProc (va_code_Ghash_register ()) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_flags]) (va_wp_Ghash_register hkeys_b h_LE y_prev) (va_wpProof_Ghash_register hkeys_b
h_LE y_prev))
//--
//-- Ghash_buffer
val va_code_Ghash_buffer : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_buffer : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_buffer : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> in_b:buffer128
-> h_LE:quad32 -> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in
pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) in_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == va_get_reg64 rRdx va_s0 /\ va_get_reg64 rRdi va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_xmm 8 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 y_prev /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in va_get_xmm 8 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE y_prev (Vale.X64.Decls.s128 (va_get_mem_heaplet 1
va_sM) in_b)) /\ (va_get_reg64 rRdx va_s0 == 0 ==> va_get_xmm 8 va_sM == va_get_xmm 8 va_s0))
/\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_reg64 rR10
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRdx va_sM (va_update_ok va_sM
va_s0))))))))))))))))
[@ va_qattr]
let va_wp_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_LE:quad32) (y_prev:quad32) | false | true | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_Ghash_buffer
(hkeys_b in_b: buffer128)
(h_LE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.X64.AESopt2.va_wp_Ghash_buffer | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
hkeys_b: Vale.X64.Memory.buffer128 ->
in_b: Vale.X64.Memory.buffer128 ->
h_LE: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | {
"end_col": 68,
"end_line": 507,
"start_col": 2,
"start_line": 488
} |
Prims.Tot | val va_wp_Ghash_register
(hkeys_b: buffer128)
(h_LE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_wp_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in pclmulqdq_enabled
/\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0) == prev) /\ (forall (va_x_efl:Vale.X64.Flags.t) (va_x_r11:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11 va_x_r11 (va_upd_flags va_x_efl va_s0)))))))))) in
va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
==> va_k va_sM (()))) | val va_wp_Ghash_register
(hkeys_b: buffer128)
(h_LE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_Ghash_register
(hkeys_b: buffer128)
(h_LE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
(let h:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in
let data:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32) =
FStar.Seq.Base.create #Vale.Def.Types_s.quad32
1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0))
in
let prev:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev)
in
let pdata:(Prims.int -> Vale.AES.GHash.poly128) =
Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in
pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\
hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0)
(va_get_reg64 rR9 va_s0 - 32)
h /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev) /\
(forall (va_x_efl: Vale.X64.Flags.t) (va_x_r11: nat64) (va_x_xmm0: quad32) (va_x_xmm1: quad32)
(va_x_xmm2: quad32) (va_x_xmm3: quad32) (va_x_xmm4: quad32) (va_x_xmm5: quad32)
(va_x_xmm6: quad32) (va_x_xmm7: quad32) (va_x_xmm8: quad32).
let va_sM =
va_upd_xmm 8
va_x_xmm8
(va_upd_xmm 7
va_x_xmm7
(va_upd_xmm 6
va_x_xmm6
(va_upd_xmm 5
va_x_xmm5
(va_upd_xmm 4
va_x_xmm4
(va_upd_xmm 3
va_x_xmm3
(va_upd_xmm 2
va_x_xmm2
(va_upd_xmm 1
va_x_xmm1
(va_upd_xmm 0
va_x_xmm0
(va_upd_reg64 rR11 va_x_r11 (va_upd_flags va_x_efl va_s0))
))))))))
in
va_get_ok va_sM /\
(let h:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in
let data:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32) =
FStar.Seq.Base.create #Vale.Def.Types_s.quad32
1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0))
in
let prev:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev)
in
let pdata:(Prims.int -> Vale.AES.GHash.poly128) =
Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in
va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data)) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.quad32",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled",
"Vale.X64.CPU_Features_s.avx_enabled",
"Vale.X64.CPU_Features_s.sse_enabled",
"Vale.AES.X64.AESopt2.hkeys_b_powers",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_mem_layout",
"Prims.op_Subtraction",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rR9",
"Prims.eq2",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.X64.Decls.va_get_xmm",
"Prims.int",
"Vale.AES.GHash.poly128",
"Vale.AES.GHash.fun_seq_quad32_LE_poly128",
"Vale.Def.Types_s.reverse_bytes_quad32",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"FStar.Seq.Base.create",
"Prims.l_Forall",
"Vale.X64.Flags.t",
"Vale.X64.Memory.nat64",
"Prims.l_imp",
"Vale.AES.GHash.ghash_incremental",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_upd_flags"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data
//-- MulAdd_step
val va_code_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm -> Tot va_code
val va_codegen_success_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm ->
a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm ->
c:va_operand_xmm -> Tot va_pbool
val va_lemma_MulAdd_step : va_b0:va_code -> va_s0:va_state -> m:nat -> power_index:int ->
a0:va_operand_xmm -> a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm ->
b:va_operand_xmm -> c:va_operand_xmm -> hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly ->
prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) va_s0 /\
va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = (if (m = 1) then va_eval_xmm va_s0
a1 else va_get_xmm 4 va_s0) in (m > 0 ==> add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128
data in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = (if (m = 0) then va_eval_xmm va_sM a0 else
va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) /\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 4 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_xmm c va_sM (va_update_operand_xmm b va_sM (va_update_operand_xmm a3 va_sM
(va_update_operand_xmm a2 va_sM (va_update_operand_xmm a1 va_sM (va_update_operand_xmm a0 va_sM
va_s0)))))))))))))))
[@ va_qattr]
let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = va_if (m = 1) (fun _ ->
va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in (m > 0 ==> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1))) /\ (forall
(va_x_a0:va_value_xmm) (va_x_a1:va_value_xmm) (va_x_a2:va_value_xmm) (va_x_a3:va_value_xmm)
(va_x_b:va_value_xmm) (va_x_c:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32)
(va_x_xmm4:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_operand_xmm c va_x_c (va_upd_operand_xmm
b va_x_b (va_upd_operand_xmm a3 va_x_a3 (va_upd_operand_xmm a2 va_x_a2 (va_upd_operand_xmm a1
va_x_a1 (va_upd_operand_xmm a0 va_x_a0 va_s0))))))))))) in va_get_ok va_sM /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _
-> va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) ==> va_k va_sM (())))
val va_wpProof_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm ->
hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly -> prev:poly -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b
scratch_b h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_step m power_index a0 a1 a2 a3
b c) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags;
va_mod_xmm c; va_mod_xmm b; va_mod_xmm a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) : (va_quickCode unit
(va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) =
(va_QProc (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags; va_mod_xmm c; va_mod_xmm b; va_mod_xmm
a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) (va_wp_MulAdd_step m power_index a0 a1 a2 a3
b c hkeys_b scratch_b h prev data) (va_wpProof_MulAdd_step m power_index a0 a1 a2 a3 b c
hkeys_b scratch_b h prev data))
//--
//-- ReduceLast
val va_code_ReduceLast : last_adds:bool -> Tot va_code
val va_codegen_success_ReduceLast : last_adds:bool -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> last_adds:bool -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast last_adds) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi = (if last_adds then
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) else add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_xmm 8 va_sM
(va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM
(va_update_xmm 3 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl
va_s0))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in let (n:Prims.nat) =
FStar.Seq.Base.length #quad32 data in let xi = va_if last_adds (fun _ ->
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (fun _ -> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : last_adds:bool -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ReduceLast last_adds h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast last_adds) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0;
va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast last_adds)) =
(va_QProc (va_code_ReduceLast last_adds) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0; va_Mod_flags]) (va_wp_ReduceLast last_adds h_LE
y_prev data) (va_wpProof_ReduceLast last_adds h_LE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot
va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> rev_bytes:bool -> rev_blocks:bool
-> exactly6:bool -> scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 ->
h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) /\
va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10
va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32)
(va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM = va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_flags va_x_efl va_s0)))))))))))
in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) ==>
va_k va_sM (())))
val va_wpProof_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool ->
scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 -> h_LE:quad32 -> y_prev:quad32
-> data:(seq quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len
hkeys_b scratch_in_b h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll_n rev_bytes rev_blocks
exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6)) =
(va_QProc (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags]) (va_wp_GhashUnroll_n rev_bytes
rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE y_prev data)
(va_wpProof_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE
y_prev data))
//--
//-- Ghash_register
val va_code_Ghash_register : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_register : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_register : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> h_LE:quad32
-> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_register ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in pclmulqdq_enabled
/\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0) == prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
/\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))))))
[@ va_qattr]
let va_wp_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) (va_s0:va_state) | false | true | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_Ghash_register
(hkeys_b: buffer128)
(h_LE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.X64.AESopt2.va_wp_Ghash_register | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
hkeys_b: Vale.X64.Memory.buffer128 ->
h_LE: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | {
"end_col": 25,
"end_line": 439,
"start_col": 2,
"start_line": 416
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i)) | let scratch_b_blocks
(rev_bytes rev_blocks: bool)
(scratch_in_b: buffer128)
(scratch_len count: int)
(heap_s: vale_heap)
(data: seq quad32)
= | false | null | false | (forall (i: nat). {:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i)) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Prims.bool",
"Vale.X64.Memory.buffer128",
"Prims.int",
"Vale.X64.InsBasic.vale_heap",
"FStar.Seq.Base.seq",
"Vale.X64.Decls.quad32",
"Prims.l_Forall",
"Prims.nat",
"Prims.l_imp",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"Prims.eq2",
"Vale.X64.Decls.buffer128_read",
"Vale.AES.X64.AESopt2.index_opt_rev",
"Vale.AES.X64.AESopt2.quad32_opt_rev",
"FStar.Seq.Base.index",
"Prims.logical"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32) | false | true | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val scratch_b_blocks : rev_bytes: Prims.bool ->
rev_blocks: Prims.bool ->
scratch_in_b: Vale.X64.Memory.buffer128 ->
scratch_len: Prims.int ->
count: Prims.int ->
heap_s: Vale.X64.InsBasic.vale_heap ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32
-> Prims.logical | [] | Vale.AES.X64.AESopt2.scratch_b_blocks | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
rev_bytes: Prims.bool ->
rev_blocks: Prims.bool ->
scratch_in_b: Vale.X64.Memory.buffer128 ->
scratch_len: Prims.int ->
count: Prims.int ->
heap_s: Vale.X64.InsBasic.vale_heap ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32
-> Prims.logical | {
"end_col": 46,
"end_line": 63,
"start_col": 2,
"start_line": 60
} |
|
Prims.Tot | val va_wp_ReduceLast
(last_adds: bool)
(h_LE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_wp_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl
va_s0))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in let (n:Prims.nat) =
FStar.Seq.Base.length #quad32 data in let xi = va_if last_adds (fun _ ->
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (fun _ -> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (()))) | val va_wp_ReduceLast
(last_adds: bool)
(h_LE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_ReduceLast
(last_adds: bool)
(h_LE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
(let h:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in
let prev:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev)
in
let pdata:(Prims.int -> Vale.AES.GHash.poly128) =
Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in
let n:Prims.nat = FStar.Seq.Base.length #quad32 data in
pclmulqdq_enabled /\ avx_enabled /\
va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n > 0 /\
add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1)) /\
(forall (va_x_efl: Vale.X64.Flags.t)
(va_x_xmm0: quad32)
(va_x_xmm3: quad32)
(va_x_xmm4: quad32)
(va_x_xmm5: quad32)
(va_x_xmm6: quad32)
(va_x_xmm7: quad32)
(va_x_xmm8: quad32).
let va_sM =
va_upd_xmm 8
va_x_xmm8
(va_upd_xmm 7
va_x_xmm7
(va_upd_xmm 6
va_x_xmm6
(va_upd_xmm 5
va_x_xmm5
(va_upd_xmm 4
va_x_xmm4
(va_upd_xmm 3
va_x_xmm3
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl va_s0)))))))
in
va_get_ok va_sM /\
(let h:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in
let prev:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev)
in
let pdata:(Prims.int -> Vale.AES.GHash.poly128) =
Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in
let n:Prims.nat = FStar.Seq.Base.length #quad32 data in
let xi =
va_if last_adds
(fun _ -> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(fun _ ->
add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)))
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)))
in
Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Prims.bool",
"Vale.X64.Decls.quad32",
"FStar.Seq.Base.seq",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled",
"Vale.X64.CPU_Features_s.avx_enabled",
"Prims.eq2",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_get_xmm",
"Vale.Def.Words_s.Mkfour",
"Prims.op_GreaterThan",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2_s.add",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.Math.Poly2_s.shift",
"Vale.AES.GHash.ghash_unroll_back",
"Prims.op_Subtraction",
"Prims.nat",
"FStar.Seq.Base.length",
"Prims.int",
"Vale.AES.GHash.poly128",
"Vale.AES.GHash.fun_seq_quad32_LE_poly128",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Prims.l_Forall",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Vale.Def.Types_s.quad32",
"Vale.Math.Poly2.Bits_s.to_quad32",
"Vale.AES.GHash.ghash_incremental",
"Vale.X64.Decls.va_if",
"Prims.l_not",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_flags"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data
//-- MulAdd_step
val va_code_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm -> Tot va_code
val va_codegen_success_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm ->
a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm ->
c:va_operand_xmm -> Tot va_pbool
val va_lemma_MulAdd_step : va_b0:va_code -> va_s0:va_state -> m:nat -> power_index:int ->
a0:va_operand_xmm -> a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm ->
b:va_operand_xmm -> c:va_operand_xmm -> hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly ->
prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) va_s0 /\
va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = (if (m = 1) then va_eval_xmm va_s0
a1 else va_get_xmm 4 va_s0) in (m > 0 ==> add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128
data in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = (if (m = 0) then va_eval_xmm va_sM a0 else
va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) /\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 4 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_xmm c va_sM (va_update_operand_xmm b va_sM (va_update_operand_xmm a3 va_sM
(va_update_operand_xmm a2 va_sM (va_update_operand_xmm a1 va_sM (va_update_operand_xmm a0 va_sM
va_s0)))))))))))))))
[@ va_qattr]
let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = va_if (m = 1) (fun _ ->
va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in (m > 0 ==> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1))) /\ (forall
(va_x_a0:va_value_xmm) (va_x_a1:va_value_xmm) (va_x_a2:va_value_xmm) (va_x_a3:va_value_xmm)
(va_x_b:va_value_xmm) (va_x_c:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32)
(va_x_xmm4:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_operand_xmm c va_x_c (va_upd_operand_xmm
b va_x_b (va_upd_operand_xmm a3 va_x_a3 (va_upd_operand_xmm a2 va_x_a2 (va_upd_operand_xmm a1
va_x_a1 (va_upd_operand_xmm a0 va_x_a0 va_s0))))))))))) in va_get_ok va_sM /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _
-> va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) ==> va_k va_sM (())))
val va_wpProof_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm ->
hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly -> prev:poly -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b
scratch_b h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_step m power_index a0 a1 a2 a3
b c) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags;
va_mod_xmm c; va_mod_xmm b; va_mod_xmm a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) : (va_quickCode unit
(va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) =
(va_QProc (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags; va_mod_xmm c; va_mod_xmm b; va_mod_xmm
a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) (va_wp_MulAdd_step m power_index a0 a1 a2 a3
b c hkeys_b scratch_b h prev data) (va_wpProof_MulAdd_step m power_index a0 a1 a2 a3 b c
hkeys_b scratch_b h prev data))
//--
//-- ReduceLast
val va_code_ReduceLast : last_adds:bool -> Tot va_code
val va_codegen_success_ReduceLast : last_adds:bool -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> last_adds:bool -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast last_adds) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi = (if last_adds then
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) else add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_xmm 8 va_sM
(va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM
(va_update_xmm 3 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) | false | true | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_ReduceLast
(last_adds: bool)
(h_LE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.X64.AESopt2.va_wp_ReduceLast | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
last_adds: Prims.bool ->
h_LE: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | {
"end_col": 64,
"end_line": 268,
"start_col": 2,
"start_line": 243
} |
Prims.Tot | val va_quick_MulAdd_step
(m: nat)
(power_index: int)
(a0 a1 a2 a3 b c: va_operand_xmm)
(hkeys_b scratch_b: buffer128)
(h prev: poly)
(data: (seq quad32))
: (va_quickCode unit (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_quick_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) : (va_quickCode unit
(va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) =
(va_QProc (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags; va_mod_xmm c; va_mod_xmm b; va_mod_xmm
a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) (va_wp_MulAdd_step m power_index a0 a1 a2 a3
b c hkeys_b scratch_b h prev data) (va_wpProof_MulAdd_step m power_index a0 a1 a2 a3 b c
hkeys_b scratch_b h prev data)) | val va_quick_MulAdd_step
(m: nat)
(power_index: int)
(a0 a1 a2 a3 b c: va_operand_xmm)
(hkeys_b scratch_b: buffer128)
(h prev: poly)
(data: (seq quad32))
: (va_quickCode unit (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c))
let va_quick_MulAdd_step
(m: nat)
(power_index: int)
(a0 a1 a2 a3 b c: va_operand_xmm)
(hkeys_b scratch_b: buffer128)
(h prev: poly)
(data: (seq quad32))
: (va_quickCode unit (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) = | false | null | false | (va_QProc (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)
([
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags;
va_mod_xmm c; va_mod_xmm b; va_mod_xmm a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0
])
(va_wp_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b scratch_b h prev data)
(va_wpProof_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b scratch_b h prev data)) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Prims.nat",
"Prims.int",
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.Memory.buffer128",
"Vale.Math.Poly2_s.poly",
"FStar.Seq.Base.seq",
"Vale.X64.Decls.quad32",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.AESopt2.va_code_MulAdd_step",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_mod_xmm",
"Prims.Nil",
"Vale.AES.X64.AESopt2.va_wp_MulAdd_step",
"Vale.AES.X64.AESopt2.va_wpProof_MulAdd_step",
"Vale.X64.QuickCode.va_quickCode"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data
//-- MulAdd_step
val va_code_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm -> Tot va_code
val va_codegen_success_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm ->
a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm ->
c:va_operand_xmm -> Tot va_pbool
val va_lemma_MulAdd_step : va_b0:va_code -> va_s0:va_state -> m:nat -> power_index:int ->
a0:va_operand_xmm -> a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm ->
b:va_operand_xmm -> c:va_operand_xmm -> hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly ->
prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) va_s0 /\
va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = (if (m = 1) then va_eval_xmm va_s0
a1 else va_get_xmm 4 va_s0) in (m > 0 ==> add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128
data in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = (if (m = 0) then va_eval_xmm va_sM a0 else
va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) /\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 4 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_xmm c va_sM (va_update_operand_xmm b va_sM (va_update_operand_xmm a3 va_sM
(va_update_operand_xmm a2 va_sM (va_update_operand_xmm a1 va_sM (va_update_operand_xmm a0 va_sM
va_s0)))))))))))))))
[@ va_qattr]
let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = va_if (m = 1) (fun _ ->
va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in (m > 0 ==> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1))) /\ (forall
(va_x_a0:va_value_xmm) (va_x_a1:va_value_xmm) (va_x_a2:va_value_xmm) (va_x_a3:va_value_xmm)
(va_x_b:va_value_xmm) (va_x_c:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32)
(va_x_xmm4:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_operand_xmm c va_x_c (va_upd_operand_xmm
b va_x_b (va_upd_operand_xmm a3 va_x_a3 (va_upd_operand_xmm a2 va_x_a2 (va_upd_operand_xmm a1
va_x_a1 (va_upd_operand_xmm a0 va_x_a0 va_s0))))))))))) in va_get_ok va_sM /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _
-> va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) ==> va_k va_sM (())))
val va_wpProof_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm ->
hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly -> prev:poly -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b
scratch_b h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_step m power_index a0 a1 a2 a3
b c) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags;
va_mod_xmm c; va_mod_xmm b; va_mod_xmm a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) : (va_quickCode unit | false | false | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_MulAdd_step
(m: nat)
(power_index: int)
(a0 a1 a2 a3 b c: va_operand_xmm)
(hkeys_b scratch_b: buffer128)
(h prev: poly)
(data: (seq quad32))
: (va_quickCode unit (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) | [] | Vale.AES.X64.AESopt2.va_quick_MulAdd_step | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
m: Prims.nat ->
power_index: Prims.int ->
a0: Vale.X64.Decls.va_operand_xmm ->
a1: Vale.X64.Decls.va_operand_xmm ->
a2: Vale.X64.Decls.va_operand_xmm ->
a3: Vale.X64.Decls.va_operand_xmm ->
b: Vale.X64.Decls.va_operand_xmm ->
c: Vale.X64.Decls.va_operand_xmm ->
hkeys_b: Vale.X64.Memory.buffer128 ->
scratch_b: Vale.X64.Memory.buffer128 ->
h: Vale.Math.Poly2_s.poly ->
prev: Vale.Math.Poly2_s.poly ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Prims.unit
(Vale.AES.X64.AESopt2.va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) | {
"end_col": 35,
"end_line": 203,
"start_col": 2,
"start_line": 199
} |
Prims.Tot | val va_quick_ReduceLast (last_adds: bool) (h_LE y_prev: quad32) (data: (seq quad32))
: (va_quickCode unit (va_code_ReduceLast last_adds)) | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_quick_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast last_adds)) =
(va_QProc (va_code_ReduceLast last_adds) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0; va_Mod_flags]) (va_wp_ReduceLast last_adds h_LE
y_prev data) (va_wpProof_ReduceLast last_adds h_LE y_prev data)) | val va_quick_ReduceLast (last_adds: bool) (h_LE y_prev: quad32) (data: (seq quad32))
: (va_quickCode unit (va_code_ReduceLast last_adds))
let va_quick_ReduceLast (last_adds: bool) (h_LE y_prev: quad32) (data: (seq quad32))
: (va_quickCode unit (va_code_ReduceLast last_adds)) = | false | null | false | (va_QProc (va_code_ReduceLast last_adds)
([
va_Mod_xmm 8;
va_Mod_xmm 7;
va_Mod_xmm 6;
va_Mod_xmm 5;
va_Mod_xmm 4;
va_Mod_xmm 3;
va_Mod_xmm 0;
va_Mod_flags
])
(va_wp_ReduceLast last_adds h_LE y_prev data)
(va_wpProof_ReduceLast last_adds h_LE y_prev data)) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Prims.bool",
"Vale.X64.Decls.quad32",
"FStar.Seq.Base.seq",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.AESopt2.va_code_ReduceLast",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_flags",
"Prims.Nil",
"Vale.AES.X64.AESopt2.va_wp_ReduceLast",
"Vale.AES.X64.AESopt2.va_wpProof_ReduceLast",
"Vale.X64.QuickCode.va_quickCode"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data
//-- MulAdd_step
val va_code_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm -> Tot va_code
val va_codegen_success_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm ->
a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm ->
c:va_operand_xmm -> Tot va_pbool
val va_lemma_MulAdd_step : va_b0:va_code -> va_s0:va_state -> m:nat -> power_index:int ->
a0:va_operand_xmm -> a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm ->
b:va_operand_xmm -> c:va_operand_xmm -> hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly ->
prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) va_s0 /\
va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = (if (m = 1) then va_eval_xmm va_s0
a1 else va_get_xmm 4 va_s0) in (m > 0 ==> add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128
data in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = (if (m = 0) then va_eval_xmm va_sM a0 else
va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) /\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 4 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_xmm c va_sM (va_update_operand_xmm b va_sM (va_update_operand_xmm a3 va_sM
(va_update_operand_xmm a2 va_sM (va_update_operand_xmm a1 va_sM (va_update_operand_xmm a0 va_sM
va_s0)))))))))))))))
[@ va_qattr]
let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = va_if (m = 1) (fun _ ->
va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in (m > 0 ==> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1))) /\ (forall
(va_x_a0:va_value_xmm) (va_x_a1:va_value_xmm) (va_x_a2:va_value_xmm) (va_x_a3:va_value_xmm)
(va_x_b:va_value_xmm) (va_x_c:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32)
(va_x_xmm4:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_operand_xmm c va_x_c (va_upd_operand_xmm
b va_x_b (va_upd_operand_xmm a3 va_x_a3 (va_upd_operand_xmm a2 va_x_a2 (va_upd_operand_xmm a1
va_x_a1 (va_upd_operand_xmm a0 va_x_a0 va_s0))))))))))) in va_get_ok va_sM /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _
-> va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) ==> va_k va_sM (())))
val va_wpProof_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm ->
hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly -> prev:poly -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b
scratch_b h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_step m power_index a0 a1 a2 a3
b c) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags;
va_mod_xmm c; va_mod_xmm b; va_mod_xmm a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) : (va_quickCode unit
(va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) =
(va_QProc (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags; va_mod_xmm c; va_mod_xmm b; va_mod_xmm
a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) (va_wp_MulAdd_step m power_index a0 a1 a2 a3
b c hkeys_b scratch_b h prev data) (va_wpProof_MulAdd_step m power_index a0 a1 a2 a3 b c
hkeys_b scratch_b h prev data))
//--
//-- ReduceLast
val va_code_ReduceLast : last_adds:bool -> Tot va_code
val va_codegen_success_ReduceLast : last_adds:bool -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> last_adds:bool -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast last_adds) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi = (if last_adds then
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) else add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_xmm 8 va_sM
(va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM
(va_update_xmm 3 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl
va_s0))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in let (n:Prims.nat) =
FStar.Seq.Base.length #quad32 data in let xi = va_if last_adds (fun _ ->
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (fun _ -> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : last_adds:bool -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ReduceLast last_adds h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast last_adds) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0;
va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) : | false | false | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_ReduceLast (last_adds: bool) (h_LE y_prev: quad32) (data: (seq quad32))
: (va_quickCode unit (va_code_ReduceLast last_adds)) | [] | Vale.AES.X64.AESopt2.va_quick_ReduceLast | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
last_adds: Prims.bool ->
h_LE: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.AESopt2.va_code_ReduceLast last_adds) | {
"end_col": 68,
"end_line": 282,
"start_col": 2,
"start_line": 280
} |
Prims.Tot | val va_wp_MulAdd_step
(m: nat)
(power_index: int)
(a0 a1 a2 a3 b c: va_operand_xmm)
(hkeys_b scratch_b: buffer128)
(h prev: poly)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = va_if (m = 1) (fun _ ->
va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in (m > 0 ==> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1))) /\ (forall
(va_x_a0:va_value_xmm) (va_x_a1:va_value_xmm) (va_x_a2:va_value_xmm) (va_x_a3:va_value_xmm)
(va_x_b:va_value_xmm) (va_x_c:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32)
(va_x_xmm4:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_operand_xmm c va_x_c (va_upd_operand_xmm
b va_x_b (va_upd_operand_xmm a3 va_x_a3 (va_upd_operand_xmm a2 va_x_a2 (va_upd_operand_xmm a1
va_x_a1 (va_upd_operand_xmm a0 va_x_a0 va_s0))))))))))) in va_get_ok va_sM /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _
-> va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) ==> va_k va_sM (()))) | val va_wp_MulAdd_step
(m: nat)
(power_index: int)
(a0 a1 a2 a3 b c: va_operand_xmm)
(hkeys_b scratch_b: buffer128)
(h prev: poly)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_MulAdd_step
(m: nat)
(power_index: int)
(a0 a1 a2 a3 b c: va_operand_xmm)
(hkeys_b scratch_b: buffer128)
(h prev: poly)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\
va_is_dst_xmm a3 va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\
(let pdata:(Prims.int -> Vale.AES.GHash.poly128) =
Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in
pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\
FStar.Seq.Base.length #quad32 data >= 6 /\
(m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\
(m == 1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\
(m == 2 ==> a0 == 1 /\ a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\
(m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5 /\ a3 == 1 /\ b == 0 /\ c == 1) /\
(m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b == 0 /\ c == 2) /\
(m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rR9 va_s0 - 32)
hkeys_b
8
(va_get_mem_layout va_s0)
Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 3 va_s0)
(va_get_reg64 rRbp va_s0)
scratch_b
8
(va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\
(let z0 = va_if (m = 1) (fun _ -> va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in
(m > 0 ==>
add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\
(m < 5 ==>
va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\
(m == 5 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) ==
add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq
data
(5 - m))))) /\
(m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) ==
Vale.AES.GHash.gf128_power h (m + 1)) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b
power_index
(va_get_mem_heaplet 0 va_s0)) ==
Vale.AES.GHash.gf128_power h (m + 1))) /\
(forall (va_x_a0: va_value_xmm) (va_x_a1: va_value_xmm) (va_x_a2: va_value_xmm)
(va_x_a3: va_value_xmm) (va_x_b: va_value_xmm) (va_x_c: va_value_xmm)
(va_x_efl: Vale.X64.Flags.t) (va_x_xmm0: quad32) (va_x_xmm4: quad32) (va_x_xmm6: quad32)
(va_x_xmm7: quad32) (va_x_xmm8: quad32).
let va_sM =
va_upd_xmm 8
va_x_xmm8
(va_upd_xmm 7
va_x_xmm7
(va_upd_xmm 6
va_x_xmm6
(va_upd_xmm 4
va_x_xmm4
(va_upd_xmm 0
va_x_xmm0
(va_upd_flags va_x_efl
(va_upd_operand_xmm c
va_x_c
(va_upd_operand_xmm b
va_x_b
(va_upd_operand_xmm a3
va_x_a3
(va_upd_operand_xmm a2
va_x_a2
(va_upd_operand_xmm a1
va_x_a1
(va_upd_operand_xmm a0 va_x_a0 va_s0)))))))))))
in
va_get_ok va_sM /\
(let pdata:(Prims.int -> Vale.AES.GHash.poly128) =
Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in
(m < 4 ==>
va_get_xmm 0 va_sM ==
Vale.X64.Decls.buffer128_read scratch_b (3 + m) (va_get_mem_heaplet 3 va_sM)) /\
(let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _ -> va_get_xmm 4 va_sM) in
add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)
)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\
(m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) ==
add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b
1
(va_get_mem_heaplet 3 va_s0)))) /\
(m == 4 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) ==
add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b
7
(va_get_mem_heaplet 3 va_s0)))) /\
(0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8 va_s0))) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Prims.nat",
"Prims.int",
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.Memory.buffer128",
"Vale.Math.Poly2_s.poly",
"FStar.Seq.Base.seq",
"Vale.X64.Decls.quad32",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Vale.X64.Decls.va_is_dst_xmm",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled",
"Vale.X64.CPU_Features_s.avx_enabled",
"Vale.X64.CPU_Features_s.sse_enabled",
"Prims.op_LessThan",
"Prims.op_GreaterThanOrEqual",
"FStar.Seq.Base.length",
"Prims.l_imp",
"Prims.eq2",
"Vale.X64.Decls.validSrcAddrs128",
"Vale.X64.Decls.va_get_mem_heaplet",
"Prims.op_Subtraction",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Machine_s.rRbp",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThan",
"Vale.Math.Poly2_s.add",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.Math.Poly2_s.shift",
"Vale.X64.Decls.va_get_xmm",
"Vale.AES.GHash.ghash_unroll_back",
"Vale.Def.Types_s.quad32",
"Vale.X64.Decls.va_eval_xmm",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.AES.X64.AESopt2.va_subscript_FStar__Seq__Base__seq",
"Vale.AES.GHash.gf128_power",
"Prims.op_Addition",
"Vale.X64.Decls.buffer128_read",
"Vale.X64.Decls.va_if",
"Prims.op_Equality",
"Prims.l_not",
"Vale.AES.GHash.poly128",
"Vale.AES.GHash.fun_seq_quad32_LE_poly128",
"Prims.l_Forall",
"Vale.X64.Decls.va_value_xmm",
"Vale.X64.Flags.t",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_operand_xmm"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data
//-- MulAdd_step
val va_code_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm -> Tot va_code
val va_codegen_success_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm ->
a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm ->
c:va_operand_xmm -> Tot va_pbool
val va_lemma_MulAdd_step : va_b0:va_code -> va_s0:va_state -> m:nat -> power_index:int ->
a0:va_operand_xmm -> a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm ->
b:va_operand_xmm -> c:va_operand_xmm -> hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly ->
prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) va_s0 /\
va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = (if (m = 1) then va_eval_xmm va_s0
a1 else va_get_xmm 4 va_s0) in (m > 0 ==> add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128
data in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = (if (m = 0) then va_eval_xmm va_sM a0 else
va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) /\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 4 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_xmm c va_sM (va_update_operand_xmm b va_sM (va_update_operand_xmm a3 va_sM
(va_update_operand_xmm a2 va_sM (va_update_operand_xmm a1 va_sM (va_update_operand_xmm a0 va_sM
va_s0)))))))))))))))
[@ va_qattr]
let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state | false | true | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_MulAdd_step
(m: nat)
(power_index: int)
(a0 a1 a2 a3 b c: va_operand_xmm)
(hkeys_b scratch_b: buffer128)
(h prev: poly)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.X64.AESopt2.va_wp_MulAdd_step | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
m: Prims.nat ->
power_index: Prims.int ->
a0: Vale.X64.Decls.va_operand_xmm ->
a1: Vale.X64.Decls.va_operand_xmm ->
a2: Vale.X64.Decls.va_operand_xmm ->
a3: Vale.X64.Decls.va_operand_xmm ->
b: Vale.X64.Decls.va_operand_xmm ->
c: Vale.X64.Decls.va_operand_xmm ->
hkeys_b: Vale.X64.Memory.buffer128 ->
scratch_b: Vale.X64.Memory.buffer128 ->
h: Vale.Math.Poly2_s.poly ->
prev: Vale.Math.Poly2_s.poly ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | {
"end_col": 34,
"end_line": 181,
"start_col": 2,
"start_line": 135
} |
Prims.Tot | val va_quick_Ghash_register (hkeys_b: buffer128) (h_LE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_register ())) | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_quick_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) : (va_quickCode unit
(va_code_Ghash_register ())) =
(va_QProc (va_code_Ghash_register ()) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_flags]) (va_wp_Ghash_register hkeys_b h_LE y_prev) (va_wpProof_Ghash_register hkeys_b
h_LE y_prev)) | val va_quick_Ghash_register (hkeys_b: buffer128) (h_LE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_register ()))
let va_quick_Ghash_register (hkeys_b: buffer128) (h_LE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_register ())) = | false | null | false | (va_QProc (va_code_Ghash_register ())
([
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_flags
])
(va_wp_Ghash_register hkeys_b h_LE y_prev)
(va_wpProof_Ghash_register hkeys_b h_LE y_prev)) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.quad32",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.AESopt2.va_code_Ghash_register",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.QuickCode.va_Mod_flags",
"Prims.Nil",
"Vale.AES.X64.AESopt2.va_wp_Ghash_register",
"Vale.AES.X64.AESopt2.va_wpProof_Ghash_register",
"Vale.X64.QuickCode.va_quickCode"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data
//-- MulAdd_step
val va_code_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm -> Tot va_code
val va_codegen_success_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm ->
a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm ->
c:va_operand_xmm -> Tot va_pbool
val va_lemma_MulAdd_step : va_b0:va_code -> va_s0:va_state -> m:nat -> power_index:int ->
a0:va_operand_xmm -> a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm ->
b:va_operand_xmm -> c:va_operand_xmm -> hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly ->
prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) va_s0 /\
va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = (if (m = 1) then va_eval_xmm va_s0
a1 else va_get_xmm 4 va_s0) in (m > 0 ==> add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128
data in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = (if (m = 0) then va_eval_xmm va_sM a0 else
va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) /\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 4 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_xmm c va_sM (va_update_operand_xmm b va_sM (va_update_operand_xmm a3 va_sM
(va_update_operand_xmm a2 va_sM (va_update_operand_xmm a1 va_sM (va_update_operand_xmm a0 va_sM
va_s0)))))))))))))))
[@ va_qattr]
let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = va_if (m = 1) (fun _ ->
va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in (m > 0 ==> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1))) /\ (forall
(va_x_a0:va_value_xmm) (va_x_a1:va_value_xmm) (va_x_a2:va_value_xmm) (va_x_a3:va_value_xmm)
(va_x_b:va_value_xmm) (va_x_c:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32)
(va_x_xmm4:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_operand_xmm c va_x_c (va_upd_operand_xmm
b va_x_b (va_upd_operand_xmm a3 va_x_a3 (va_upd_operand_xmm a2 va_x_a2 (va_upd_operand_xmm a1
va_x_a1 (va_upd_operand_xmm a0 va_x_a0 va_s0))))))))))) in va_get_ok va_sM /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _
-> va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) ==> va_k va_sM (())))
val va_wpProof_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm ->
hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly -> prev:poly -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b
scratch_b h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_step m power_index a0 a1 a2 a3
b c) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags;
va_mod_xmm c; va_mod_xmm b; va_mod_xmm a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) : (va_quickCode unit
(va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) =
(va_QProc (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags; va_mod_xmm c; va_mod_xmm b; va_mod_xmm
a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) (va_wp_MulAdd_step m power_index a0 a1 a2 a3
b c hkeys_b scratch_b h prev data) (va_wpProof_MulAdd_step m power_index a0 a1 a2 a3 b c
hkeys_b scratch_b h prev data))
//--
//-- ReduceLast
val va_code_ReduceLast : last_adds:bool -> Tot va_code
val va_codegen_success_ReduceLast : last_adds:bool -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> last_adds:bool -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast last_adds) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi = (if last_adds then
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) else add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_xmm 8 va_sM
(va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM
(va_update_xmm 3 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl
va_s0))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in let (n:Prims.nat) =
FStar.Seq.Base.length #quad32 data in let xi = va_if last_adds (fun _ ->
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (fun _ -> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : last_adds:bool -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ReduceLast last_adds h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast last_adds) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0;
va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast last_adds)) =
(va_QProc (va_code_ReduceLast last_adds) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0; va_Mod_flags]) (va_wp_ReduceLast last_adds h_LE
y_prev data) (va_wpProof_ReduceLast last_adds h_LE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot
va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> rev_bytes:bool -> rev_blocks:bool
-> exactly6:bool -> scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 ->
h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) /\
va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10
va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32)
(va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM = va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_flags va_x_efl va_s0)))))))))))
in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) ==>
va_k va_sM (())))
val va_wpProof_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool ->
scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 -> h_LE:quad32 -> y_prev:quad32
-> data:(seq quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len
hkeys_b scratch_in_b h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll_n rev_bytes rev_blocks
exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6)) =
(va_QProc (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags]) (va_wp_GhashUnroll_n rev_bytes
rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE y_prev data)
(va_wpProof_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE
y_prev data))
//--
//-- Ghash_register
val va_code_Ghash_register : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_register : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_register : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> h_LE:quad32
-> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_register ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in pclmulqdq_enabled
/\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0) == prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
/\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))))))
[@ va_qattr]
let va_wp_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in pclmulqdq_enabled
/\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0) == prev) /\ (forall (va_x_efl:Vale.X64.Flags.t) (va_x_r11:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11 va_x_r11 (va_upd_flags va_x_efl va_s0)))))))))) in
va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
==> va_k va_sM (())))
val va_wpProof_Ghash_register : hkeys_b:buffer128 -> h_LE:quad32 -> y_prev:quad32 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Ghash_register hkeys_b h_LE y_prev va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_register ()) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) : (va_quickCode unit | false | false | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_Ghash_register (hkeys_b: buffer128) (h_LE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_register ())) | [] | Vale.AES.X64.AESopt2.va_quick_Ghash_register | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | hkeys_b: Vale.X64.Memory.buffer128 -> h_LE: Vale.X64.Decls.quad32 -> y_prev: Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.AESopt2.va_code_Ghash_register ()) | {
"end_col": 17,
"end_line": 454,
"start_col": 2,
"start_line": 451
} |
Prims.Tot | val va_quick_GhashUnroll_n
(rev_bytes rev_blocks exactly6: bool)
(scratch_len: nat64)
(hkeys_b scratch_in_b: buffer128)
(h_LE y_prev: quad32)
(data: (seq quad32))
: (va_quickCode unit (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6)) | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_quick_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6)) =
(va_QProc (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags]) (va_wp_GhashUnroll_n rev_bytes
rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE y_prev data)
(va_wpProof_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE
y_prev data)) | val va_quick_GhashUnroll_n
(rev_bytes rev_blocks exactly6: bool)
(scratch_len: nat64)
(hkeys_b scratch_in_b: buffer128)
(h_LE y_prev: quad32)
(data: (seq quad32))
: (va_quickCode unit (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6))
let va_quick_GhashUnroll_n
(rev_bytes rev_blocks exactly6: bool)
(scratch_len: nat64)
(hkeys_b scratch_in_b: buffer128)
(h_LE y_prev: quad32)
(data: (seq quad32))
: (va_quickCode unit (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6)) = | false | null | false | (va_QProc (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6)
([
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags
])
(va_wp_GhashUnroll_n rev_bytes
rev_blocks
exactly6
scratch_len
hkeys_b
scratch_in_b
h_LE
y_prev
data)
(va_wpProof_GhashUnroll_n rev_bytes
rev_blocks
exactly6
scratch_len
hkeys_b
scratch_in_b
h_LE
y_prev
data)) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Prims.bool",
"Vale.X64.Memory.nat64",
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.quad32",
"FStar.Seq.Base.seq",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.AESopt2.va_code_GhashUnroll_n",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rR10",
"Vale.X64.QuickCode.va_Mod_flags",
"Prims.Nil",
"Vale.AES.X64.AESopt2.va_wp_GhashUnroll_n",
"Vale.AES.X64.AESopt2.va_wpProof_GhashUnroll_n",
"Vale.X64.QuickCode.va_quickCode"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data
//-- MulAdd_step
val va_code_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm -> Tot va_code
val va_codegen_success_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm ->
a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm ->
c:va_operand_xmm -> Tot va_pbool
val va_lemma_MulAdd_step : va_b0:va_code -> va_s0:va_state -> m:nat -> power_index:int ->
a0:va_operand_xmm -> a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm ->
b:va_operand_xmm -> c:va_operand_xmm -> hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly ->
prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) va_s0 /\
va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = (if (m = 1) then va_eval_xmm va_s0
a1 else va_get_xmm 4 va_s0) in (m > 0 ==> add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128
data in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = (if (m = 0) then va_eval_xmm va_sM a0 else
va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) /\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 4 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_xmm c va_sM (va_update_operand_xmm b va_sM (va_update_operand_xmm a3 va_sM
(va_update_operand_xmm a2 va_sM (va_update_operand_xmm a1 va_sM (va_update_operand_xmm a0 va_sM
va_s0)))))))))))))))
[@ va_qattr]
let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = va_if (m = 1) (fun _ ->
va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in (m > 0 ==> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1))) /\ (forall
(va_x_a0:va_value_xmm) (va_x_a1:va_value_xmm) (va_x_a2:va_value_xmm) (va_x_a3:va_value_xmm)
(va_x_b:va_value_xmm) (va_x_c:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32)
(va_x_xmm4:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_operand_xmm c va_x_c (va_upd_operand_xmm
b va_x_b (va_upd_operand_xmm a3 va_x_a3 (va_upd_operand_xmm a2 va_x_a2 (va_upd_operand_xmm a1
va_x_a1 (va_upd_operand_xmm a0 va_x_a0 va_s0))))))))))) in va_get_ok va_sM /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _
-> va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) ==> va_k va_sM (())))
val va_wpProof_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm ->
hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly -> prev:poly -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b
scratch_b h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_step m power_index a0 a1 a2 a3
b c) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags;
va_mod_xmm c; va_mod_xmm b; va_mod_xmm a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) : (va_quickCode unit
(va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) =
(va_QProc (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags; va_mod_xmm c; va_mod_xmm b; va_mod_xmm
a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) (va_wp_MulAdd_step m power_index a0 a1 a2 a3
b c hkeys_b scratch_b h prev data) (va_wpProof_MulAdd_step m power_index a0 a1 a2 a3 b c
hkeys_b scratch_b h prev data))
//--
//-- ReduceLast
val va_code_ReduceLast : last_adds:bool -> Tot va_code
val va_codegen_success_ReduceLast : last_adds:bool -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> last_adds:bool -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast last_adds) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi = (if last_adds then
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) else add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_xmm 8 va_sM
(va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM
(va_update_xmm 3 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl
va_s0))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in let (n:Prims.nat) =
FStar.Seq.Base.length #quad32 data in let xi = va_if last_adds (fun _ ->
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (fun _ -> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : last_adds:bool -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ReduceLast last_adds h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast last_adds) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0;
va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast last_adds)) =
(va_QProc (va_code_ReduceLast last_adds) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0; va_Mod_flags]) (va_wp_ReduceLast last_adds h_LE
y_prev data) (va_wpProof_ReduceLast last_adds h_LE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot
va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> rev_bytes:bool -> rev_blocks:bool
-> exactly6:bool -> scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 ->
h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) /\
va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10
va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32)
(va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM = va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_flags va_x_efl va_s0)))))))))))
in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) ==>
va_k va_sM (())))
val va_wpProof_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool ->
scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 -> h_LE:quad32 -> y_prev:quad32
-> data:(seq quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len
hkeys_b scratch_in_b h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll_n rev_bytes rev_blocks
exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) : | false | false | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_GhashUnroll_n
(rev_bytes rev_blocks exactly6: bool)
(scratch_len: nat64)
(hkeys_b scratch_in_b: buffer128)
(h_LE y_prev: quad32)
(data: (seq quad32))
: (va_quickCode unit (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6)) | [] | Vale.AES.X64.AESopt2.va_quick_GhashUnroll_n | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
rev_bytes: Prims.bool ->
rev_blocks: Prims.bool ->
exactly6: Prims.bool ->
scratch_len: Vale.X64.Memory.nat64 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
scratch_in_b: Vale.X64.Memory.buffer128 ->
h_LE: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Prims.unit
(Vale.AES.X64.AESopt2.va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) | {
"end_col": 17,
"end_line": 378,
"start_col": 2,
"start_line": 373
} |
Prims.Tot | val va_quick_Ghash_buffer (hkeys_b in_b: buffer128) (h_LE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_buffer ())) | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_quick_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_LE:quad32) (y_prev:quad32) :
(va_quickCode unit (va_code_Ghash_buffer ())) =
(va_QProc (va_code_Ghash_buffer ()) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_flags;
va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdx]) (va_wp_Ghash_buffer hkeys_b in_b h_LE
y_prev) (va_wpProof_Ghash_buffer hkeys_b in_b h_LE y_prev)) | val va_quick_Ghash_buffer (hkeys_b in_b: buffer128) (h_LE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_buffer ()))
let va_quick_Ghash_buffer (hkeys_b in_b: buffer128) (h_LE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_buffer ())) = | false | null | false | (va_QProc (va_code_Ghash_buffer ())
([
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_flags; va_Mod_reg64 rR10; va_Mod_reg64 rR11;
va_Mod_reg64 rRdx
])
(va_wp_Ghash_buffer hkeys_b in_b h_LE y_prev)
(va_wpProof_Ghash_buffer hkeys_b in_b h_LE y_prev)) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.quad32",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.AESopt2.va_code_Ghash_buffer",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR10",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rRdx",
"Prims.Nil",
"Vale.AES.X64.AESopt2.va_wp_Ghash_buffer",
"Vale.AES.X64.AESopt2.va_wpProof_Ghash_buffer",
"Vale.X64.QuickCode.va_quickCode"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data
//-- MulAdd_step
val va_code_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm -> Tot va_code
val va_codegen_success_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm ->
a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm ->
c:va_operand_xmm -> Tot va_pbool
val va_lemma_MulAdd_step : va_b0:va_code -> va_s0:va_state -> m:nat -> power_index:int ->
a0:va_operand_xmm -> a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm ->
b:va_operand_xmm -> c:va_operand_xmm -> hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly ->
prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) va_s0 /\
va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = (if (m = 1) then va_eval_xmm va_s0
a1 else va_get_xmm 4 va_s0) in (m > 0 ==> add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128
data in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = (if (m = 0) then va_eval_xmm va_sM a0 else
va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) /\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 4 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_xmm c va_sM (va_update_operand_xmm b va_sM (va_update_operand_xmm a3 va_sM
(va_update_operand_xmm a2 va_sM (va_update_operand_xmm a1 va_sM (va_update_operand_xmm a0 va_sM
va_s0)))))))))))))))
[@ va_qattr]
let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = va_if (m = 1) (fun _ ->
va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in (m > 0 ==> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1))) /\ (forall
(va_x_a0:va_value_xmm) (va_x_a1:va_value_xmm) (va_x_a2:va_value_xmm) (va_x_a3:va_value_xmm)
(va_x_b:va_value_xmm) (va_x_c:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32)
(va_x_xmm4:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_operand_xmm c va_x_c (va_upd_operand_xmm
b va_x_b (va_upd_operand_xmm a3 va_x_a3 (va_upd_operand_xmm a2 va_x_a2 (va_upd_operand_xmm a1
va_x_a1 (va_upd_operand_xmm a0 va_x_a0 va_s0))))))))))) in va_get_ok va_sM /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _
-> va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) ==> va_k va_sM (())))
val va_wpProof_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm ->
hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly -> prev:poly -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b
scratch_b h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_step m power_index a0 a1 a2 a3
b c) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags;
va_mod_xmm c; va_mod_xmm b; va_mod_xmm a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) : (va_quickCode unit
(va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) =
(va_QProc (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags; va_mod_xmm c; va_mod_xmm b; va_mod_xmm
a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) (va_wp_MulAdd_step m power_index a0 a1 a2 a3
b c hkeys_b scratch_b h prev data) (va_wpProof_MulAdd_step m power_index a0 a1 a2 a3 b c
hkeys_b scratch_b h prev data))
//--
//-- ReduceLast
val va_code_ReduceLast : last_adds:bool -> Tot va_code
val va_codegen_success_ReduceLast : last_adds:bool -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> last_adds:bool -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast last_adds) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi = (if last_adds then
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) else add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_xmm 8 va_sM
(va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM
(va_update_xmm 3 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl
va_s0))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in let (n:Prims.nat) =
FStar.Seq.Base.length #quad32 data in let xi = va_if last_adds (fun _ ->
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (fun _ -> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : last_adds:bool -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ReduceLast last_adds h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast last_adds) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0;
va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast last_adds)) =
(va_QProc (va_code_ReduceLast last_adds) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0; va_Mod_flags]) (va_wp_ReduceLast last_adds h_LE
y_prev data) (va_wpProof_ReduceLast last_adds h_LE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot
va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> rev_bytes:bool -> rev_blocks:bool
-> exactly6:bool -> scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 ->
h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) /\
va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10
va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32)
(va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM = va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_flags va_x_efl va_s0)))))))))))
in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) ==>
va_k va_sM (())))
val va_wpProof_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool ->
scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 -> h_LE:quad32 -> y_prev:quad32
-> data:(seq quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len
hkeys_b scratch_in_b h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll_n rev_bytes rev_blocks
exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6)) =
(va_QProc (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags]) (va_wp_GhashUnroll_n rev_bytes
rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE y_prev data)
(va_wpProof_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE
y_prev data))
//--
//-- Ghash_register
val va_code_Ghash_register : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_register : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_register : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> h_LE:quad32
-> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_register ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in pclmulqdq_enabled
/\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0) == prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
/\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))))))
[@ va_qattr]
let va_wp_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in pclmulqdq_enabled
/\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0) == prev) /\ (forall (va_x_efl:Vale.X64.Flags.t) (va_x_r11:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11 va_x_r11 (va_upd_flags va_x_efl va_s0)))))))))) in
va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
==> va_k va_sM (())))
val va_wpProof_Ghash_register : hkeys_b:buffer128 -> h_LE:quad32 -> y_prev:quad32 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Ghash_register hkeys_b h_LE y_prev va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_register ()) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) : (va_quickCode unit
(va_code_Ghash_register ())) =
(va_QProc (va_code_Ghash_register ()) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_flags]) (va_wp_Ghash_register hkeys_b h_LE y_prev) (va_wpProof_Ghash_register hkeys_b
h_LE y_prev))
//--
//-- Ghash_buffer
val va_code_Ghash_buffer : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_buffer : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_buffer : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> in_b:buffer128
-> h_LE:quad32 -> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in
pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) in_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == va_get_reg64 rRdx va_s0 /\ va_get_reg64 rRdi va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_xmm 8 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 y_prev /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in va_get_xmm 8 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE y_prev (Vale.X64.Decls.s128 (va_get_mem_heaplet 1
va_sM) in_b)) /\ (va_get_reg64 rRdx va_s0 == 0 ==> va_get_xmm 8 va_sM == va_get_xmm 8 va_s0))
/\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_reg64 rR10
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRdx va_sM (va_update_ok va_sM
va_s0))))))))))))))))
[@ va_qattr]
let va_wp_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_LE:quad32) (y_prev:quad32)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled
/\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64
rR9 va_s0 - 32) h /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64
rRdi va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == va_get_reg64 rRdx va_s0 /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_xmm 8
va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 y_prev /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051) /\ (forall
(va_x_rdx:nat64) (va_x_r11:nat64) (va_x_r10:nat64) (va_x_efl:Vale.X64.Flags.t)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRdx va_x_rdx va_s0)))))))))))) in va_get_ok va_sM /\ (let (h:poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_get_xmm 8
va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental0 h_LE y_prev
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) /\ (va_get_reg64 rRdx va_s0 == 0 ==>
va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)) ==> va_k va_sM (())))
val va_wpProof_Ghash_buffer : hkeys_b:buffer128 -> in_b:buffer128 -> h_LE:quad32 -> y_prev:quad32
-> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer hkeys_b in_b h_LE y_prev va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer ()) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_flags; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdx]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_LE:quad32) (y_prev:quad32) : | false | false | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_Ghash_buffer (hkeys_b in_b: buffer128) (h_LE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_buffer ())) | [] | Vale.AES.X64.AESopt2.va_quick_Ghash_buffer | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
hkeys_b: Vale.X64.Memory.buffer128 ->
in_b: Vale.X64.Memory.buffer128 ->
h_LE: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.AESopt2.va_code_Ghash_buffer ()) | {
"end_col": 63,
"end_line": 523,
"start_col": 2,
"start_line": 520
} |
Prims.Tot | val va_wp_GhashUnroll6x
(hkeys_b scratch_b: buffer128)
(h_LE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_wp_GhashUnroll6x (hkeys_b:buffer128) (scratch_b:buffer128) (h_LE:quad32) (y_prev:quad32)
(data:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ FStar.Seq.Base.length #quad32 data == 6
/\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64
rR9 va_s0 - 32) h /\ scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data 5) /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0))) == prev) /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32)
(va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32)
. let va_sM = va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6
(va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2
(va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rRax va_x_rax (va_upd_flags
va_x_efl va_s0)))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
==> va_k va_sM (()))) | val va_wp_GhashUnroll6x
(hkeys_b scratch_b: buffer128)
(h_LE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_GhashUnroll6x
(hkeys_b scratch_b: buffer128)
(h_LE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
(let h:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in
let prev:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev)
in
let pdata:(Prims.int -> Vale.AES.GHash.poly128) =
Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in
pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ FStar.Seq.Base.length #quad32 data == 6 /\
hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0)
(va_get_reg64 rR9 va_s0 - 32)
h /\
scratch_b_data true
true
scratch_b
8
5
(va_get_mem_heaplet 3 va_s0)
(va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0)
data /\
va_get_xmm 7 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data 5) /\
add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b
1
(va_get_mem_heaplet 3 va_s0))) ==
prev) /\
(forall (va_x_efl: Vale.X64.Flags.t) (va_x_rax: nat64) (va_x_xmm0: quad32) (va_x_xmm1: quad32)
(va_x_xmm2: quad32) (va_x_xmm3: quad32) (va_x_xmm4: quad32) (va_x_xmm5: quad32)
(va_x_xmm6: quad32) (va_x_xmm7: quad32) (va_x_xmm8: quad32).
let va_sM =
va_upd_xmm 8
va_x_xmm8
(va_upd_xmm 7
va_x_xmm7
(va_upd_xmm 6
va_x_xmm6
(va_upd_xmm 5
va_x_xmm5
(va_upd_xmm 4
va_x_xmm4
(va_upd_xmm 3
va_x_xmm3
(va_upd_xmm 2
va_x_xmm2
(va_upd_xmm 1
va_x_xmm1
(va_upd_xmm 0
va_x_xmm0
(va_upd_reg64 rRax va_x_rax (va_upd_flags va_x_efl va_s0))
))))))))
in
va_get_ok va_sM /\
(let h:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in
let prev:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev)
in
let pdata:(Prims.int -> Vale.AES.GHash.poly128) =
Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in
va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data)) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.quad32",
"FStar.Seq.Base.seq",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled",
"Vale.X64.CPU_Features_s.avx_enabled",
"Vale.X64.CPU_Features_s.sse_enabled",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Vale.AES.X64.AESopt2.hkeys_b_powers",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_mem_layout",
"Prims.op_Subtraction",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.AES.X64.AESopt2.scratch_b_data",
"Vale.X64.Machine_s.rRbp",
"Vale.Def.Types_s.quad32",
"Vale.X64.Decls.va_get_xmm",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.AES.X64.AESopt2.va_subscript_FStar__Seq__Base__seq",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2_s.add",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.X64.Decls.buffer128_read",
"Vale.AES.GHash.poly128",
"Vale.AES.GHash.fun_seq_quad32_LE_poly128",
"Prims.l_Forall",
"Vale.X64.Flags.t",
"Vale.X64.Memory.nat64",
"Prims.l_imp",
"Vale.AES.GHash.ghash_incremental",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Decls.va_upd_flags"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data
//-- MulAdd_step
val va_code_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm -> Tot va_code
val va_codegen_success_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm ->
a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm ->
c:va_operand_xmm -> Tot va_pbool
val va_lemma_MulAdd_step : va_b0:va_code -> va_s0:va_state -> m:nat -> power_index:int ->
a0:va_operand_xmm -> a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm ->
b:va_operand_xmm -> c:va_operand_xmm -> hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly ->
prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) va_s0 /\
va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = (if (m = 1) then va_eval_xmm va_s0
a1 else va_get_xmm 4 va_s0) in (m > 0 ==> add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128
data in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = (if (m = 0) then va_eval_xmm va_sM a0 else
va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) /\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 4 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_xmm c va_sM (va_update_operand_xmm b va_sM (va_update_operand_xmm a3 va_sM
(va_update_operand_xmm a2 va_sM (va_update_operand_xmm a1 va_sM (va_update_operand_xmm a0 va_sM
va_s0)))))))))))))))
[@ va_qattr]
let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = va_if (m = 1) (fun _ ->
va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in (m > 0 ==> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1))) /\ (forall
(va_x_a0:va_value_xmm) (va_x_a1:va_value_xmm) (va_x_a2:va_value_xmm) (va_x_a3:va_value_xmm)
(va_x_b:va_value_xmm) (va_x_c:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32)
(va_x_xmm4:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_operand_xmm c va_x_c (va_upd_operand_xmm
b va_x_b (va_upd_operand_xmm a3 va_x_a3 (va_upd_operand_xmm a2 va_x_a2 (va_upd_operand_xmm a1
va_x_a1 (va_upd_operand_xmm a0 va_x_a0 va_s0))))))))))) in va_get_ok va_sM /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _
-> va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) ==> va_k va_sM (())))
val va_wpProof_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm ->
hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly -> prev:poly -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b
scratch_b h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_step m power_index a0 a1 a2 a3
b c) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags;
va_mod_xmm c; va_mod_xmm b; va_mod_xmm a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) : (va_quickCode unit
(va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) =
(va_QProc (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags; va_mod_xmm c; va_mod_xmm b; va_mod_xmm
a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) (va_wp_MulAdd_step m power_index a0 a1 a2 a3
b c hkeys_b scratch_b h prev data) (va_wpProof_MulAdd_step m power_index a0 a1 a2 a3 b c
hkeys_b scratch_b h prev data))
//--
//-- ReduceLast
val va_code_ReduceLast : last_adds:bool -> Tot va_code
val va_codegen_success_ReduceLast : last_adds:bool -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> last_adds:bool -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast last_adds) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi = (if last_adds then
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) else add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_xmm 8 va_sM
(va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM
(va_update_xmm 3 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl
va_s0))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in let (n:Prims.nat) =
FStar.Seq.Base.length #quad32 data in let xi = va_if last_adds (fun _ ->
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (fun _ -> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : last_adds:bool -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ReduceLast last_adds h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast last_adds) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0;
va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast last_adds)) =
(va_QProc (va_code_ReduceLast last_adds) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0; va_Mod_flags]) (va_wp_ReduceLast last_adds h_LE
y_prev data) (va_wpProof_ReduceLast last_adds h_LE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot
va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> rev_bytes:bool -> rev_blocks:bool
-> exactly6:bool -> scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 ->
h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) /\
va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10
va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32)
(va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM = va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_flags va_x_efl va_s0)))))))))))
in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) ==>
va_k va_sM (())))
val va_wpProof_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool ->
scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 -> h_LE:quad32 -> y_prev:quad32
-> data:(seq quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len
hkeys_b scratch_in_b h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll_n rev_bytes rev_blocks
exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6)) =
(va_QProc (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags]) (va_wp_GhashUnroll_n rev_bytes
rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE y_prev data)
(va_wpProof_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE
y_prev data))
//--
//-- Ghash_register
val va_code_Ghash_register : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_register : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_register : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> h_LE:quad32
-> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_register ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in pclmulqdq_enabled
/\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0) == prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
/\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))))))
[@ va_qattr]
let va_wp_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in pclmulqdq_enabled
/\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0) == prev) /\ (forall (va_x_efl:Vale.X64.Flags.t) (va_x_r11:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11 va_x_r11 (va_upd_flags va_x_efl va_s0)))))))))) in
va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
==> va_k va_sM (())))
val va_wpProof_Ghash_register : hkeys_b:buffer128 -> h_LE:quad32 -> y_prev:quad32 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Ghash_register hkeys_b h_LE y_prev va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_register ()) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) : (va_quickCode unit
(va_code_Ghash_register ())) =
(va_QProc (va_code_Ghash_register ()) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_flags]) (va_wp_Ghash_register hkeys_b h_LE y_prev) (va_wpProof_Ghash_register hkeys_b
h_LE y_prev))
//--
//-- Ghash_buffer
val va_code_Ghash_buffer : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_buffer : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_buffer : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> in_b:buffer128
-> h_LE:quad32 -> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in
pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) in_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == va_get_reg64 rRdx va_s0 /\ va_get_reg64 rRdi va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_xmm 8 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 y_prev /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in va_get_xmm 8 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE y_prev (Vale.X64.Decls.s128 (va_get_mem_heaplet 1
va_sM) in_b)) /\ (va_get_reg64 rRdx va_s0 == 0 ==> va_get_xmm 8 va_sM == va_get_xmm 8 va_s0))
/\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_reg64 rR10
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRdx va_sM (va_update_ok va_sM
va_s0))))))))))))))))
[@ va_qattr]
let va_wp_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_LE:quad32) (y_prev:quad32)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled
/\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64
rR9 va_s0 - 32) h /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64
rRdi va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == va_get_reg64 rRdx va_s0 /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_xmm 8
va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 y_prev /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051) /\ (forall
(va_x_rdx:nat64) (va_x_r11:nat64) (va_x_r10:nat64) (va_x_efl:Vale.X64.Flags.t)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRdx va_x_rdx va_s0)))))))))))) in va_get_ok va_sM /\ (let (h:poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_get_xmm 8
va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental0 h_LE y_prev
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) /\ (va_get_reg64 rRdx va_s0 == 0 ==>
va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)) ==> va_k va_sM (())))
val va_wpProof_Ghash_buffer : hkeys_b:buffer128 -> in_b:buffer128 -> h_LE:quad32 -> y_prev:quad32
-> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer hkeys_b in_b h_LE y_prev va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer ()) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_flags; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdx]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_LE:quad32) (y_prev:quad32) :
(va_quickCode unit (va_code_Ghash_buffer ())) =
(va_QProc (va_code_Ghash_buffer ()) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_flags;
va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdx]) (va_wp_Ghash_buffer hkeys_b in_b h_LE
y_prev) (va_wpProof_Ghash_buffer hkeys_b in_b h_LE y_prev))
//--
//-- GhashUnroll6x
val va_code_GhashUnroll6x : va_dummy:unit -> Tot va_code
val va_codegen_success_GhashUnroll6x : va_dummy:unit -> Tot va_pbool
val va_lemma_GhashUnroll6x : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 ->
scratch_b:buffer128 -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll6x ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ FStar.Seq.Base.length #quad32 data == 6
/\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64
rR9 va_s0 - 32) h /\ scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data 5) /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in va_get_xmm 8 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data)) /\ va_state_eq va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll6x (hkeys_b:buffer128) (scratch_b:buffer128) (h_LE:quad32) (y_prev:quad32) | false | true | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_GhashUnroll6x
(hkeys_b scratch_b: buffer128)
(h_LE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.X64.AESopt2.va_wp_GhashUnroll6x | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
hkeys_b: Vale.X64.Memory.buffer128 ->
scratch_b: Vale.X64.Memory.buffer128 ->
h_LE: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | {
"end_col": 25,
"end_line": 583,
"start_col": 2,
"start_line": 560
} |
Prims.Tot | val va_quick_GhashUnroll6x (hkeys_b scratch_b: buffer128) (h_LE y_prev: quad32) (data: (seq quad32))
: (va_quickCode unit (va_code_GhashUnroll6x ())) | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | false | let va_quick_GhashUnroll6x (hkeys_b:buffer128) (scratch_b:buffer128) (h_LE:quad32) (y_prev:quad32)
(data:(seq quad32)) : (va_quickCode unit (va_code_GhashUnroll6x ())) =
(va_QProc (va_code_GhashUnroll6x ()) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax;
va_Mod_flags]) (va_wp_GhashUnroll6x hkeys_b scratch_b h_LE y_prev data)
(va_wpProof_GhashUnroll6x hkeys_b scratch_b h_LE y_prev data)) | val va_quick_GhashUnroll6x (hkeys_b scratch_b: buffer128) (h_LE y_prev: quad32) (data: (seq quad32))
: (va_quickCode unit (va_code_GhashUnroll6x ()))
let va_quick_GhashUnroll6x (hkeys_b scratch_b: buffer128) (h_LE y_prev: quad32) (data: (seq quad32))
: (va_quickCode unit (va_code_GhashUnroll6x ())) = | false | null | false | (va_QProc (va_code_GhashUnroll6x ())
([
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_flags
])
(va_wp_GhashUnroll6x hkeys_b scratch_b h_LE y_prev data)
(va_wpProof_GhashUnroll6x hkeys_b scratch_b h_LE y_prev data)) | {
"checked_file": "Vale.AES.X64.AESopt2.fsti.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt2.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.quad32",
"FStar.Seq.Base.seq",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.AESopt2.va_code_GhashUnroll6x",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_flags",
"Prims.Nil",
"Vale.AES.X64.AESopt2.va_wp_GhashUnroll6x",
"Vale.AES.X64.AESopt2.va_wpProof_GhashUnroll6x",
"Vale.X64.QuickCode.va_quickCode"
] | [] | module Vale.AES.X64.AESopt2
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 8 layout Secret /\
of_quad32 (buffer128_read hkeys_b 0 heap0) == gf128_power h 1 /\
of_quad32 (buffer128_read hkeys_b 1 heap0) == gf128_power h 2 /\
of_quad32 (buffer128_read hkeys_b 3 heap0) == gf128_power h 3 /\
of_quad32 (buffer128_read hkeys_b 4 heap0) == gf128_power h 4 /\
of_quad32 (buffer128_read hkeys_b 6 heap0) == gf128_power h 5 /\
of_quad32 (buffer128_read hkeys_b 7 heap0) == gf128_power h 6
let quad32_opt_rev (b:bool) (q:quad32) : quad32 =
if b then reverse_bytes_quad32 q else q
let index_opt_rev (b:bool) (len n i:int) : int =
if b then len - 1 - i else len - n + i
let scratch_b_blocks
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(data:seq quad32)
=
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
buffer128_read scratch_in_b (index_opt_rev rev_blocks scratch_len (length data) i) heap_s ==
quad32_opt_rev rev_bytes (index data i))
let scratch_b_data
(rev_bytes:bool) (rev_blocks:bool) (scratch_in_b:buffer128) (scratch_len count:int) (heap_s:vale_heap)
(layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrs128 heap_s ptr scratch_in_b scratch_len layout Secret /\
scratch_b_blocks rev_bytes rev_blocks scratch_in_b scratch_len count heap_s data
//-- MulAdd_step
val va_code_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm -> Tot va_code
val va_codegen_success_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm ->
a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm ->
c:va_operand_xmm -> Tot va_pbool
val va_lemma_MulAdd_step : va_b0:va_code -> va_s0:va_state -> m:nat -> power_index:int ->
a0:va_operand_xmm -> a1:va_operand_xmm -> a2:va_operand_xmm -> a3:va_operand_xmm ->
b:va_operand_xmm -> c:va_operand_xmm -> hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly ->
prev:poly -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) va_s0 /\
va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = (if (m = 1) then va_eval_xmm va_s0
a1 else va_get_xmm 4 va_s0) in (m > 0 ==> add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128
data in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = (if (m = 0) then va_eval_xmm va_sM a0 else
va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) /\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 4 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_xmm c va_sM (va_update_operand_xmm b va_sM (va_update_operand_xmm a3 va_sM
(va_update_operand_xmm a2 va_sM (va_update_operand_xmm a1 va_sM (va_update_operand_xmm a0 va_sM
va_s0)))))))))))))))
[@ va_qattr]
let va_wp_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_xmm a0 va_s0 /\ va_is_dst_xmm a1 va_s0 /\ va_is_dst_xmm a2 va_s0 /\ va_is_dst_xmm a3
va_s0 /\ va_is_dst_xmm b va_s0 /\ va_is_dst_xmm c va_s0 /\ va_get_ok va_s0 /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ m < 6 /\ FStar.Seq.Base.length #quad32
data >= 6 /\ (m == 0 ==> a0 == 1 /\ a1 == 5 /\ a2 == 6 /\ a3 == 7 /\ b == 7 /\ c == 3) /\ (m ==
1 ==> a0 == 5 /\ a1 == 1 /\ a2 == 2 /\ a3 == 3 /\ b == 0 /\ c == 3) /\ (m == 2 ==> a0 == 1 /\
a1 == 2 /\ a2 == 3 /\ a3 == 5 /\ b == 0 /\ c == 5) /\ (m == 3 ==> a0 == 2 /\ a1 == 3 /\ a2 == 5
/\ a3 == 1 /\ b == 0 /\ c == 1) /\ (m == 4 ==> a0 == 3 /\ a1 == 5 /\ a2 == 1 /\ a3 == 2 /\ b ==
0 /\ c == 2) /\ (m == 5 ==> a0 == 2 /\ a1 == 5 /\ a2 == 1 /\ a3 == 8 /\ b == 8 /\ c == 3) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0)
Secret /\ (0 <= power_index /\ power_index < 8) /\ (let z0 = va_if (m = 1) (fun _ ->
va_eval_xmm va_s0 a1) (fun _ -> va_get_xmm 4 va_s0) in (m > 0 ==> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 z0) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 (m - 1)) /\ (m < 5 ==> va_eval_xmm va_s0 b ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data (5 - m))) /\ (m
== 5 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 b) == add prev
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data (5 - m))))) /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 c) == Vale.AES.GHash.gf128_power h (m + 1))
/\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b power_index
(va_get_mem_heaplet 0 va_s0)) == Vale.AES.GHash.gf128_power h (m + 1))) /\ (forall
(va_x_a0:va_value_xmm) (va_x_a1:va_value_xmm) (va_x_a2:va_value_xmm) (va_x_a3:va_value_xmm)
(va_x_b:va_value_xmm) (va_x_c:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32)
(va_x_xmm4:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_operand_xmm c va_x_c (va_upd_operand_xmm
b va_x_b (va_upd_operand_xmm a3 va_x_a3 (va_upd_operand_xmm a2 va_x_a2 (va_upd_operand_xmm a1
va_x_a1 (va_upd_operand_xmm a0 va_x_a0 va_s0))))))))))) in va_get_ok va_sM /\ (let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in (m < 4 ==> va_get_xmm 0 va_sM == Vale.X64.Decls.buffer128_read scratch_b (3 + m)
(va_get_mem_heaplet 3 va_sM)) /\ (let z0 = va_if (m = 0) (fun _ -> va_eval_xmm va_sM a0) (fun _
-> va_get_xmm 4 va_sM) in add (add (Vale.Math.Poly2.Bits_s.of_quad32 z0)
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_sM)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_sM)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 6 m /\ (m == 0 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) == add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0)))) /\ (m == 4 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM) == add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_s0)))) /\ (0 < m /\ m < 4 ==> va_get_xmm 8 va_sM == va_get_xmm 8
va_s0))) ==> va_k va_sM (())))
val va_wpProof_MulAdd_step : m:nat -> power_index:int -> a0:va_operand_xmm -> a1:va_operand_xmm ->
a2:va_operand_xmm -> a3:va_operand_xmm -> b:va_operand_xmm -> c:va_operand_xmm ->
hkeys_b:buffer128 -> scratch_b:buffer128 -> h:poly -> prev:poly -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MulAdd_step m power_index a0 a1 a2 a3 b c hkeys_b
scratch_b h prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulAdd_step m power_index a0 a1 a2 a3
b c) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags;
va_mod_xmm c; va_mod_xmm b; va_mod_xmm a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_MulAdd_step (m:nat) (power_index:int) (a0:va_operand_xmm) (a1:va_operand_xmm)
(a2:va_operand_xmm) (a3:va_operand_xmm) (b:va_operand_xmm) (c:va_operand_xmm) (hkeys_b:buffer128)
(scratch_b:buffer128) (h:poly) (prev:poly) (data:(seq quad32)) : (va_quickCode unit
(va_code_MulAdd_step m power_index a0 a1 a2 a3 b c)) =
(va_QProc (va_code_MulAdd_step m power_index a0 a1 a2 a3 b c) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 4; va_Mod_xmm 0; va_Mod_flags; va_mod_xmm c; va_mod_xmm b; va_mod_xmm
a3; va_mod_xmm a2; va_mod_xmm a1; va_mod_xmm a0]) (va_wp_MulAdd_step m power_index a0 a1 a2 a3
b c hkeys_b scratch_b h prev data) (va_wpProof_MulAdd_step m power_index a0 a1 a2 a3 b c
hkeys_b scratch_b h prev data))
//--
//-- ReduceLast
val va_code_ReduceLast : last_adds:bool -> Tot va_code
val va_codegen_success_ReduceLast : last_adds:bool -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> last_adds:bool -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast last_adds) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi = (if last_adds then
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM) else add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_xmm 8 va_sM
(va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM
(va_update_xmm 3 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in pclmulqdq_enabled /\ avx_enabled
/\ va_get_xmm 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ n
> 0 /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 6 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 7 va_s0)) 128) ==
Vale.AES.GHash.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm0:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl
va_s0))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in let (n:Prims.nat) =
FStar.Seq.Base.length #quad32 data in let xi = va_if last_adds (fun _ ->
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (fun _ -> add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 7 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : last_adds:bool -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ReduceLast last_adds h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast last_adds) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0;
va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (last_adds:bool) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_ReduceLast last_adds)) =
(va_QProc (va_code_ReduceLast last_adds) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 0; va_Mod_flags]) (va_wp_ReduceLast last_adds h_LE
y_prev data) (va_wpProof_ReduceLast last_adds h_LE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool -> Tot
va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> rev_bytes:bool -> rev_blocks:bool
-> exactly6:bool -> scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 ->
h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) /\
va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10
va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in pclmulqdq_enabled /\ avx_enabled /\
sse_enabled /\ (exactly6 ==> n == 6) /\ (~exactly6 ==> 1 <= n /\ n < 6) /\ n <= scratch_len /\
hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9
va_s0 - 32) h /\ scratch_b_data rev_bytes rev_blocks scratch_in_b scratch_len 6
(va_get_mem_heaplet 1 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rRdi va_s0) data /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` scratch_len <= pow2_64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0) == prev /\ (~exactly6 ==> va_get_reg64
rRdx va_s0 == n) /\ va_get_reg64 rR11 va_s0 == va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
scratch_index /\ (~rev_bytes ==> va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32)
(va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM = va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10 (va_upd_flags va_x_efl va_s0)))))))))))
in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let (scratch_index:int) =
index_opt_rev rev_blocks scratch_len n (n - 1) in va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data) /\
(l_and exactly6 (~rev_blocks) ==> va_get_reg64 rR11 va_sM == va_get_reg64 rR11 va_s0 - 80)) ==>
va_k va_sM (())))
val va_wpProof_GhashUnroll_n : rev_bytes:bool -> rev_blocks:bool -> exactly6:bool ->
scratch_len:nat64 -> hkeys_b:buffer128 -> scratch_in_b:buffer128 -> h_LE:quad32 -> y_prev:quad32
-> data:(seq quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len
hkeys_b scratch_in_b h_LE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll_n rev_bytes rev_blocks
exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll_n (rev_bytes:bool) (rev_blocks:bool) (exactly6:bool) (scratch_len:nat64)
(hkeys_b:buffer128) (scratch_in_b:buffer128) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) :
(va_quickCode unit (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6)) =
(va_QProc (va_code_GhashUnroll_n rev_bytes rev_blocks exactly6) ([va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_flags]) (va_wp_GhashUnroll_n rev_bytes
rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE y_prev data)
(va_wpProof_GhashUnroll_n rev_bytes rev_blocks exactly6 scratch_len hkeys_b scratch_in_b h_LE
y_prev data))
//--
//-- Ghash_register
val va_code_Ghash_register : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_register : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_register : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> h_LE:quad32
-> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_register ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in pclmulqdq_enabled
/\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0) == prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
/\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))))))
[@ va_qattr]
let va_wp_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in pclmulqdq_enabled
/\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0) == prev) /\ (forall (va_x_efl:Vale.X64.Flags.t) (va_x_r11:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11 va_x_r11 (va_upd_flags va_x_efl va_s0)))))))))) in
va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (data:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s0)) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
==> va_k va_sM (())))
val va_wpProof_Ghash_register : hkeys_b:buffer128 -> h_LE:quad32 -> y_prev:quad32 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Ghash_register hkeys_b h_LE y_prev va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_register ()) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_register (hkeys_b:buffer128) (h_LE:quad32) (y_prev:quad32) : (va_quickCode unit
(va_code_Ghash_register ())) =
(va_QProc (va_code_Ghash_register ()) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_flags]) (va_wp_Ghash_register hkeys_b h_LE y_prev) (va_wpProof_Ghash_register hkeys_b
h_LE y_prev))
//--
//-- Ghash_buffer
val va_code_Ghash_buffer : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_buffer : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_buffer : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> in_b:buffer128
-> h_LE:quad32 -> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in
pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) in_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == va_get_reg64 rRdx va_s0 /\ va_get_reg64 rRdi va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_xmm 8 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 y_prev /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in va_get_xmm 8 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE y_prev (Vale.X64.Decls.s128 (va_get_mem_heaplet 1
va_sM) in_b)) /\ (va_get_reg64 rRdx va_s0 == 0 ==> va_get_xmm 8 va_sM == va_get_xmm 8 va_s0))
/\ va_state_eq va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_flags va_sM (va_update_reg64 rR10
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRdx va_sM (va_update_ok va_sM
va_s0))))))))))))))))
[@ va_qattr]
let va_wp_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_LE:quad32) (y_prev:quad32)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled
/\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64
rR9 va_s0 - 32) h /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64
rRdi va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == va_get_reg64 rRdx va_s0 /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_xmm 8
va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 y_prev /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051) /\ (forall
(va_x_rdx:nat64) (va_x_r11:nat64) (va_x_r10:nat64) (va_x_efl:Vale.X64.Flags.t)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) . let va_sM =
va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_flags va_x_efl (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRdx va_x_rdx va_s0)))))))))))) in va_get_ok va_sM /\ (let (h:poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_get_xmm 8
va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental0 h_LE y_prev
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) /\ (va_get_reg64 rRdx va_s0 == 0 ==>
va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)) ==> va_k va_sM (())))
val va_wpProof_Ghash_buffer : hkeys_b:buffer128 -> in_b:buffer128 -> h_LE:quad32 -> y_prev:quad32
-> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Ghash_buffer hkeys_b in_b h_LE y_prev va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer ()) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_flags; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdx]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_LE:quad32) (y_prev:quad32) :
(va_quickCode unit (va_code_Ghash_buffer ())) =
(va_QProc (va_code_Ghash_buffer ()) ([va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_flags;
va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdx]) (va_wp_Ghash_buffer hkeys_b in_b h_LE
y_prev) (va_wpProof_Ghash_buffer hkeys_b in_b h_LE y_prev))
//--
//-- GhashUnroll6x
val va_code_GhashUnroll6x : va_dummy:unit -> Tot va_code
val va_codegen_success_GhashUnroll6x : va_dummy:unit -> Tot va_pbool
val va_lemma_GhashUnroll6x : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 ->
scratch_b:buffer128 -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll6x ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ FStar.Seq.Base.length #quad32 data == 6
/\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64
rR9 va_s0 - 32) h /\ scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data 5) /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in va_get_xmm 8 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data)) /\ va_state_eq va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll6x (hkeys_b:buffer128) (scratch_b:buffer128) (h_LE:quad32) (y_prev:quad32)
(data:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let
(pdata:(Prims.int -> Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data
in pclmulqdq_enabled /\ avx_enabled /\ sse_enabled /\ FStar.Seq.Base.length #quad32 data == 6
/\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64
rR9 va_s0 - 32) h /\ scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0)
(va_get_mem_layout va_s0) (va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data 5) /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 4 va_s0))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read
scratch_b 1 (va_get_mem_heaplet 3 va_s0))) == prev) /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32)
(va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32)
. let va_sM = va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6
(va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2
(va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rRax va_x_rax (va_upd_flags
va_x_efl va_s0)))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (pdata:(Prims.int ->
Vale.AES.GHash.poly128)) = Vale.AES.GHash.fun_seq_quad32_LE_poly128 data in va_get_xmm 8 va_sM
== Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))
==> va_k va_sM (())))
val va_wpProof_GhashUnroll6x : hkeys_b:buffer128 -> scratch_b:buffer128 -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_GhashUnroll6x hkeys_b scratch_b h_LE y_prev data va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll6x ()) ([va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll6x (hkeys_b:buffer128) (scratch_b:buffer128) (h_LE:quad32) (y_prev:quad32) | false | false | Vale.AES.X64.AESopt2.fsti | {
"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": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_GhashUnroll6x (hkeys_b scratch_b: buffer128) (h_LE y_prev: quad32) (data: (seq quad32))
: (va_quickCode unit (va_code_GhashUnroll6x ())) | [] | Vale.AES.X64.AESopt2.va_quick_GhashUnroll6x | {
"file_name": "obj/Vale.AES.X64.AESopt2.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
hkeys_b: Vale.X64.Memory.buffer128 ->
scratch_b: Vale.X64.Memory.buffer128 ->
h_LE: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.AESopt2.va_code_GhashUnroll6x ()) | {
"end_col": 66,
"end_line": 599,
"start_col": 2,
"start_line": 596
} |
Prims.Tot | val be_to_n : b:bytes -> Tot nat | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1)) | val be_to_n : b:bytes -> Tot nat
let rec be_to_n b : Tot nat (decreases (S.length b)) = | false | null | false | if S.length b = 0 then 0 else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1)) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"",
"total"
] | [
"FStar.Endianness.bytes",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"Prims.bool",
"Prims.op_Addition",
"FStar.UInt8.v",
"FStar.Seq.Properties.last",
"FStar.Mul.op_Star",
"Prims.pow2",
"FStar.Endianness.be_to_n",
"FStar.Seq.Base.slice",
"Prims.op_Subtraction",
"Prims.nat"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b | false | true | FStar.Endianness.fst | {
"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"
} | null | val be_to_n : b:bytes -> Tot nat | [
"recursion"
] | FStar.Endianness.be_to_n | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b: FStar.Endianness.bytes -> Prims.Tot Prims.nat | {
"end_col": 74,
"end_line": 39,
"start_col": 4,
"start_line": 38
} |
Prims.Tot | val le_to_n : b:bytes -> Tot nat | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b) | val le_to_n : b:bytes -> Tot nat
let rec le_to_n b : Tot nat (decreases (S.length b)) = | false | null | false | if S.length b = 0 then 0 else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"",
"total"
] | [
"FStar.Endianness.bytes",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"Prims.bool",
"Prims.op_Addition",
"FStar.UInt8.v",
"FStar.Seq.Properties.head",
"FStar.Mul.op_Star",
"Prims.pow2",
"FStar.Endianness.le_to_n",
"FStar.Seq.Properties.tail",
"Prims.nat"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b | false | true | FStar.Endianness.fst | {
"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"
} | null | val le_to_n : b:bytes -> Tot nat | [
"recursion"
] | FStar.Endianness.le_to_n | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b: FStar.Endianness.bytes -> Prims.Tot Prims.nat | {
"end_col": 54,
"end_line": 34,
"start_col": 4,
"start_line": 33
} |
FStar.Pervasives.Lemma | val n_to_be_be_to_n (len: nat) (s: Seq.seq U8.t) : Lemma
(requires (Seq.length s == len))
(ensures (
be_to_n s < pow2 (8 * len) /\
n_to_be len (be_to_n s) == s
))
[SMTPat (n_to_be len (be_to_n s))] | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s)) | val n_to_be_be_to_n (len: nat) (s: Seq.seq U8.t) : Lemma
(requires (Seq.length s == len))
(ensures (
be_to_n s < pow2 (8 * len) /\
n_to_be len (be_to_n s) == s
))
[SMTPat (n_to_be len (be_to_n s))]
let n_to_be_be_to_n len s = | false | null | true | lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s)) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma"
] | [
"Prims.nat",
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"FStar.Endianness.be_to_n_inj",
"FStar.Endianness.n_to_be",
"FStar.Endianness.be_to_n",
"Prims.unit",
"FStar.Endianness.lemma_be_to_n_is_bounded"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// ------------- | false | false | FStar.Endianness.fst | {
"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"
} | null | val n_to_be_be_to_n (len: nat) (s: Seq.seq U8.t) : Lemma
(requires (Seq.length s == len))
(ensures (
be_to_n s < pow2 (8 * len) /\
n_to_be len (be_to_n s) == s
))
[SMTPat (n_to_be len (be_to_n s))] | [] | FStar.Endianness.n_to_be_be_to_n | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | len: Prims.nat -> s: FStar.Seq.Base.seq FStar.UInt8.t
-> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length s == len)
(ensures
FStar.Endianness.be_to_n s < Prims.pow2 (8 * len) /\
FStar.Endianness.n_to_be len (FStar.Endianness.be_to_n s) == s)
[SMTPat (FStar.Endianness.n_to_be len (FStar.Endianness.be_to_n s))] | {
"end_col": 41,
"end_line": 152,
"start_col": 2,
"start_line": 151
} |
FStar.Pervasives.Lemma | val n_to_le_le_to_n (len: nat) (s: Seq.seq U8.t) : Lemma
(requires (Seq.length s == len))
(ensures (
le_to_n s < pow2 (8 * len) /\
n_to_le len (le_to_n s) == s
))
[SMTPat (n_to_le len (le_to_n s))] | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s)) | val n_to_le_le_to_n (len: nat) (s: Seq.seq U8.t) : Lemma
(requires (Seq.length s == len))
(ensures (
le_to_n s < pow2 (8 * len) /\
n_to_le len (le_to_n s) == s
))
[SMTPat (n_to_le len (le_to_n s))]
let n_to_le_le_to_n len s = | false | null | true | lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s)) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma"
] | [
"Prims.nat",
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"FStar.Endianness.le_to_n_inj",
"FStar.Endianness.n_to_le",
"FStar.Endianness.le_to_n",
"Prims.unit",
"FStar.Endianness.lemma_le_to_n_is_bounded"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s)) | false | false | FStar.Endianness.fst | {
"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"
} | null | val n_to_le_le_to_n (len: nat) (s: Seq.seq U8.t) : Lemma
(requires (Seq.length s == len))
(ensures (
le_to_n s < pow2 (8 * len) /\
n_to_le len (le_to_n s) == s
))
[SMTPat (n_to_le len (le_to_n s))] | [] | FStar.Endianness.n_to_le_le_to_n | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | len: Prims.nat -> s: FStar.Seq.Base.seq FStar.UInt8.t
-> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length s == len)
(ensures
FStar.Endianness.le_to_n s < Prims.pow2 (8 * len) /\
FStar.Endianness.n_to_le len (FStar.Endianness.le_to_n s) == s)
[SMTPat (FStar.Endianness.n_to_le len (FStar.Endianness.le_to_n s))] | {
"end_col": 41,
"end_line": 156,
"start_col": 2,
"start_line": 155
} |
Prims.Tot | val be_of_seq_uint32 (s: S.seq UInt32.t):
Tot (b:bytes { S.length b = 4 * S.length s })
(decreases (S.length s)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s)) | val be_of_seq_uint32 (s: S.seq UInt32.t):
Tot (b:bytes { S.length b = 4 * S.length s })
(decreases (S.length s))
let rec be_of_seq_uint32 s = | false | null | false | if S.length s = 0 then S.empty else S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s)) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"total",
""
] | [
"FStar.Seq.Base.seq",
"FStar.UInt32.t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.Seq.Base.empty",
"FStar.UInt8.t",
"Prims.bool",
"FStar.Seq.Base.append",
"FStar.Endianness.be_of_uint32",
"FStar.Seq.Properties.head",
"FStar.Endianness.be_of_seq_uint32",
"FStar.Seq.Properties.tail",
"FStar.Endianness.bytes",
"Prims.b2t",
"FStar.Mul.op_Star"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl) | false | false | FStar.Endianness.fst | {
"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"
} | null | val be_of_seq_uint32 (s: S.seq UInt32.t):
Tot (b:bytes { S.length b = 4 * S.length s })
(decreases (S.length s)) | [
"recursion"
] | FStar.Endianness.be_of_seq_uint32 | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | s: FStar.Seq.Base.seq FStar.UInt32.t
-> Prims.Tot (b: FStar.Endianness.bytes{FStar.Seq.Base.length b = 4 * FStar.Seq.Base.length s}) | {
"end_col": 68,
"end_line": 190,
"start_col": 2,
"start_line": 187
} |
Prims.Tot | val le_of_seq_uint32 (s: S.seq UInt32.t):
Tot (b:bytes { S.length b = 4 * S.length s })
(decreases (S.length s)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s)) | val le_of_seq_uint32 (s: S.seq UInt32.t):
Tot (b:bytes { S.length b = 4 * S.length s })
(decreases (S.length s))
let rec le_of_seq_uint32 s = | false | null | false | if S.length s = 0 then S.empty else S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s)) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"total",
""
] | [
"FStar.Seq.Base.seq",
"FStar.UInt32.t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.Seq.Base.empty",
"FStar.UInt8.t",
"Prims.bool",
"FStar.Seq.Base.append",
"FStar.Endianness.le_of_uint32",
"FStar.Seq.Properties.head",
"FStar.Endianness.le_of_seq_uint32",
"FStar.Seq.Properties.tail",
"FStar.Endianness.bytes",
"Prims.b2t",
"FStar.Mul.op_Star"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl) | false | false | FStar.Endianness.fst | {
"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"
} | null | val le_of_seq_uint32 (s: S.seq UInt32.t):
Tot (b:bytes { S.length b = 4 * S.length s })
(decreases (S.length s)) | [
"recursion"
] | FStar.Endianness.le_of_seq_uint32 | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | s: FStar.Seq.Base.seq FStar.UInt32.t
-> Prims.Tot (b: FStar.Endianness.bytes{FStar.Seq.Base.length b = 4 * FStar.Seq.Base.length s}) | {
"end_col": 68,
"end_line": 177,
"start_col": 2,
"start_line": 174
} |
Prims.Tot | val be_of_seq_uint64 (s: S.seq UInt64.t):
Tot (b:bytes { S.length b = 8 * S.length s })
(decreases (S.length s)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec be_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint64 (S.head s)) (be_of_seq_uint64 (S.tail s)) | val be_of_seq_uint64 (s: S.seq UInt64.t):
Tot (b:bytes { S.length b = 8 * S.length s })
(decreases (S.length s))
let rec be_of_seq_uint64 s = | false | null | false | if S.length s = 0 then S.empty else S.append (be_of_uint64 (S.head s)) (be_of_seq_uint64 (S.tail s)) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"total",
""
] | [
"FStar.Seq.Base.seq",
"FStar.UInt64.t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.Seq.Base.empty",
"FStar.UInt8.t",
"Prims.bool",
"FStar.Seq.Base.append",
"FStar.Endianness.be_of_uint64",
"FStar.Seq.Properties.head",
"FStar.Endianness.be_of_seq_uint64",
"FStar.Seq.Properties.tail",
"FStar.Endianness.bytes",
"Prims.b2t",
"FStar.Mul.op_Star"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl)
let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s))
let rec seq_uint64_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl) | false | false | FStar.Endianness.fst | {
"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"
} | null | val be_of_seq_uint64 (s: S.seq UInt64.t):
Tot (b:bytes { S.length b = 8 * S.length s })
(decreases (S.length s)) | [
"recursion"
] | FStar.Endianness.be_of_seq_uint64 | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | s: FStar.Seq.Base.seq FStar.UInt64.t
-> Prims.Tot (b: FStar.Endianness.bytes{FStar.Seq.Base.length b = 8 * FStar.Seq.Base.length s}) | {
"end_col": 68,
"end_line": 216,
"start_col": 2,
"start_line": 213
} |
FStar.Pervasives.Lemma | val be_to_n_inj
(b1 b2: Seq.seq U8.t)
: Lemma
(requires (Seq.length b1 == Seq.length b2 /\ be_to_n b1 == be_to_n b2))
(ensures (Seq.equal b1 b2))
(decreases (Seq.length b1)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end | val be_to_n_inj
(b1 b2: Seq.seq U8.t)
: Lemma
(requires (Seq.length b1 == Seq.length b2 /\ be_to_n b1 == be_to_n b2))
(ensures (Seq.equal b1 b2))
(decreases (Seq.length b1))
let rec be_to_n_inj b1 b2 = | false | null | true | if Seq.length b1 = 0
then ()
else
(be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.bool",
"FStar.Seq.Properties.lemma_split",
"Prims.op_Subtraction",
"Prims.unit",
"FStar.Endianness.be_to_n_inj",
"FStar.Seq.Base.slice"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = () | false | false | FStar.Endianness.fst | {
"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"
} | null | val be_to_n_inj
(b1 b2: Seq.seq U8.t)
: Lemma
(requires (Seq.length b1 == Seq.length b2 /\ be_to_n b1 == be_to_n b2))
(ensures (Seq.equal b1 b2))
(decreases (Seq.length b1)) | [
"recursion"
] | FStar.Endianness.be_to_n_inj | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b1: FStar.Seq.Base.seq FStar.UInt8.t -> b2: FStar.Seq.Base.seq FStar.UInt8.t
-> FStar.Pervasives.Lemma
(requires
FStar.Seq.Base.length b1 == FStar.Seq.Base.length b2 /\
FStar.Endianness.be_to_n b1 == FStar.Endianness.be_to_n b2)
(ensures FStar.Seq.Base.equal b1 b2)
(decreases FStar.Seq.Base.length b1) | {
"end_col": 5,
"end_line": 136,
"start_col": 2,
"start_line": 130
} |
Prims.Tot | val le_of_seq_uint64 (s: S.seq UInt64.t):
Tot (b:bytes { S.length b = 8 * S.length s })
(decreases (S.length s)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s)) | val le_of_seq_uint64 (s: S.seq UInt64.t):
Tot (b:bytes { S.length b = 8 * S.length s })
(decreases (S.length s))
let rec le_of_seq_uint64 s = | false | null | false | if S.length s = 0 then S.empty else S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s)) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"total",
""
] | [
"FStar.Seq.Base.seq",
"FStar.UInt64.t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.Seq.Base.empty",
"FStar.UInt8.t",
"Prims.bool",
"FStar.Seq.Base.append",
"FStar.Endianness.le_of_uint64",
"FStar.Seq.Properties.head",
"FStar.Endianness.le_of_seq_uint64",
"FStar.Seq.Properties.tail",
"FStar.Endianness.bytes",
"Prims.b2t",
"FStar.Mul.op_Star"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl) | false | false | FStar.Endianness.fst | {
"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"
} | null | val le_of_seq_uint64 (s: S.seq UInt64.t):
Tot (b:bytes { S.length b = 8 * S.length s })
(decreases (S.length s)) | [
"recursion"
] | FStar.Endianness.le_of_seq_uint64 | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | s: FStar.Seq.Base.seq FStar.UInt64.t
-> Prims.Tot (b: FStar.Endianness.bytes{FStar.Seq.Base.length b = 8 * FStar.Seq.Base.length s}) | {
"end_col": 68,
"end_line": 203,
"start_col": 2,
"start_line": 200
} |
Prims.Tot | val seq_uint32_of_le (l: nat) (b: bytes{ S.length b = 4 * l }):
s:S.seq UInt32.t { S.length s = l } | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl) | val seq_uint32_of_le (l: nat) (b: bytes{ S.length b = 4 * l }):
s:S.seq UInt32.t { S.length s = l }
let rec seq_uint32_of_le l b = | false | null | false | if S.length b = 0
then S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"total"
] | [
"Prims.nat",
"FStar.Endianness.bytes",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"FStar.Mul.op_Star",
"FStar.Seq.Base.empty",
"FStar.UInt32.t",
"Prims.bool",
"FStar.Seq.Base.seq",
"FStar.Seq.Properties.cons",
"FStar.Endianness.uint32_of_le",
"FStar.Endianness.seq_uint32_of_le",
"Prims.op_Subtraction",
"FStar.Pervasives.Native.tuple2",
"FStar.Seq.Properties.split"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers? | false | false | FStar.Endianness.fst | {
"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"
} | null | val seq_uint32_of_le (l: nat) (b: bytes{ S.length b = 4 * l }):
s:S.seq UInt32.t { S.length s = l } | [
"recursion"
] | FStar.Endianness.seq_uint32_of_le | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | l: Prims.nat -> b: FStar.Endianness.bytes{FStar.Seq.Base.length b = 4 * l}
-> s: FStar.Seq.Base.seq FStar.UInt32.t {FStar.Seq.Base.length s = l} | {
"end_col": 58,
"end_line": 171,
"start_col": 2,
"start_line": 167
} |
FStar.Pervasives.Lemma | val le_to_n_inj
(b1 b2: Seq.seq U8.t)
: Lemma
(requires (Seq.length b1 == Seq.length b2 /\ le_to_n b1 == le_to_n b2))
(ensures (Seq.equal b1 b2))
(decreases (Seq.length b1)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end | val le_to_n_inj
(b1 b2: Seq.seq U8.t)
: Lemma
(requires (Seq.length b1 == Seq.length b2 /\ le_to_n b1 == le_to_n b2))
(ensures (Seq.equal b1 b2))
(decreases (Seq.length b1))
let rec le_to_n_inj b1 b2 = | false | null | true | if Seq.length b1 = 0
then ()
else
(le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.bool",
"FStar.Seq.Properties.lemma_split",
"Prims.unit",
"FStar.Endianness.le_to_n_inj",
"FStar.Seq.Base.slice"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end | false | false | FStar.Endianness.fst | {
"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"
} | null | val le_to_n_inj
(b1 b2: Seq.seq U8.t)
: Lemma
(requires (Seq.length b1 == Seq.length b2 /\ le_to_n b1 == le_to_n b2))
(ensures (Seq.equal b1 b2))
(decreases (Seq.length b1)) | [
"recursion"
] | FStar.Endianness.le_to_n_inj | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b1: FStar.Seq.Base.seq FStar.UInt8.t -> b2: FStar.Seq.Base.seq FStar.UInt8.t
-> FStar.Pervasives.Lemma
(requires
FStar.Seq.Base.length b1 == FStar.Seq.Base.length b2 /\
FStar.Endianness.le_to_n b1 == FStar.Endianness.le_to_n b2)
(ensures FStar.Seq.Base.equal b1 b2)
(decreases FStar.Seq.Base.length b1) | {
"end_col": 5,
"end_line": 145,
"start_col": 2,
"start_line": 139
} |
Prims.Tot | val seq_uint32_of_be (l: nat) (b: bytes{ S.length b = 4 * l }):
s:S.seq UInt32.t { S.length s = l } | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl) | val seq_uint32_of_be (l: nat) (b: bytes{ S.length b = 4 * l }):
s:S.seq UInt32.t { S.length s = l }
let rec seq_uint32_of_be l b = | false | null | false | if S.length b = 0
then S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"total"
] | [
"Prims.nat",
"FStar.Endianness.bytes",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"FStar.Mul.op_Star",
"FStar.Seq.Base.empty",
"FStar.UInt32.t",
"Prims.bool",
"FStar.Seq.Base.seq",
"FStar.Seq.Properties.cons",
"FStar.Endianness.uint32_of_be",
"FStar.Endianness.seq_uint32_of_be",
"Prims.op_Subtraction",
"FStar.Pervasives.Native.tuple2",
"FStar.Seq.Properties.split"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s)) | false | false | FStar.Endianness.fst | {
"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"
} | null | val seq_uint32_of_be (l: nat) (b: bytes{ S.length b = 4 * l }):
s:S.seq UInt32.t { S.length s = l } | [
"recursion"
] | FStar.Endianness.seq_uint32_of_be | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | l: Prims.nat -> b: FStar.Endianness.bytes{FStar.Seq.Base.length b = 4 * l}
-> s: FStar.Seq.Base.seq FStar.UInt32.t {FStar.Seq.Base.length s = l} | {
"end_col": 58,
"end_line": 184,
"start_col": 2,
"start_line": 180
} |
Prims.Tot | val seq_uint64_of_le (l: nat) (b: bytes{ S.length b = 8 * l }):
s:S.seq UInt64.t { S.length s = l } | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl) | val seq_uint64_of_le (l: nat) (b: bytes{ S.length b = 8 * l }):
s:S.seq UInt64.t { S.length s = l }
let rec seq_uint64_of_le l b = | false | null | false | if S.length b = 0
then S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"total"
] | [
"Prims.nat",
"FStar.Endianness.bytes",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"FStar.Mul.op_Star",
"FStar.Seq.Base.empty",
"FStar.UInt64.t",
"Prims.bool",
"FStar.Seq.Base.seq",
"FStar.Seq.Properties.cons",
"FStar.Endianness.uint64_of_le",
"FStar.Endianness.seq_uint64_of_le",
"Prims.op_Subtraction",
"FStar.Pervasives.Native.tuple2",
"FStar.Seq.Properties.split"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s)) | false | false | FStar.Endianness.fst | {
"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"
} | null | val seq_uint64_of_le (l: nat) (b: bytes{ S.length b = 8 * l }):
s:S.seq UInt64.t { S.length s = l } | [
"recursion"
] | FStar.Endianness.seq_uint64_of_le | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | l: Prims.nat -> b: FStar.Endianness.bytes{FStar.Seq.Base.length b = 8 * l}
-> s: FStar.Seq.Base.seq FStar.UInt64.t {FStar.Seq.Base.length s = l} | {
"end_col": 58,
"end_line": 197,
"start_col": 2,
"start_line": 193
} |
Prims.Tot | val seq_uint64_of_be (l: nat) (b: bytes{ S.length b = 8 * l }):
s:S.seq UInt64.t { S.length s = l } | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec seq_uint64_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl) | val seq_uint64_of_be (l: nat) (b: bytes{ S.length b = 8 * l }):
s:S.seq UInt64.t { S.length s = l }
let rec seq_uint64_of_be l b = | false | null | false | if S.length b = 0
then S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"total"
] | [
"Prims.nat",
"FStar.Endianness.bytes",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"FStar.Mul.op_Star",
"FStar.Seq.Base.empty",
"FStar.UInt64.t",
"Prims.bool",
"FStar.Seq.Base.seq",
"FStar.Seq.Properties.cons",
"FStar.Endianness.uint64_of_be",
"FStar.Endianness.seq_uint64_of_be",
"Prims.op_Subtraction",
"FStar.Pervasives.Native.tuple2",
"FStar.Seq.Properties.split"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl)
let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s)) | false | false | FStar.Endianness.fst | {
"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"
} | null | val seq_uint64_of_be (l: nat) (b: bytes{ S.length b = 8 * l }):
s:S.seq UInt64.t { S.length s = l } | [
"recursion"
] | FStar.Endianness.seq_uint64_of_be | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | l: Prims.nat -> b: FStar.Endianness.bytes{FStar.Seq.Base.length b = 8 * l}
-> s: FStar.Seq.Base.seq FStar.UInt64.t {FStar.Seq.Base.length s = l} | {
"end_col": 58,
"end_line": 210,
"start_col": 2,
"start_line": 206
} |
FStar.Pervasives.Lemma | val be_of_seq_uint32_slice (s: S.seq U32.t) (lo: nat) (hi: nat) : Lemma
(requires (lo <= hi /\ hi <= S.length s))
(ensures (be_of_seq_uint32 (S.slice s lo hi) `S.equal` S.slice (be_of_seq_uint32 s) (4 * lo) (4 * hi))) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let be_of_seq_uint32_slice s lo hi =
slice_seq_uint32_of_be (S.length s) (be_of_seq_uint32 s) lo hi | val be_of_seq_uint32_slice (s: S.seq U32.t) (lo: nat) (hi: nat) : Lemma
(requires (lo <= hi /\ hi <= S.length s))
(ensures (be_of_seq_uint32 (S.slice s lo hi) `S.equal` S.slice (be_of_seq_uint32 s) (4 * lo) (4 * hi)))
let be_of_seq_uint32_slice s lo hi = | false | null | true | slice_seq_uint32_of_be (S.length s) (be_of_seq_uint32 s) lo hi | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"FStar.UInt32.t",
"Prims.nat",
"FStar.Endianness.slice_seq_uint32_of_be",
"FStar.Seq.Base.length",
"FStar.Endianness.be_of_seq_uint32",
"Prims.unit"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl)
let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s))
let rec seq_uint64_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl)
let rec be_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint64 (S.head s)) (be_of_seq_uint64 (S.tail s))
/// Pure indexing & update over sequences
/// -------------------------------------
#set-options "--max_fuel 1 --max_ifuel 0 --z3rlimit 50"
let rec offset_uint32_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_be tl (n - 1) (i - 1)
let rec offset_uint32_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_le tl (n - 1) (i - 1)
let rec offset_uint64_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_be tl (n - 1) (i - 1)
let rec offset_uint64_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_le tl (n - 1) (i - 1)
/// Appending and slicing sequences of integers
/// -------------------------------------------
#set-options "--max_fuel 1 --z3rlimit 20"
(* TODO: move to FStar.Seq.Properties, with the pattern *)
let tail_cons (#a: Type) (hd: a) (tl: S.seq a): Lemma
(ensures (S.equal (S.tail (S.cons hd tl)) tl))
// [ SMTPat (S.tail (S.cons hd tl)) ]
=
()
let be_of_seq_uint32_base s1 s2 = ()
let le_of_seq_uint32_base s1 s2 = ()
let be_of_seq_uint64_base s1 s2 = ()
let rec be_of_seq_uint32_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U32.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (be_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (be_of_seq_uint32 (S.append s1 s2))
(S.append (be_of_uint32 (S.head s1)) (be_of_seq_uint32 (S.append (S.tail s1) s2))));
be_of_seq_uint32_append (S.tail s1) s2
end
let rec le_of_seq_uint32_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U32.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (le_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (le_of_seq_uint32 (S.append s1 s2))
(S.append (le_of_uint32 (S.head s1)) (le_of_seq_uint32 (S.append (S.tail s1) s2))));
le_of_seq_uint32_append (S.tail s1) s2
end
let rec be_of_seq_uint64_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U64.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (be_of_seq_uint64 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (be_of_seq_uint64 (S.append s1 s2))
(S.append (be_of_uint64 (S.head s1)) (be_of_seq_uint64 (S.append (S.tail s1) s2))));
be_of_seq_uint64_append (S.tail s1) s2
end
let rec seq_uint32_of_be_be_of_seq_uint32 n s =
if n = 0
then ()
else begin
assert (s `S.equal` S.cons (S.head s) (S.tail s));
seq_uint32_of_be_be_of_seq_uint32 (n - 1) (S.tail s);
let s' = be_of_seq_uint32 s in
S.lemma_split s' 4;
S.lemma_append_inj (S.slice s' 0 4) (S.slice s' 4 (S.length s')) (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
end
let rec be_of_seq_uint32_seq_uint32_of_be n s =
if n = 0
then ()
else begin
S.lemma_split s 4;
be_of_seq_uint32_seq_uint32_of_be (n - 1) (S.slice s 4 (S.length s));
let s' = seq_uint32_of_be n s in
let hd, tl = S.split s 4 in
assert (S.head s' == uint32_of_be hd);
tail_cons (uint32_of_be hd) (seq_uint32_of_be (n - 1) tl);
assert (S.tail s' == seq_uint32_of_be (n - 1) tl);
let s'' = be_of_seq_uint32 s' in
S.lemma_split s'' 4;
S.lemma_append_inj (S.slice s'' 0 4) (S.slice s'' 4 (S.length s'')) (be_of_uint32 (S.head s')) (be_of_seq_uint32 (S.tail s'));
n_to_be_be_to_n 4 hd
end
let slice_seq_uint32_of_be n s lo hi = () | false | false | FStar.Endianness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val be_of_seq_uint32_slice (s: S.seq U32.t) (lo: nat) (hi: nat) : Lemma
(requires (lo <= hi /\ hi <= S.length s))
(ensures (be_of_seq_uint32 (S.slice s lo hi) `S.equal` S.slice (be_of_seq_uint32 s) (4 * lo) (4 * hi))) | [] | FStar.Endianness.be_of_seq_uint32_slice | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | s: FStar.Seq.Base.seq FStar.UInt32.t -> lo: Prims.nat -> hi: Prims.nat
-> FStar.Pervasives.Lemma (requires lo <= hi /\ hi <= FStar.Seq.Base.length s)
(ensures
FStar.Seq.Base.equal (FStar.Endianness.be_of_seq_uint32 (FStar.Seq.Base.slice s lo hi))
(FStar.Seq.Base.slice (FStar.Endianness.be_of_seq_uint32 s) (4 * lo) (4 * hi))) | {
"end_col": 64,
"end_line": 352,
"start_col": 2,
"start_line": 352
} |
Prims.Tot | val n_to_be:
len:nat -> n:nat{n < pow2 (8 * len)} ->
Tot (b:bytes{S.length b == len /\ n == be_to_n b})
(decreases len) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b | val n_to_be:
len:nat -> n:nat{n < pow2 (8 * len)} ->
Tot (b:bytes{S.length b == len /\ n == be_to_n b})
(decreases len)
let rec n_to_be len n = | false | null | false | if len = 0
then S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"total",
""
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.pow2",
"FStar.Mul.op_Star",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.empty",
"FStar.UInt8.t",
"Prims.bool",
"Prims.unit",
"FStar.Seq.Base.lemma_eq_intro",
"FStar.Seq.Base.slice",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.append",
"FStar.Seq.Base.create",
"FStar.Endianness.bytes",
"Prims.l_and",
"Prims.eq2",
"FStar.Seq.Base.length",
"FStar.Endianness.be_to_n",
"FStar.Endianness.n_to_be",
"FStar.Math.Lemmas.pow2_plus",
"Prims.op_Division",
"FStar.UInt8.uint_to_t",
"Prims.op_Modulus",
"Prims.op_Subtraction"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b | false | false | FStar.Endianness.fst | {
"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"
} | null | val n_to_be:
len:nat -> n:nat{n < pow2 (8 * len)} ->
Tot (b:bytes{S.length b == len /\ n == be_to_n b})
(decreases len) | [
"recursion"
] | FStar.Endianness.n_to_be | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | len: Prims.nat -> n: Prims.nat{n < Prims.pow2 (8 * len)}
-> Prims.Tot
(b: FStar.Endianness.bytes{FStar.Seq.Base.length b == len /\ n == FStar.Endianness.be_to_n b}) | {
"end_col": 5,
"end_line": 118,
"start_col": 2,
"start_line": 107
} |
Prims.Tot | val n_to_le : len:nat -> n:nat{n < pow2 (8 * len)} ->
Tot (b:bytes{S.length b == len /\ n == le_to_n b})
(decreases len) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b | val n_to_le : len:nat -> n:nat{n < pow2 (8 * len)} ->
Tot (b:bytes{S.length b == len /\ n == le_to_n b})
(decreases len)
let rec n_to_le len n = | false | null | false | if len = 0
then S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert (n' < pow2 (8 * len));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"total",
""
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.pow2",
"FStar.Mul.op_Star",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.empty",
"FStar.UInt8.t",
"Prims.bool",
"Prims.unit",
"FStar.Seq.Base.lemma_eq_intro",
"FStar.Seq.Properties.tail",
"FStar.Seq.Base.seq",
"FStar.Seq.Properties.cons",
"FStar.Endianness.bytes",
"Prims.l_and",
"Prims.eq2",
"FStar.Seq.Base.length",
"FStar.Endianness.le_to_n",
"FStar.Endianness.n_to_le",
"Prims._assert",
"FStar.Math.Lemmas.pow2_plus",
"Prims.op_Division",
"FStar.UInt8.uint_to_t",
"Prims.op_Modulus",
"Prims.op_Subtraction"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end | false | false | FStar.Endianness.fst | {
"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"
} | null | val n_to_le : len:nat -> n:nat{n < pow2 (8 * len)} ->
Tot (b:bytes{S.length b == len /\ n == le_to_n b})
(decreases len) | [
"recursion"
] | FStar.Endianness.n_to_le | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | len: Prims.nat -> n: Prims.nat{n < Prims.pow2 (8 * len)}
-> Prims.Tot
(b: FStar.Endianness.bytes{FStar.Seq.Base.length b == len /\ n == FStar.Endianness.le_to_n b}) | {
"end_col": 5,
"end_line": 104,
"start_col": 2,
"start_line": 93
} |
FStar.Pervasives.Lemma | val lemma_be_to_n_is_bounded: b:bytes -> Lemma
(requires True)
(ensures (be_to_n b < pow2 (8 * Seq.length b)))
(decreases (Seq.length b)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end | val lemma_be_to_n_is_bounded: b:bytes -> Lemma
(requires True)
(ensures (be_to_n b < pow2 (8 * Seq.length b)))
(decreases (Seq.length b))
let rec lemma_be_to_n_is_bounded b = | false | null | true | if Seq.length b = 0
then ()
else
let s = Seq.slice b 0 (Seq.length b - 1) in
assert (Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert (UInt8.v (Seq.last b) < pow2 8);
assert (be_to_n s < pow2 (8 * Seq.length s));
assert (be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert (be_to_n b <= pow2 8 * (be_to_n s + 1));
assert (be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"FStar.Endianness.bytes",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"Prims.bool",
"FStar.Endianness.lemma_factorise",
"Prims.op_Subtraction",
"Prims.unit",
"FStar.Math.Lemmas.pow2_plus",
"FStar.Mul.op_Star",
"Prims._assert",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Endianness.be_to_n",
"Prims.pow2",
"Prims.op_Addition",
"FStar.Endianness.lemma_euclidean_division",
"FStar.UInt8.v",
"FStar.Seq.Properties.last",
"Prims.op_LessThan",
"FStar.Endianness.lemma_be_to_n_is_bounded",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.slice"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end | false | false | FStar.Endianness.fst | {
"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"
} | null | val lemma_be_to_n_is_bounded: b:bytes -> Lemma
(requires True)
(ensures (be_to_n b < pow2 (8 * Seq.length b)))
(decreases (Seq.length b)) | [
"recursion"
] | FStar.Endianness.lemma_be_to_n_is_bounded | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b: FStar.Endianness.bytes
-> FStar.Pervasives.Lemma
(ensures FStar.Endianness.be_to_n b < Prims.pow2 (8 * FStar.Seq.Base.length b))
(decreases FStar.Seq.Base.length b) | {
"end_col": 7,
"end_line": 90,
"start_col": 2,
"start_line": 76
} |
FStar.Pervasives.Lemma | val lemma_le_to_n_is_bounded: b:bytes -> Lemma
(requires True)
(ensures (le_to_n b < pow2 (8 * Seq.length b)))
(decreases (Seq.length b)) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end | val lemma_le_to_n_is_bounded: b:bytes -> Lemma
(requires True)
(ensures (le_to_n b < pow2 (8 * Seq.length b)))
(decreases (Seq.length b))
let rec lemma_le_to_n_is_bounded b = | false | null | true | if Seq.length b = 0
then ()
else
let s = Seq.slice b 1 (Seq.length b) in
assert (Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert (UInt8.v (Seq.index b 0) < pow2 8);
assert (le_to_n s < pow2 (8 * Seq.length s));
assert (le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert (le_to_n b <= pow2 8 * (le_to_n s + 1));
assert (le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"FStar.Endianness.bytes",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"Prims.bool",
"FStar.Endianness.lemma_factorise",
"Prims.op_Subtraction",
"Prims.unit",
"FStar.Math.Lemmas.pow2_plus",
"FStar.Mul.op_Star",
"Prims._assert",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Endianness.le_to_n",
"Prims.pow2",
"Prims.op_Addition",
"FStar.Endianness.lemma_euclidean_division",
"FStar.UInt8.v",
"FStar.Seq.Base.index",
"Prims.op_LessThan",
"FStar.Endianness.lemma_le_to_n_is_bounded",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.slice"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = () | false | false | FStar.Endianness.fst | {
"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"
} | null | val lemma_le_to_n_is_bounded: b:bytes -> Lemma
(requires True)
(ensures (le_to_n b < pow2 (8 * Seq.length b)))
(decreases (Seq.length b)) | [
"recursion"
] | FStar.Endianness.lemma_le_to_n_is_bounded | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b: FStar.Endianness.bytes
-> FStar.Pervasives.Lemma
(ensures FStar.Endianness.le_to_n b < Prims.pow2 (8 * FStar.Seq.Base.length b))
(decreases FStar.Seq.Base.length b) | {
"end_col": 7,
"end_line": 73,
"start_col": 2,
"start_line": 59
} |
FStar.Pervasives.Lemma | val seq_uint32_of_be_be_of_seq_uint32 (n: nat) (s: S.seq U32.t) : Lemma
(requires (n == S.length s))
(ensures (seq_uint32_of_be n (be_of_seq_uint32 s) `S.equal` s))
(decreases n)
[SMTPat (seq_uint32_of_be n (be_of_seq_uint32 s))] | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec seq_uint32_of_be_be_of_seq_uint32 n s =
if n = 0
then ()
else begin
assert (s `S.equal` S.cons (S.head s) (S.tail s));
seq_uint32_of_be_be_of_seq_uint32 (n - 1) (S.tail s);
let s' = be_of_seq_uint32 s in
S.lemma_split s' 4;
S.lemma_append_inj (S.slice s' 0 4) (S.slice s' 4 (S.length s')) (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
end | val seq_uint32_of_be_be_of_seq_uint32 (n: nat) (s: S.seq U32.t) : Lemma
(requires (n == S.length s))
(ensures (seq_uint32_of_be n (be_of_seq_uint32 s) `S.equal` s))
(decreases n)
[SMTPat (seq_uint32_of_be n (be_of_seq_uint32 s))]
let rec seq_uint32_of_be_be_of_seq_uint32 n s = | false | null | true | if n = 0
then ()
else
(assert (s `S.equal` (S.cons (S.head s) (S.tail s)));
seq_uint32_of_be_be_of_seq_uint32 (n - 1) (S.tail s);
let s' = be_of_seq_uint32 s in
S.lemma_split s' 4;
S.lemma_append_inj (S.slice s' 0 4)
(S.slice s' 4 (S.length s'))
(be_of_uint32 (S.head s))
(be_of_seq_uint32 (S.tail s))) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"Prims.nat",
"FStar.Seq.Base.seq",
"FStar.UInt32.t",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"FStar.Seq.Properties.lemma_append_inj",
"FStar.UInt8.t",
"FStar.Seq.Base.slice",
"FStar.Seq.Base.length",
"FStar.Endianness.be_of_uint32",
"FStar.Seq.Properties.head",
"FStar.Endianness.be_of_seq_uint32",
"FStar.Seq.Properties.tail",
"Prims.unit",
"FStar.Seq.Properties.lemma_split",
"FStar.Endianness.bytes",
"Prims.b2t",
"Prims.op_Multiply",
"FStar.Endianness.seq_uint32_of_be_be_of_seq_uint32",
"Prims.op_Subtraction",
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Seq.Properties.cons"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl)
let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s))
let rec seq_uint64_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl)
let rec be_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint64 (S.head s)) (be_of_seq_uint64 (S.tail s))
/// Pure indexing & update over sequences
/// -------------------------------------
#set-options "--max_fuel 1 --max_ifuel 0 --z3rlimit 50"
let rec offset_uint32_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_be tl (n - 1) (i - 1)
let rec offset_uint32_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_le tl (n - 1) (i - 1)
let rec offset_uint64_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_be tl (n - 1) (i - 1)
let rec offset_uint64_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_le tl (n - 1) (i - 1)
/// Appending and slicing sequences of integers
/// -------------------------------------------
#set-options "--max_fuel 1 --z3rlimit 20"
(* TODO: move to FStar.Seq.Properties, with the pattern *)
let tail_cons (#a: Type) (hd: a) (tl: S.seq a): Lemma
(ensures (S.equal (S.tail (S.cons hd tl)) tl))
// [ SMTPat (S.tail (S.cons hd tl)) ]
=
()
let be_of_seq_uint32_base s1 s2 = ()
let le_of_seq_uint32_base s1 s2 = ()
let be_of_seq_uint64_base s1 s2 = ()
let rec be_of_seq_uint32_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U32.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (be_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (be_of_seq_uint32 (S.append s1 s2))
(S.append (be_of_uint32 (S.head s1)) (be_of_seq_uint32 (S.append (S.tail s1) s2))));
be_of_seq_uint32_append (S.tail s1) s2
end
let rec le_of_seq_uint32_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U32.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (le_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (le_of_seq_uint32 (S.append s1 s2))
(S.append (le_of_uint32 (S.head s1)) (le_of_seq_uint32 (S.append (S.tail s1) s2))));
le_of_seq_uint32_append (S.tail s1) s2
end
let rec be_of_seq_uint64_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U64.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (be_of_seq_uint64 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (be_of_seq_uint64 (S.append s1 s2))
(S.append (be_of_uint64 (S.head s1)) (be_of_seq_uint64 (S.append (S.tail s1) s2))));
be_of_seq_uint64_append (S.tail s1) s2
end | false | false | FStar.Endianness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val seq_uint32_of_be_be_of_seq_uint32 (n: nat) (s: S.seq U32.t) : Lemma
(requires (n == S.length s))
(ensures (seq_uint32_of_be n (be_of_seq_uint32 s) `S.equal` s))
(decreases n)
[SMTPat (seq_uint32_of_be n (be_of_seq_uint32 s))] | [
"recursion"
] | FStar.Endianness.seq_uint32_of_be_be_of_seq_uint32 | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | n: Prims.nat -> s: FStar.Seq.Base.seq FStar.UInt32.t
-> FStar.Pervasives.Lemma (requires n == FStar.Seq.Base.length s)
(ensures
FStar.Seq.Base.equal (FStar.Endianness.seq_uint32_of_be n
(FStar.Endianness.be_of_seq_uint32 s))
s)
(decreases n)
[SMTPat (FStar.Endianness.seq_uint32_of_be n (FStar.Endianness.be_of_seq_uint32 s))] | {
"end_col": 5,
"end_line": 330,
"start_col": 2,
"start_line": 322
} |
FStar.Pervasives.Lemma | val offset_uint32_be (b: bytes) (n: nat) (i: nat):
Lemma
(requires (
S.length b = 4 * n /\
i < n))
(ensures (
S.index (seq_uint32_of_be n b) i == uint32_of_be (S.slice b (4 * i) (4 * i + 4))))
(decreases (
S.length b))
[ SMTPat (S.index (seq_uint32_of_be n b) i) ] | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec offset_uint32_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_be tl (n - 1) (i - 1) | val offset_uint32_be (b: bytes) (n: nat) (i: nat):
Lemma
(requires (
S.length b = 4 * n /\
i < n))
(ensures (
S.index (seq_uint32_of_be n b) i == uint32_of_be (S.slice b (4 * i) (4 * i + 4))))
(decreases (
S.length b))
[ SMTPat (S.index (seq_uint32_of_be n b) i) ]
let rec offset_uint32_be (b: bytes) (n i: nat) = | false | null | true | if S.length b = 0
then false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then () else offset_uint32_be tl (n - 1) (i - 1) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"FStar.Endianness.bytes",
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"FStar.Pervasives.false_elim",
"Prims.unit",
"Prims.bool",
"FStar.Seq.Base.seq",
"FStar.Endianness.offset_uint32_be",
"Prims.op_Subtraction",
"FStar.Pervasives.Native.tuple2",
"FStar.Seq.Properties.split"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl)
let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s))
let rec seq_uint64_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl)
let rec be_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint64 (S.head s)) (be_of_seq_uint64 (S.tail s))
/// Pure indexing & update over sequences
/// -------------------------------------
#set-options "--max_fuel 1 --max_ifuel 0 --z3rlimit 50" | false | false | FStar.Endianness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val offset_uint32_be (b: bytes) (n: nat) (i: nat):
Lemma
(requires (
S.length b = 4 * n /\
i < n))
(ensures (
S.index (seq_uint32_of_be n b) i == uint32_of_be (S.slice b (4 * i) (4 * i + 4))))
(decreases (
S.length b))
[ SMTPat (S.index (seq_uint32_of_be n b) i) ] | [
"recursion"
] | FStar.Endianness.offset_uint32_be | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b: FStar.Endianness.bytes -> n: Prims.nat -> i: Prims.nat
-> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length b = 4 * n /\ i < n)
(ensures
FStar.Seq.Base.index (FStar.Endianness.seq_uint32_of_be n b) i ==
FStar.Endianness.uint32_of_be (FStar.Seq.Base.slice b (4 * i) (4 * i + 4)))
(decreases FStar.Seq.Base.length b)
[SMTPat (FStar.Seq.Base.index (FStar.Endianness.seq_uint32_of_be n b) i)] | {
"end_col": 41,
"end_line": 231,
"start_col": 2,
"start_line": 224
} |
FStar.Pervasives.Lemma | val offset_uint32_le (b: bytes) (n: nat) (i: nat):
Lemma
(requires (
S.length b = 4 * n /\
i < n))
(ensures (
S.index (seq_uint32_of_le n b) i == uint32_of_le (S.slice b (4 * i) (4 * i + 4))))
(decreases (
S.length b))
[ SMTPat (S.index (seq_uint32_of_le n b) i) ] | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec offset_uint32_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_le tl (n - 1) (i - 1) | val offset_uint32_le (b: bytes) (n: nat) (i: nat):
Lemma
(requires (
S.length b = 4 * n /\
i < n))
(ensures (
S.index (seq_uint32_of_le n b) i == uint32_of_le (S.slice b (4 * i) (4 * i + 4))))
(decreases (
S.length b))
[ SMTPat (S.index (seq_uint32_of_le n b) i) ]
let rec offset_uint32_le (b: bytes) (n i: nat) = | false | null | true | if S.length b = 0
then false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then () else offset_uint32_le tl (n - 1) (i - 1) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"FStar.Endianness.bytes",
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"FStar.Pervasives.false_elim",
"Prims.unit",
"Prims.bool",
"FStar.Seq.Base.seq",
"FStar.Endianness.offset_uint32_le",
"Prims.op_Subtraction",
"FStar.Pervasives.Native.tuple2",
"FStar.Seq.Properties.split"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl)
let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s))
let rec seq_uint64_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl)
let rec be_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint64 (S.head s)) (be_of_seq_uint64 (S.tail s))
/// Pure indexing & update over sequences
/// -------------------------------------
#set-options "--max_fuel 1 --max_ifuel 0 --z3rlimit 50"
let rec offset_uint32_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_be tl (n - 1) (i - 1) | false | false | FStar.Endianness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val offset_uint32_le (b: bytes) (n: nat) (i: nat):
Lemma
(requires (
S.length b = 4 * n /\
i < n))
(ensures (
S.index (seq_uint32_of_le n b) i == uint32_of_le (S.slice b (4 * i) (4 * i + 4))))
(decreases (
S.length b))
[ SMTPat (S.index (seq_uint32_of_le n b) i) ] | [
"recursion"
] | FStar.Endianness.offset_uint32_le | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b: FStar.Endianness.bytes -> n: Prims.nat -> i: Prims.nat
-> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length b = 4 * n /\ i < n)
(ensures
FStar.Seq.Base.index (FStar.Endianness.seq_uint32_of_le n b) i ==
FStar.Endianness.uint32_of_le (FStar.Seq.Base.slice b (4 * i) (4 * i + 4)))
(decreases FStar.Seq.Base.length b)
[SMTPat (FStar.Seq.Base.index (FStar.Endianness.seq_uint32_of_le n b) i)] | {
"end_col": 41,
"end_line": 241,
"start_col": 2,
"start_line": 234
} |
FStar.Pervasives.Lemma | val offset_uint64_be (b: bytes) (n: nat) (i: nat):
Lemma
(requires (
S.length b = 8 * n /\
i < n))
(ensures (
S.index (seq_uint64_of_be n b) i == uint64_of_be (S.slice b (8 * i) (8 * i + 8))))
(decreases (
S.length b))
[ SMTPat (S.index (seq_uint64_of_be n b) i) ] | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec offset_uint64_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_be tl (n - 1) (i - 1) | val offset_uint64_be (b: bytes) (n: nat) (i: nat):
Lemma
(requires (
S.length b = 8 * n /\
i < n))
(ensures (
S.index (seq_uint64_of_be n b) i == uint64_of_be (S.slice b (8 * i) (8 * i + 8))))
(decreases (
S.length b))
[ SMTPat (S.index (seq_uint64_of_be n b) i) ]
let rec offset_uint64_be (b: bytes) (n i: nat) = | false | null | true | if S.length b = 0
then false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then () else offset_uint64_be tl (n - 1) (i - 1) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"FStar.Endianness.bytes",
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"FStar.Pervasives.false_elim",
"Prims.unit",
"Prims.bool",
"FStar.Seq.Base.seq",
"FStar.Endianness.offset_uint64_be",
"Prims.op_Subtraction",
"FStar.Pervasives.Native.tuple2",
"FStar.Seq.Properties.split"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl)
let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s))
let rec seq_uint64_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl)
let rec be_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint64 (S.head s)) (be_of_seq_uint64 (S.tail s))
/// Pure indexing & update over sequences
/// -------------------------------------
#set-options "--max_fuel 1 --max_ifuel 0 --z3rlimit 50"
let rec offset_uint32_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_be tl (n - 1) (i - 1)
let rec offset_uint32_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_le tl (n - 1) (i - 1) | false | false | FStar.Endianness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val offset_uint64_be (b: bytes) (n: nat) (i: nat):
Lemma
(requires (
S.length b = 8 * n /\
i < n))
(ensures (
S.index (seq_uint64_of_be n b) i == uint64_of_be (S.slice b (8 * i) (8 * i + 8))))
(decreases (
S.length b))
[ SMTPat (S.index (seq_uint64_of_be n b) i) ] | [
"recursion"
] | FStar.Endianness.offset_uint64_be | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b: FStar.Endianness.bytes -> n: Prims.nat -> i: Prims.nat
-> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length b = 8 * n /\ i < n)
(ensures
FStar.Seq.Base.index (FStar.Endianness.seq_uint64_of_be n b) i ==
FStar.Endianness.uint64_of_be (FStar.Seq.Base.slice b (8 * i) (8 * i + 8)))
(decreases FStar.Seq.Base.length b)
[SMTPat (FStar.Seq.Base.index (FStar.Endianness.seq_uint64_of_be n b) i)] | {
"end_col": 41,
"end_line": 251,
"start_col": 2,
"start_line": 244
} |
FStar.Pervasives.Lemma | val offset_uint64_le (b: bytes) (n: nat) (i: nat):
Lemma
(requires (
S.length b = 8 * n /\
i < n))
(ensures (
S.index (seq_uint64_of_le n b) i == uint64_of_le (S.slice b (8 * i) (8 * i + 8))))
(decreases (
S.length b))
[ SMTPat (S.index (seq_uint64_of_le n b) i) ] | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec offset_uint64_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_le tl (n - 1) (i - 1) | val offset_uint64_le (b: bytes) (n: nat) (i: nat):
Lemma
(requires (
S.length b = 8 * n /\
i < n))
(ensures (
S.index (seq_uint64_of_le n b) i == uint64_of_le (S.slice b (8 * i) (8 * i + 8))))
(decreases (
S.length b))
[ SMTPat (S.index (seq_uint64_of_le n b) i) ]
let rec offset_uint64_le (b: bytes) (n i: nat) = | false | null | true | if S.length b = 0
then false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then () else offset_uint64_le tl (n - 1) (i - 1) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"FStar.Endianness.bytes",
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"FStar.Pervasives.false_elim",
"Prims.unit",
"Prims.bool",
"FStar.Seq.Base.seq",
"FStar.Endianness.offset_uint64_le",
"Prims.op_Subtraction",
"FStar.Pervasives.Native.tuple2",
"FStar.Seq.Properties.split"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl)
let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s))
let rec seq_uint64_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl)
let rec be_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint64 (S.head s)) (be_of_seq_uint64 (S.tail s))
/// Pure indexing & update over sequences
/// -------------------------------------
#set-options "--max_fuel 1 --max_ifuel 0 --z3rlimit 50"
let rec offset_uint32_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_be tl (n - 1) (i - 1)
let rec offset_uint32_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_le tl (n - 1) (i - 1)
let rec offset_uint64_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_be tl (n - 1) (i - 1) | false | false | FStar.Endianness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val offset_uint64_le (b: bytes) (n: nat) (i: nat):
Lemma
(requires (
S.length b = 8 * n /\
i < n))
(ensures (
S.index (seq_uint64_of_le n b) i == uint64_of_le (S.slice b (8 * i) (8 * i + 8))))
(decreases (
S.length b))
[ SMTPat (S.index (seq_uint64_of_le n b) i) ] | [
"recursion"
] | FStar.Endianness.offset_uint64_le | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b: FStar.Endianness.bytes -> n: Prims.nat -> i: Prims.nat
-> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length b = 8 * n /\ i < n)
(ensures
FStar.Seq.Base.index (FStar.Endianness.seq_uint64_of_le n b) i ==
FStar.Endianness.uint64_of_le (FStar.Seq.Base.slice b (8 * i) (8 * i + 8)))
(decreases FStar.Seq.Base.length b)
[SMTPat (FStar.Seq.Base.index (FStar.Endianness.seq_uint64_of_le n b) i)] | {
"end_col": 41,
"end_line": 261,
"start_col": 2,
"start_line": 254
} |
FStar.Pervasives.Lemma | val be_of_seq_uint32_seq_uint32_of_be (n: nat) (s: S.seq U8.t) : Lemma
(requires (4 * n == S.length s))
(ensures (be_of_seq_uint32 (seq_uint32_of_be n s) `S.equal` s))
(decreases n)
[SMTPat (be_of_seq_uint32 (seq_uint32_of_be n s))] | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec be_of_seq_uint32_seq_uint32_of_be n s =
if n = 0
then ()
else begin
S.lemma_split s 4;
be_of_seq_uint32_seq_uint32_of_be (n - 1) (S.slice s 4 (S.length s));
let s' = seq_uint32_of_be n s in
let hd, tl = S.split s 4 in
assert (S.head s' == uint32_of_be hd);
tail_cons (uint32_of_be hd) (seq_uint32_of_be (n - 1) tl);
assert (S.tail s' == seq_uint32_of_be (n - 1) tl);
let s'' = be_of_seq_uint32 s' in
S.lemma_split s'' 4;
S.lemma_append_inj (S.slice s'' 0 4) (S.slice s'' 4 (S.length s'')) (be_of_uint32 (S.head s')) (be_of_seq_uint32 (S.tail s'));
n_to_be_be_to_n 4 hd
end | val be_of_seq_uint32_seq_uint32_of_be (n: nat) (s: S.seq U8.t) : Lemma
(requires (4 * n == S.length s))
(ensures (be_of_seq_uint32 (seq_uint32_of_be n s) `S.equal` s))
(decreases n)
[SMTPat (be_of_seq_uint32 (seq_uint32_of_be n s))]
let rec be_of_seq_uint32_seq_uint32_of_be n s = | false | null | true | if n = 0
then ()
else
(S.lemma_split s 4;
be_of_seq_uint32_seq_uint32_of_be (n - 1) (S.slice s 4 (S.length s));
let s' = seq_uint32_of_be n s in
let hd, tl = S.split s 4 in
assert (S.head s' == uint32_of_be hd);
tail_cons (uint32_of_be hd) (seq_uint32_of_be (n - 1) tl);
assert (S.tail s' == seq_uint32_of_be (n - 1) tl);
let s'' = be_of_seq_uint32 s' in
S.lemma_split s'' 4;
S.lemma_append_inj (S.slice s'' 0 4)
(S.slice s'' 4 (S.length s''))
(be_of_uint32 (S.head s'))
(be_of_seq_uint32 (S.tail s'));
n_to_be_be_to_n 4 hd) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"Prims.nat",
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"FStar.Endianness.n_to_be_be_to_n",
"Prims.unit",
"FStar.Seq.Properties.lemma_append_inj",
"FStar.Seq.Base.slice",
"FStar.Seq.Base.length",
"FStar.Endianness.be_of_uint32",
"FStar.Seq.Properties.head",
"FStar.UInt32.t",
"FStar.Endianness.be_of_seq_uint32",
"FStar.Seq.Properties.tail",
"FStar.Seq.Properties.lemma_split",
"FStar.Endianness.bytes",
"Prims.b2t",
"Prims.op_Multiply",
"Prims._assert",
"Prims.eq2",
"FStar.Endianness.seq_uint32_of_be",
"Prims.op_Subtraction",
"FStar.Endianness.tail_cons",
"FStar.Endianness.uint32_of_be",
"FStar.Pervasives.Native.tuple2",
"FStar.Seq.Properties.split",
"FStar.Endianness.be_of_seq_uint32_seq_uint32_of_be"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl)
let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s))
let rec seq_uint64_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl)
let rec be_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint64 (S.head s)) (be_of_seq_uint64 (S.tail s))
/// Pure indexing & update over sequences
/// -------------------------------------
#set-options "--max_fuel 1 --max_ifuel 0 --z3rlimit 50"
let rec offset_uint32_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_be tl (n - 1) (i - 1)
let rec offset_uint32_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_le tl (n - 1) (i - 1)
let rec offset_uint64_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_be tl (n - 1) (i - 1)
let rec offset_uint64_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_le tl (n - 1) (i - 1)
/// Appending and slicing sequences of integers
/// -------------------------------------------
#set-options "--max_fuel 1 --z3rlimit 20"
(* TODO: move to FStar.Seq.Properties, with the pattern *)
let tail_cons (#a: Type) (hd: a) (tl: S.seq a): Lemma
(ensures (S.equal (S.tail (S.cons hd tl)) tl))
// [ SMTPat (S.tail (S.cons hd tl)) ]
=
()
let be_of_seq_uint32_base s1 s2 = ()
let le_of_seq_uint32_base s1 s2 = ()
let be_of_seq_uint64_base s1 s2 = ()
let rec be_of_seq_uint32_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U32.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (be_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (be_of_seq_uint32 (S.append s1 s2))
(S.append (be_of_uint32 (S.head s1)) (be_of_seq_uint32 (S.append (S.tail s1) s2))));
be_of_seq_uint32_append (S.tail s1) s2
end
let rec le_of_seq_uint32_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U32.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (le_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (le_of_seq_uint32 (S.append s1 s2))
(S.append (le_of_uint32 (S.head s1)) (le_of_seq_uint32 (S.append (S.tail s1) s2))));
le_of_seq_uint32_append (S.tail s1) s2
end
let rec be_of_seq_uint64_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U64.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (be_of_seq_uint64 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (be_of_seq_uint64 (S.append s1 s2))
(S.append (be_of_uint64 (S.head s1)) (be_of_seq_uint64 (S.append (S.tail s1) s2))));
be_of_seq_uint64_append (S.tail s1) s2
end
let rec seq_uint32_of_be_be_of_seq_uint32 n s =
if n = 0
then ()
else begin
assert (s `S.equal` S.cons (S.head s) (S.tail s));
seq_uint32_of_be_be_of_seq_uint32 (n - 1) (S.tail s);
let s' = be_of_seq_uint32 s in
S.lemma_split s' 4;
S.lemma_append_inj (S.slice s' 0 4) (S.slice s' 4 (S.length s')) (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
end | false | false | FStar.Endianness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val be_of_seq_uint32_seq_uint32_of_be (n: nat) (s: S.seq U8.t) : Lemma
(requires (4 * n == S.length s))
(ensures (be_of_seq_uint32 (seq_uint32_of_be n s) `S.equal` s))
(decreases n)
[SMTPat (be_of_seq_uint32 (seq_uint32_of_be n s))] | [
"recursion"
] | FStar.Endianness.be_of_seq_uint32_seq_uint32_of_be | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | n: Prims.nat -> s: FStar.Seq.Base.seq FStar.UInt8.t
-> FStar.Pervasives.Lemma (requires 4 * n == FStar.Seq.Base.length s)
(ensures
FStar.Seq.Base.equal (FStar.Endianness.be_of_seq_uint32 (FStar.Endianness.seq_uint32_of_be n
s))
s)
(decreases n)
[SMTPat (FStar.Endianness.be_of_seq_uint32 (FStar.Endianness.seq_uint32_of_be n s))] | {
"end_col": 5,
"end_line": 347,
"start_col": 2,
"start_line": 333
} |
FStar.Pervasives.Lemma | val be_of_seq_uint32_append (s1 s2: S.seq U32.t): Lemma
(ensures (
S.equal (be_of_seq_uint32 (S.append s1 s2))
(S.append (be_of_seq_uint32 s1) (be_of_seq_uint32 s2))))
(decreases (
S.length s1))
[ SMTPat (S.append (be_of_seq_uint32 s1) (be_of_seq_uint32 s2)) ] | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec be_of_seq_uint32_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U32.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (be_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (be_of_seq_uint32 (S.append s1 s2))
(S.append (be_of_uint32 (S.head s1)) (be_of_seq_uint32 (S.append (S.tail s1) s2))));
be_of_seq_uint32_append (S.tail s1) s2
end | val be_of_seq_uint32_append (s1 s2: S.seq U32.t): Lemma
(ensures (
S.equal (be_of_seq_uint32 (S.append s1 s2))
(S.append (be_of_seq_uint32 s1) (be_of_seq_uint32 s2))))
(decreases (
S.length s1))
[ SMTPat (S.append (be_of_seq_uint32 s1) (be_of_seq_uint32 s2)) ]
let rec be_of_seq_uint32_append s1 s2 = | false | null | true | Classical.forall_intro_2 (tail_cons #U32.t);
if S.length s1 = 0
then
(assert (S.equal (be_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
())
else
(assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (be_of_seq_uint32 (S.append s1 s2))
(S.append (be_of_uint32 (S.head s1)) (be_of_seq_uint32 (S.append (S.tail s1) s2))));
be_of_seq_uint32_append (S.tail s1) s2) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"FStar.Seq.Base.seq",
"FStar.UInt32.t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.append",
"FStar.UInt8.t",
"FStar.Endianness.be_of_seq_uint32",
"FStar.Seq.Base.empty",
"Prims.bool",
"FStar.Endianness.be_of_seq_uint32_append",
"FStar.Seq.Properties.tail",
"FStar.Endianness.be_of_uint32",
"FStar.Seq.Properties.head",
"FStar.Seq.Properties.cons",
"FStar.Classical.forall_intro_2",
"FStar.Endianness.tail_cons"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl)
let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s))
let rec seq_uint64_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl)
let rec be_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint64 (S.head s)) (be_of_seq_uint64 (S.tail s))
/// Pure indexing & update over sequences
/// -------------------------------------
#set-options "--max_fuel 1 --max_ifuel 0 --z3rlimit 50"
let rec offset_uint32_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_be tl (n - 1) (i - 1)
let rec offset_uint32_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_le tl (n - 1) (i - 1)
let rec offset_uint64_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_be tl (n - 1) (i - 1)
let rec offset_uint64_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_le tl (n - 1) (i - 1)
/// Appending and slicing sequences of integers
/// -------------------------------------------
#set-options "--max_fuel 1 --z3rlimit 20"
(* TODO: move to FStar.Seq.Properties, with the pattern *)
let tail_cons (#a: Type) (hd: a) (tl: S.seq a): Lemma
(ensures (S.equal (S.tail (S.cons hd tl)) tl))
// [ SMTPat (S.tail (S.cons hd tl)) ]
=
()
let be_of_seq_uint32_base s1 s2 = ()
let le_of_seq_uint32_base s1 s2 = ()
let be_of_seq_uint64_base s1 s2 = () | false | false | FStar.Endianness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val be_of_seq_uint32_append (s1 s2: S.seq U32.t): Lemma
(ensures (
S.equal (be_of_seq_uint32 (S.append s1 s2))
(S.append (be_of_seq_uint32 s1) (be_of_seq_uint32 s2))))
(decreases (
S.length s1))
[ SMTPat (S.append (be_of_seq_uint32 s1) (be_of_seq_uint32 s2)) ] | [
"recursion"
] | FStar.Endianness.be_of_seq_uint32_append | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | s1: FStar.Seq.Base.seq FStar.UInt32.t -> s2: FStar.Seq.Base.seq FStar.UInt32.t
-> FStar.Pervasives.Lemma
(ensures
FStar.Seq.Base.equal (FStar.Endianness.be_of_seq_uint32 (FStar.Seq.Base.append s1 s2))
(FStar.Seq.Base.append (FStar.Endianness.be_of_seq_uint32 s1)
(FStar.Endianness.be_of_seq_uint32 s2)))
(decreases FStar.Seq.Base.length s1)
[
SMTPat (FStar.Seq.Base.append (FStar.Endianness.be_of_seq_uint32 s1)
(FStar.Endianness.be_of_seq_uint32 s2))
] | {
"end_col": 5,
"end_line": 293,
"start_col": 2,
"start_line": 283
} |
FStar.Pervasives.Lemma | val le_of_seq_uint32_append (s1 s2: S.seq U32.t): Lemma
(ensures (
S.equal (le_of_seq_uint32 (S.append s1 s2))
(S.append (le_of_seq_uint32 s1) (le_of_seq_uint32 s2))))
(decreases (
S.length s1))
[ SMTPat (S.append (le_of_seq_uint32 s1) (le_of_seq_uint32 s2)) ] | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec le_of_seq_uint32_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U32.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (le_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (le_of_seq_uint32 (S.append s1 s2))
(S.append (le_of_uint32 (S.head s1)) (le_of_seq_uint32 (S.append (S.tail s1) s2))));
le_of_seq_uint32_append (S.tail s1) s2
end | val le_of_seq_uint32_append (s1 s2: S.seq U32.t): Lemma
(ensures (
S.equal (le_of_seq_uint32 (S.append s1 s2))
(S.append (le_of_seq_uint32 s1) (le_of_seq_uint32 s2))))
(decreases (
S.length s1))
[ SMTPat (S.append (le_of_seq_uint32 s1) (le_of_seq_uint32 s2)) ]
let rec le_of_seq_uint32_append s1 s2 = | false | null | true | Classical.forall_intro_2 (tail_cons #U32.t);
if S.length s1 = 0
then
(assert (S.equal (le_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
())
else
(assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (le_of_seq_uint32 (S.append s1 s2))
(S.append (le_of_uint32 (S.head s1)) (le_of_seq_uint32 (S.append (S.tail s1) s2))));
le_of_seq_uint32_append (S.tail s1) s2) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"FStar.Seq.Base.seq",
"FStar.UInt32.t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.append",
"FStar.UInt8.t",
"FStar.Endianness.le_of_seq_uint32",
"FStar.Seq.Base.empty",
"Prims.bool",
"FStar.Endianness.le_of_seq_uint32_append",
"FStar.Seq.Properties.tail",
"FStar.Endianness.le_of_uint32",
"FStar.Seq.Properties.head",
"FStar.Seq.Properties.cons",
"FStar.Classical.forall_intro_2",
"FStar.Endianness.tail_cons"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl)
let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s))
let rec seq_uint64_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl)
let rec be_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint64 (S.head s)) (be_of_seq_uint64 (S.tail s))
/// Pure indexing & update over sequences
/// -------------------------------------
#set-options "--max_fuel 1 --max_ifuel 0 --z3rlimit 50"
let rec offset_uint32_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_be tl (n - 1) (i - 1)
let rec offset_uint32_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_le tl (n - 1) (i - 1)
let rec offset_uint64_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_be tl (n - 1) (i - 1)
let rec offset_uint64_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_le tl (n - 1) (i - 1)
/// Appending and slicing sequences of integers
/// -------------------------------------------
#set-options "--max_fuel 1 --z3rlimit 20"
(* TODO: move to FStar.Seq.Properties, with the pattern *)
let tail_cons (#a: Type) (hd: a) (tl: S.seq a): Lemma
(ensures (S.equal (S.tail (S.cons hd tl)) tl))
// [ SMTPat (S.tail (S.cons hd tl)) ]
=
()
let be_of_seq_uint32_base s1 s2 = ()
let le_of_seq_uint32_base s1 s2 = ()
let be_of_seq_uint64_base s1 s2 = ()
let rec be_of_seq_uint32_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U32.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (be_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (be_of_seq_uint32 (S.append s1 s2))
(S.append (be_of_uint32 (S.head s1)) (be_of_seq_uint32 (S.append (S.tail s1) s2))));
be_of_seq_uint32_append (S.tail s1) s2
end | false | false | FStar.Endianness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val le_of_seq_uint32_append (s1 s2: S.seq U32.t): Lemma
(ensures (
S.equal (le_of_seq_uint32 (S.append s1 s2))
(S.append (le_of_seq_uint32 s1) (le_of_seq_uint32 s2))))
(decreases (
S.length s1))
[ SMTPat (S.append (le_of_seq_uint32 s1) (le_of_seq_uint32 s2)) ] | [
"recursion"
] | FStar.Endianness.le_of_seq_uint32_append | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | s1: FStar.Seq.Base.seq FStar.UInt32.t -> s2: FStar.Seq.Base.seq FStar.UInt32.t
-> FStar.Pervasives.Lemma
(ensures
FStar.Seq.Base.equal (FStar.Endianness.le_of_seq_uint32 (FStar.Seq.Base.append s1 s2))
(FStar.Seq.Base.append (FStar.Endianness.le_of_seq_uint32 s1)
(FStar.Endianness.le_of_seq_uint32 s2)))
(decreases FStar.Seq.Base.length s1)
[
SMTPat (FStar.Seq.Base.append (FStar.Endianness.le_of_seq_uint32 s1)
(FStar.Endianness.le_of_seq_uint32 s2))
] | {
"end_col": 5,
"end_line": 306,
"start_col": 2,
"start_line": 296
} |
FStar.Pervasives.Lemma | val be_of_seq_uint64_append (s1 s2: S.seq U64.t): Lemma
(ensures (
S.equal (be_of_seq_uint64 (S.append s1 s2))
(S.append (be_of_seq_uint64 s1) (be_of_seq_uint64 s2))))
(decreases (
S.length s1))
[ SMTPat (S.append (be_of_seq_uint64 s1) (be_of_seq_uint64 s2)) ] | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec be_of_seq_uint64_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U64.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (be_of_seq_uint64 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (be_of_seq_uint64 (S.append s1 s2))
(S.append (be_of_uint64 (S.head s1)) (be_of_seq_uint64 (S.append (S.tail s1) s2))));
be_of_seq_uint64_append (S.tail s1) s2
end | val be_of_seq_uint64_append (s1 s2: S.seq U64.t): Lemma
(ensures (
S.equal (be_of_seq_uint64 (S.append s1 s2))
(S.append (be_of_seq_uint64 s1) (be_of_seq_uint64 s2))))
(decreases (
S.length s1))
[ SMTPat (S.append (be_of_seq_uint64 s1) (be_of_seq_uint64 s2)) ]
let rec be_of_seq_uint64_append s1 s2 = | false | null | true | Classical.forall_intro_2 (tail_cons #U64.t);
if S.length s1 = 0
then
(assert (S.equal (be_of_seq_uint64 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
())
else
(assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (be_of_seq_uint64 (S.append s1 s2))
(S.append (be_of_uint64 (S.head s1)) (be_of_seq_uint64 (S.append (S.tail s1) s2))));
be_of_seq_uint64_append (S.tail s1) s2) | {
"checked_file": "FStar.Endianness.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "FStar.Endianness.fst"
} | [
"lemma",
""
] | [
"FStar.Seq.Base.seq",
"FStar.UInt64.t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.append",
"FStar.UInt8.t",
"FStar.Endianness.be_of_seq_uint64",
"FStar.Seq.Base.empty",
"Prims.bool",
"FStar.Endianness.be_of_seq_uint64_append",
"FStar.Seq.Properties.tail",
"FStar.Endianness.be_of_uint64",
"FStar.Seq.Properties.head",
"FStar.Seq.Properties.cons",
"FStar.Classical.forall_intro_2",
"FStar.Endianness.tail_cons"
] | [] | module FStar.Endianness
/// A library of lemmas for reasoning about sequences of machine integers and
/// their (little|big)-endian representation as a sequence of bytes.
///
/// The functions in this module aim to be as generic as possible, in order to
/// facilitate compatibility with:
/// - Vale's model of machine integers (nat64 et al.), which does not rely on
/// FStar's machine integers
/// - HACL*'s Lib.IntTypes module, which exposes a universal indexed integer
/// type but uses F* machine integers under the hood.
///
/// To achieve maximum compatibility, we try to state most lemmas using nat
/// rather than UIntX.
///
/// .. note::
///
/// This module supersedes the poorly-named ``FStar.Krml.Endianness``.
module U8 = FStar.UInt8
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
module S = FStar.Seq
open FStar.Mul
/// Definition of little and big-endianness
/// ---------------------------------------
let rec le_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.head b) + pow2 8 * le_to_n (S.tail b)
let rec be_to_n b
: Tot nat (decreases (S.length b))
= if S.length b = 0 then 0
else U8.v (S.last b) + pow2 8 * be_to_n (S.slice b 0 (S.length b - 1))
let reveal_le_to_n _ = ()
let reveal_be_to_n _ = ()
/// Inverse operations
/// ------------------
/// TODO: move to FStar.Math.Lemmas?
private val lemma_euclidean_division: r:nat -> b:nat -> q:pos -> Lemma
(requires (r < q))
(ensures (r + q * b < q * (b+1)))
let lemma_euclidean_division r b q = ()
/// TODO: move to FStar.Math.Lemmas? US spelling?
private val lemma_factorise: a:nat -> b:nat -> Lemma (a + a * b == a * (b + 1))
let lemma_factorise a b = ()
let rec lemma_le_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 1 (Seq.length b) in
assert(Seq.length s = Seq.length b - 1);
lemma_le_to_n_is_bounded s;
assert(UInt8.v (Seq.index b 0) < pow2 8);
assert(le_to_n s < pow2 (8 * Seq.length s));
assert(le_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.index b 0)) (le_to_n s) (pow2 8);
assert(le_to_n b <= pow2 8 * (le_to_n s + 1));
assert(le_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec lemma_be_to_n_is_bounded b =
if Seq.length b = 0 then ()
else
begin
let s = Seq.slice b 0 (Seq.length b - 1) in
assert(Seq.length s = Seq.length b - 1);
lemma_be_to_n_is_bounded s;
assert(UInt8.v (Seq.last b) < pow2 8);
assert(be_to_n s < pow2 (8 * Seq.length s));
assert(be_to_n b < pow2 8 + pow2 8 * pow2 (8 * (Seq.length b - 1)));
lemma_euclidean_division (UInt8.v (Seq.last b)) (be_to_n s) (pow2 8);
assert(be_to_n b <= pow2 8 * (be_to_n s + 1));
assert(be_to_n b <= pow2 8 * pow2 (8 * (Seq.length b - 1)));
Math.Lemmas.pow2_plus 8 (8 * (Seq.length b - 1));
lemma_factorise 8 (Seq.length b - 1)
end
let rec n_to_le len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
assert(n' < pow2 (8 * len ));
let b' = n_to_le len n' in
let b = S.cons byte b' in
S.lemma_eq_intro b' (S.tail b);
b
let rec n_to_be len n =
if len = 0 then
S.empty
else
let len = len - 1 in
let byte = U8.uint_to_t (n % 256) in
let n' = n / 256 in
Math.pow2_plus 8 (8 * len);
let b' = n_to_be len n' in
let b'' = S.create 1 byte in
let b = S.append b' b'' in
S.lemma_eq_intro b' (S.slice b 0 len);
b
/// Injectivity
/// -----------
// this lemma easily follows from le_to_n . (n_to_le len) == id, the inversion
// proof in the spec for n_to_le
let n_to_le_inj len n1 n2 = ()
let n_to_be_inj len n1 n2 = ()
let rec be_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
be_to_n_inj (Seq.slice b1 0 (Seq.length b1 - 1)) (Seq.slice b2 0 (Seq.length b2 - 1));
Seq.lemma_split b1 (Seq.length b1 - 1);
Seq.lemma_split b2 (Seq.length b2 - 1)
end
let rec le_to_n_inj b1 b2 =
if Seq.length b1 = 0
then ()
else begin
le_to_n_inj (Seq.slice b1 1 (Seq.length b1)) (Seq.slice b2 1 (Seq.length b2));
Seq.lemma_split b1 1;
Seq.lemma_split b2 1
end
/// Roundtripping
/// -------------
let n_to_be_be_to_n len s =
lemma_be_to_n_is_bounded s;
be_to_n_inj s (n_to_be len (be_to_n s))
let n_to_le_le_to_n len s =
lemma_le_to_n_is_bounded s;
le_to_n_inj s (n_to_le len (le_to_n s))
/// Reasoning over sequences of integers
/// ------------------------------------
///
/// TODO: should these be sequences of nats instead? then re-use these lemmas to
/// export a variant (which we need for, say, hashes) specialized to F* machine
/// integers?
let rec seq_uint32_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_le hd) (seq_uint32_of_le (l - 1) tl)
let rec le_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint32 (S.head s)) (le_of_seq_uint32 (S.tail s))
let rec seq_uint32_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 4 in
S.cons (uint32_of_be hd) (seq_uint32_of_be (l - 1) tl)
let rec be_of_seq_uint32 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint32 (S.head s)) (be_of_seq_uint32 (S.tail s))
let rec seq_uint64_of_le l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_le hd) (seq_uint64_of_le (l - 1) tl)
let rec le_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (le_of_uint64 (S.head s)) (le_of_seq_uint64 (S.tail s))
let rec seq_uint64_of_be l b =
if S.length b = 0 then
S.empty
else
let hd, tl = Seq.split b 8 in
S.cons (uint64_of_be hd) (seq_uint64_of_be (l - 1) tl)
let rec be_of_seq_uint64 s =
if S.length s = 0 then
S.empty
else
S.append (be_of_uint64 (S.head s)) (be_of_seq_uint64 (S.tail s))
/// Pure indexing & update over sequences
/// -------------------------------------
#set-options "--max_fuel 1 --max_ifuel 0 --z3rlimit 50"
let rec offset_uint32_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_be tl (n - 1) (i - 1)
let rec offset_uint32_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 4 in
if i = 0 then
()
else
offset_uint32_le tl (n - 1) (i - 1)
let rec offset_uint64_be (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_be tl (n - 1) (i - 1)
let rec offset_uint64_le (b: bytes) (n: nat) (i: nat) =
if S.length b = 0 then
false_elim ()
else
let hd, tl = Seq.split b 8 in
if i = 0 then
()
else
offset_uint64_le tl (n - 1) (i - 1)
/// Appending and slicing sequences of integers
/// -------------------------------------------
#set-options "--max_fuel 1 --z3rlimit 20"
(* TODO: move to FStar.Seq.Properties, with the pattern *)
let tail_cons (#a: Type) (hd: a) (tl: S.seq a): Lemma
(ensures (S.equal (S.tail (S.cons hd tl)) tl))
// [ SMTPat (S.tail (S.cons hd tl)) ]
=
()
let be_of_seq_uint32_base s1 s2 = ()
let le_of_seq_uint32_base s1 s2 = ()
let be_of_seq_uint64_base s1 s2 = ()
let rec be_of_seq_uint32_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U32.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (be_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (be_of_seq_uint32 (S.append s1 s2))
(S.append (be_of_uint32 (S.head s1)) (be_of_seq_uint32 (S.append (S.tail s1) s2))));
be_of_seq_uint32_append (S.tail s1) s2
end
let rec le_of_seq_uint32_append s1 s2 =
Classical.forall_intro_2 (tail_cons #U32.t); // TODO: this is a local pattern, remove once tail_cons lands in FStar.Seq.Properties
if S.length s1 = 0 then begin
assert (S.equal (le_of_seq_uint32 s1) S.empty);
assert (S.equal (S.append s1 s2) s2);
()
end else begin
assert (S.equal (S.append s1 s2) (S.cons (S.head s1) (S.append (S.tail s1) s2)));
assert (S.equal (le_of_seq_uint32 (S.append s1 s2))
(S.append (le_of_uint32 (S.head s1)) (le_of_seq_uint32 (S.append (S.tail s1) s2))));
le_of_seq_uint32_append (S.tail s1) s2
end | false | false | FStar.Endianness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val be_of_seq_uint64_append (s1 s2: S.seq U64.t): Lemma
(ensures (
S.equal (be_of_seq_uint64 (S.append s1 s2))
(S.append (be_of_seq_uint64 s1) (be_of_seq_uint64 s2))))
(decreases (
S.length s1))
[ SMTPat (S.append (be_of_seq_uint64 s1) (be_of_seq_uint64 s2)) ] | [
"recursion"
] | FStar.Endianness.be_of_seq_uint64_append | {
"file_name": "ulib/FStar.Endianness.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | s1: FStar.Seq.Base.seq FStar.UInt64.t -> s2: FStar.Seq.Base.seq FStar.UInt64.t
-> FStar.Pervasives.Lemma
(ensures
FStar.Seq.Base.equal (FStar.Endianness.be_of_seq_uint64 (FStar.Seq.Base.append s1 s2))
(FStar.Seq.Base.append (FStar.Endianness.be_of_seq_uint64 s1)
(FStar.Endianness.be_of_seq_uint64 s2)))
(decreases FStar.Seq.Base.length s1)
[
SMTPat (FStar.Seq.Base.append (FStar.Endianness.be_of_seq_uint64 s1)
(FStar.Endianness.be_of_seq_uint64 s2))
] | {
"end_col": 5,
"end_line": 319,
"start_col": 2,
"start_line": 309
} |
Prims.Tot | val seq_equiv (#c:_) (eq:CE.equiv c) : (CE.equiv (seq c)) | [
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"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
}
] | false | let seq_equiv #c (eq: CE.equiv c) =
CE.EQ (eq_of_seq eq) (eq_of_seq_reflexivity eq)
(eq_of_seq_symmetry eq)
(eq_of_seq_transitivity eq) | val seq_equiv (#c:_) (eq:CE.equiv c) : (CE.equiv (seq c))
let seq_equiv #c (eq: CE.equiv c) = | false | null | false | CE.EQ (eq_of_seq eq) (eq_of_seq_reflexivity eq) (eq_of_seq_symmetry eq) (eq_of_seq_transitivity eq) | {
"checked_file": "FStar.Seq.Equiv.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IntegerIntervals.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Algebra.CommMonoid.Equiv.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Seq.Equiv.fst"
} | [
"total"
] | [
"FStar.Algebra.CommMonoid.Equiv.equiv",
"FStar.Algebra.CommMonoid.Equiv.EQ",
"FStar.Seq.Base.seq",
"FStar.Seq.Equiv.eq_of_seq",
"FStar.Seq.Equiv.eq_of_seq_reflexivity",
"FStar.Seq.Equiv.eq_of_seq_symmetry",
"FStar.Seq.Equiv.eq_of_seq_transitivity"
] | [] | (*
Copyright 2022 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.
Author: A. Rozanov
*)
module FStar.Seq.Equiv
module CE = FStar.Algebra.CommMonoid.Equiv
open FStar.Seq.Base
open FStar.Seq.Properties
open FStar.IntegerIntervals
let rec eq_of_seq #c eq s1 s2
: Tot prop (decreases length s1) =
(length s1 = length s2 /\
(length s1 = 0 \/ (
let s1s, s1l = un_snoc s1 in
let s2s, s2l = un_snoc s2 in
eq.eq s1l s2l /\ eq_of_seq eq s1s s2s)))
let rec eq_of_seq_element_equality #c eq s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(decreases length s1) =
if (length s1 > 0) then
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_element_equality eq s1liat s2liat
let rec eq_of_seq_from_element_equality #c eq s1 s2
: Lemma (requires (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(ensures eq_of_seq eq s1 s2)
(decreases length s1) =
if length s1 = 0 then () else
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_from_element_equality eq s1liat s2liat
let eq_of_seq_condition #c eq s1 s2
: Lemma ((length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)) <==>
eq_of_seq eq s1 s2) =
Classical.move_requires_2 (eq_of_seq_element_equality eq) s1 s2;
Classical.move_requires_2 (eq_of_seq_from_element_equality eq) s1 s2
let rec eq_of_seq_reflexivity #c (eq: CE.equiv c) s
: Lemma (ensures eq_of_seq eq s s)
(decreases length s) =
if length s > 0 then
let liat, last = un_snoc s in
eq_of_seq_reflexivity #c eq liat;
eq.reflexivity last
let rec eq_of_seq_symmetry #c (eq: CE.equiv c) s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq_of_seq eq s2 s1)
(decreases length s1) =
if length s1 > 0 then
let lia1, las1 = un_snoc s1 in
let lia2, las2 = un_snoc s2 in
eq_of_seq_symmetry #c eq lia1 lia2;
eq.symmetry las1 las2
let rec eq_of_seq_transitivity #c (eq: CE.equiv c) s1 s2 s3
: Lemma (requires eq_of_seq eq s1 s2 /\ eq_of_seq eq s2 s3)
(ensures eq_of_seq eq s1 s3)
(decreases length s1) =
if length s1 > 0 then
let lia1, las1 = un_snoc s1 in
let lia2, las2 = un_snoc s2 in
let lia3, las3 = un_snoc s3 in
eq_of_seq_transitivity #c eq lia1 lia2 lia3;
eq.transitivity las1 las2 las3 | false | false | FStar.Seq.Equiv.fst | {
"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"
} | null | val seq_equiv (#c:_) (eq:CE.equiv c) : (CE.equiv (seq c)) | [] | FStar.Seq.Equiv.seq_equiv | {
"file_name": "ulib/FStar.Seq.Equiv.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | eq: FStar.Algebra.CommMonoid.Equiv.equiv c
-> FStar.Algebra.CommMonoid.Equiv.equiv (FStar.Seq.Base.seq c) | {
"end_col": 50,
"end_line": 93,
"start_col": 2,
"start_line": 91
} |
Prims.Tot | val eq_of_seq (#c:_) (eq:CE.equiv c) (s1 s2: seq c) : prop | [
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"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
}
] | false | let rec eq_of_seq #c eq s1 s2
: Tot prop (decreases length s1) =
(length s1 = length s2 /\
(length s1 = 0 \/ (
let s1s, s1l = un_snoc s1 in
let s2s, s2l = un_snoc s2 in
eq.eq s1l s2l /\ eq_of_seq eq s1s s2s))) | val eq_of_seq (#c:_) (eq:CE.equiv c) (s1 s2: seq c) : prop
let rec eq_of_seq #c eq s1 s2 : Tot prop (decreases length s1) = | false | null | false | (length s1 = length s2 /\
(length s1 = 0 \/
(let s1s, s1l = un_snoc s1 in
let s2s, s2l = un_snoc s2 in
eq.eq s1l s2l /\ eq_of_seq eq s1s s2s))) | {
"checked_file": "FStar.Seq.Equiv.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IntegerIntervals.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Algebra.CommMonoid.Equiv.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Seq.Equiv.fst"
} | [
"",
"total"
] | [
"FStar.Algebra.CommMonoid.Equiv.equiv",
"FStar.Seq.Base.seq",
"Prims.l_and",
"Prims.b2t",
"Prims.op_Equality",
"Prims.nat",
"FStar.Seq.Base.length",
"Prims.l_or",
"Prims.int",
"FStar.Algebra.CommMonoid.Equiv.__proj__EQ__item__eq",
"FStar.Seq.Equiv.eq_of_seq",
"Prims.logical",
"FStar.Pervasives.Native.tuple2",
"Prims.eq2",
"FStar.Seq.Properties.snoc",
"FStar.Pervasives.Native.fst",
"FStar.Pervasives.Native.snd",
"FStar.Seq.Properties.un_snoc",
"Prims.prop"
] | [] | (*
Copyright 2022 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.
Author: A. Rozanov
*)
module FStar.Seq.Equiv
module CE = FStar.Algebra.CommMonoid.Equiv
open FStar.Seq.Base
open FStar.Seq.Properties
open FStar.IntegerIntervals
let rec eq_of_seq #c eq s1 s2 | false | false | FStar.Seq.Equiv.fst | {
"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"
} | null | val eq_of_seq (#c:_) (eq:CE.equiv c) (s1 s2: seq c) : prop | [
"recursion"
] | FStar.Seq.Equiv.eq_of_seq | {
"file_name": "ulib/FStar.Seq.Equiv.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | eq: FStar.Algebra.CommMonoid.Equiv.equiv c -> s1: FStar.Seq.Base.seq c -> s2: FStar.Seq.Base.seq c
-> Prims.Tot Prims.prop | {
"end_col": 46,
"end_line": 32,
"start_col": 2,
"start_line": 28
} |
FStar.Pervasives.Lemma | val eq_of_seq_reflexivity (#c:_) (eq: CE.equiv c) (s: seq c)
: Lemma (ensures eq_of_seq eq s s) | [
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"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
}
] | false | let rec eq_of_seq_reflexivity #c (eq: CE.equiv c) s
: Lemma (ensures eq_of_seq eq s s)
(decreases length s) =
if length s > 0 then
let liat, last = un_snoc s in
eq_of_seq_reflexivity #c eq liat;
eq.reflexivity last | val eq_of_seq_reflexivity (#c:_) (eq: CE.equiv c) (s: seq c)
: Lemma (ensures eq_of_seq eq s s)
let rec eq_of_seq_reflexivity #c (eq: CE.equiv c) s
: Lemma (ensures eq_of_seq eq s s) (decreases length s) = | false | null | true | if length s > 0
then
let liat, last = un_snoc s in
eq_of_seq_reflexivity #c eq liat;
eq.reflexivity last | {
"checked_file": "FStar.Seq.Equiv.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IntegerIntervals.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Algebra.CommMonoid.Equiv.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Seq.Equiv.fst"
} | [
"",
"lemma"
] | [
"FStar.Algebra.CommMonoid.Equiv.equiv",
"FStar.Seq.Base.seq",
"Prims.op_GreaterThan",
"FStar.Seq.Base.length",
"FStar.Algebra.CommMonoid.Equiv.__proj__EQ__item__reflexivity",
"Prims.unit",
"FStar.Seq.Equiv.eq_of_seq_reflexivity",
"FStar.Pervasives.Native.tuple2",
"Prims.eq2",
"FStar.Seq.Properties.snoc",
"FStar.Pervasives.Native.fst",
"FStar.Pervasives.Native.snd",
"FStar.Seq.Properties.un_snoc",
"Prims.bool",
"Prims.l_True",
"Prims.squash",
"FStar.Seq.Equiv.eq_of_seq",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | (*
Copyright 2022 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.
Author: A. Rozanov
*)
module FStar.Seq.Equiv
module CE = FStar.Algebra.CommMonoid.Equiv
open FStar.Seq.Base
open FStar.Seq.Properties
open FStar.IntegerIntervals
let rec eq_of_seq #c eq s1 s2
: Tot prop (decreases length s1) =
(length s1 = length s2 /\
(length s1 = 0 \/ (
let s1s, s1l = un_snoc s1 in
let s2s, s2l = un_snoc s2 in
eq.eq s1l s2l /\ eq_of_seq eq s1s s2s)))
let rec eq_of_seq_element_equality #c eq s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(decreases length s1) =
if (length s1 > 0) then
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_element_equality eq s1liat s2liat
let rec eq_of_seq_from_element_equality #c eq s1 s2
: Lemma (requires (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(ensures eq_of_seq eq s1 s2)
(decreases length s1) =
if length s1 = 0 then () else
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_from_element_equality eq s1liat s2liat
let eq_of_seq_condition #c eq s1 s2
: Lemma ((length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)) <==>
eq_of_seq eq s1 s2) =
Classical.move_requires_2 (eq_of_seq_element_equality eq) s1 s2;
Classical.move_requires_2 (eq_of_seq_from_element_equality eq) s1 s2
let rec eq_of_seq_reflexivity #c (eq: CE.equiv c) s
: Lemma (ensures eq_of_seq eq s s) | false | false | FStar.Seq.Equiv.fst | {
"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"
} | null | val eq_of_seq_reflexivity (#c:_) (eq: CE.equiv c) (s: seq c)
: Lemma (ensures eq_of_seq eq s s) | [
"recursion"
] | FStar.Seq.Equiv.eq_of_seq_reflexivity | {
"file_name": "ulib/FStar.Seq.Equiv.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | eq: FStar.Algebra.CommMonoid.Equiv.equiv c -> s: FStar.Seq.Base.seq c
-> FStar.Pervasives.Lemma (ensures FStar.Seq.Equiv.eq_of_seq eq s s)
(decreases FStar.Seq.Base.length s) | {
"end_col": 21,
"end_line": 67,
"start_col": 2,
"start_line": 64
} |
FStar.Pervasives.Lemma | val eq_of_seq_symmetry (#c:_) (eq: CE.equiv c) (s1 s2: seq c)
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq_of_seq eq s2 s1) | [
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"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
}
] | false | let rec eq_of_seq_symmetry #c (eq: CE.equiv c) s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq_of_seq eq s2 s1)
(decreases length s1) =
if length s1 > 0 then
let lia1, las1 = un_snoc s1 in
let lia2, las2 = un_snoc s2 in
eq_of_seq_symmetry #c eq lia1 lia2;
eq.symmetry las1 las2 | val eq_of_seq_symmetry (#c:_) (eq: CE.equiv c) (s1 s2: seq c)
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq_of_seq eq s2 s1)
let rec eq_of_seq_symmetry #c (eq: CE.equiv c) s1 s2
: Lemma (requires eq_of_seq eq s1 s2) (ensures eq_of_seq eq s2 s1) (decreases length s1) = | false | null | true | if length s1 > 0
then
let lia1, las1 = un_snoc s1 in
let lia2, las2 = un_snoc s2 in
eq_of_seq_symmetry #c eq lia1 lia2;
eq.symmetry las1 las2 | {
"checked_file": "FStar.Seq.Equiv.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IntegerIntervals.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Algebra.CommMonoid.Equiv.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Seq.Equiv.fst"
} | [
"",
"lemma"
] | [
"FStar.Algebra.CommMonoid.Equiv.equiv",
"FStar.Seq.Base.seq",
"Prims.op_GreaterThan",
"FStar.Seq.Base.length",
"FStar.Algebra.CommMonoid.Equiv.__proj__EQ__item__symmetry",
"Prims.unit",
"FStar.Seq.Equiv.eq_of_seq_symmetry",
"FStar.Pervasives.Native.tuple2",
"Prims.eq2",
"FStar.Seq.Properties.snoc",
"FStar.Pervasives.Native.fst",
"FStar.Pervasives.Native.snd",
"FStar.Seq.Properties.un_snoc",
"Prims.bool",
"FStar.Seq.Equiv.eq_of_seq",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | (*
Copyright 2022 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.
Author: A. Rozanov
*)
module FStar.Seq.Equiv
module CE = FStar.Algebra.CommMonoid.Equiv
open FStar.Seq.Base
open FStar.Seq.Properties
open FStar.IntegerIntervals
let rec eq_of_seq #c eq s1 s2
: Tot prop (decreases length s1) =
(length s1 = length s2 /\
(length s1 = 0 \/ (
let s1s, s1l = un_snoc s1 in
let s2s, s2l = un_snoc s2 in
eq.eq s1l s2l /\ eq_of_seq eq s1s s2s)))
let rec eq_of_seq_element_equality #c eq s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(decreases length s1) =
if (length s1 > 0) then
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_element_equality eq s1liat s2liat
let rec eq_of_seq_from_element_equality #c eq s1 s2
: Lemma (requires (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(ensures eq_of_seq eq s1 s2)
(decreases length s1) =
if length s1 = 0 then () else
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_from_element_equality eq s1liat s2liat
let eq_of_seq_condition #c eq s1 s2
: Lemma ((length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)) <==>
eq_of_seq eq s1 s2) =
Classical.move_requires_2 (eq_of_seq_element_equality eq) s1 s2;
Classical.move_requires_2 (eq_of_seq_from_element_equality eq) s1 s2
let rec eq_of_seq_reflexivity #c (eq: CE.equiv c) s
: Lemma (ensures eq_of_seq eq s s)
(decreases length s) =
if length s > 0 then
let liat, last = un_snoc s in
eq_of_seq_reflexivity #c eq liat;
eq.reflexivity last
let rec eq_of_seq_symmetry #c (eq: CE.equiv c) s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq_of_seq eq s2 s1) | false | false | FStar.Seq.Equiv.fst | {
"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"
} | null | val eq_of_seq_symmetry (#c:_) (eq: CE.equiv c) (s1 s2: seq c)
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq_of_seq eq s2 s1) | [
"recursion"
] | FStar.Seq.Equiv.eq_of_seq_symmetry | {
"file_name": "ulib/FStar.Seq.Equiv.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | eq: FStar.Algebra.CommMonoid.Equiv.equiv c -> s1: FStar.Seq.Base.seq c -> s2: FStar.Seq.Base.seq c
-> FStar.Pervasives.Lemma (requires FStar.Seq.Equiv.eq_of_seq eq s1 s2)
(ensures FStar.Seq.Equiv.eq_of_seq eq s2 s1)
(decreases FStar.Seq.Base.length s1) | {
"end_col": 23,
"end_line": 77,
"start_col": 2,
"start_line": 73
} |
FStar.Pervasives.Lemma | val eq_of_seq_transitivity (#c:_) (eq: CE.equiv c) (s1 s2 s3: seq c)
: Lemma (requires eq_of_seq eq s1 s2 /\ eq_of_seq eq s2 s3)
(ensures eq_of_seq eq s1 s3) | [
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"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
}
] | false | let rec eq_of_seq_transitivity #c (eq: CE.equiv c) s1 s2 s3
: Lemma (requires eq_of_seq eq s1 s2 /\ eq_of_seq eq s2 s3)
(ensures eq_of_seq eq s1 s3)
(decreases length s1) =
if length s1 > 0 then
let lia1, las1 = un_snoc s1 in
let lia2, las2 = un_snoc s2 in
let lia3, las3 = un_snoc s3 in
eq_of_seq_transitivity #c eq lia1 lia2 lia3;
eq.transitivity las1 las2 las3 | val eq_of_seq_transitivity (#c:_) (eq: CE.equiv c) (s1 s2 s3: seq c)
: Lemma (requires eq_of_seq eq s1 s2 /\ eq_of_seq eq s2 s3)
(ensures eq_of_seq eq s1 s3)
let rec eq_of_seq_transitivity #c (eq: CE.equiv c) s1 s2 s3
: Lemma (requires eq_of_seq eq s1 s2 /\ eq_of_seq eq s2 s3)
(ensures eq_of_seq eq s1 s3)
(decreases length s1) = | false | null | true | if length s1 > 0
then
let lia1, las1 = un_snoc s1 in
let lia2, las2 = un_snoc s2 in
let lia3, las3 = un_snoc s3 in
eq_of_seq_transitivity #c eq lia1 lia2 lia3;
eq.transitivity las1 las2 las3 | {
"checked_file": "FStar.Seq.Equiv.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IntegerIntervals.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Algebra.CommMonoid.Equiv.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Seq.Equiv.fst"
} | [
"",
"lemma"
] | [
"FStar.Algebra.CommMonoid.Equiv.equiv",
"FStar.Seq.Base.seq",
"Prims.op_GreaterThan",
"FStar.Seq.Base.length",
"FStar.Algebra.CommMonoid.Equiv.__proj__EQ__item__transitivity",
"Prims.unit",
"FStar.Seq.Equiv.eq_of_seq_transitivity",
"FStar.Pervasives.Native.tuple2",
"Prims.eq2",
"FStar.Seq.Properties.snoc",
"FStar.Pervasives.Native.fst",
"FStar.Pervasives.Native.snd",
"FStar.Seq.Properties.un_snoc",
"Prims.bool",
"Prims.l_and",
"FStar.Seq.Equiv.eq_of_seq",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | (*
Copyright 2022 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.
Author: A. Rozanov
*)
module FStar.Seq.Equiv
module CE = FStar.Algebra.CommMonoid.Equiv
open FStar.Seq.Base
open FStar.Seq.Properties
open FStar.IntegerIntervals
let rec eq_of_seq #c eq s1 s2
: Tot prop (decreases length s1) =
(length s1 = length s2 /\
(length s1 = 0 \/ (
let s1s, s1l = un_snoc s1 in
let s2s, s2l = un_snoc s2 in
eq.eq s1l s2l /\ eq_of_seq eq s1s s2s)))
let rec eq_of_seq_element_equality #c eq s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(decreases length s1) =
if (length s1 > 0) then
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_element_equality eq s1liat s2liat
let rec eq_of_seq_from_element_equality #c eq s1 s2
: Lemma (requires (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(ensures eq_of_seq eq s1 s2)
(decreases length s1) =
if length s1 = 0 then () else
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_from_element_equality eq s1liat s2liat
let eq_of_seq_condition #c eq s1 s2
: Lemma ((length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)) <==>
eq_of_seq eq s1 s2) =
Classical.move_requires_2 (eq_of_seq_element_equality eq) s1 s2;
Classical.move_requires_2 (eq_of_seq_from_element_equality eq) s1 s2
let rec eq_of_seq_reflexivity #c (eq: CE.equiv c) s
: Lemma (ensures eq_of_seq eq s s)
(decreases length s) =
if length s > 0 then
let liat, last = un_snoc s in
eq_of_seq_reflexivity #c eq liat;
eq.reflexivity last
let rec eq_of_seq_symmetry #c (eq: CE.equiv c) s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq_of_seq eq s2 s1)
(decreases length s1) =
if length s1 > 0 then
let lia1, las1 = un_snoc s1 in
let lia2, las2 = un_snoc s2 in
eq_of_seq_symmetry #c eq lia1 lia2;
eq.symmetry las1 las2
let rec eq_of_seq_transitivity #c (eq: CE.equiv c) s1 s2 s3
: Lemma (requires eq_of_seq eq s1 s2 /\ eq_of_seq eq s2 s3)
(ensures eq_of_seq eq s1 s3) | false | false | FStar.Seq.Equiv.fst | {
"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"
} | null | val eq_of_seq_transitivity (#c:_) (eq: CE.equiv c) (s1 s2 s3: seq c)
: Lemma (requires eq_of_seq eq s1 s2 /\ eq_of_seq eq s2 s3)
(ensures eq_of_seq eq s1 s3) | [
"recursion"
] | FStar.Seq.Equiv.eq_of_seq_transitivity | {
"file_name": "ulib/FStar.Seq.Equiv.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} |
eq: FStar.Algebra.CommMonoid.Equiv.equiv c ->
s1: FStar.Seq.Base.seq c ->
s2: FStar.Seq.Base.seq c ->
s3: FStar.Seq.Base.seq c
-> FStar.Pervasives.Lemma
(requires FStar.Seq.Equiv.eq_of_seq eq s1 s2 /\ FStar.Seq.Equiv.eq_of_seq eq s2 s3)
(ensures FStar.Seq.Equiv.eq_of_seq eq s1 s3)
(decreases FStar.Seq.Base.length s1) | {
"end_col": 32,
"end_line": 88,
"start_col": 2,
"start_line": 83
} |
FStar.Pervasives.Lemma | val eq_of_seq_condition (#c:_) (eq: CE.equiv c) (s1 s2: seq c)
: Lemma ((length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)) <==>
eq_of_seq eq s1 s2) | [
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"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
}
] | false | let eq_of_seq_condition #c eq s1 s2
: Lemma ((length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)) <==>
eq_of_seq eq s1 s2) =
Classical.move_requires_2 (eq_of_seq_element_equality eq) s1 s2;
Classical.move_requires_2 (eq_of_seq_from_element_equality eq) s1 s2 | val eq_of_seq_condition (#c:_) (eq: CE.equiv c) (s1 s2: seq c)
: Lemma ((length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)) <==>
eq_of_seq eq s1 s2)
let eq_of_seq_condition #c eq s1 s2
: Lemma
((length s1 = length s2) /\ (forall (i: under (length s1)). ((index s1 i) `eq.eq` (index s2 i))) <==>
eq_of_seq eq s1 s2) = | false | null | true | Classical.move_requires_2 (eq_of_seq_element_equality eq) s1 s2;
Classical.move_requires_2 (eq_of_seq_from_element_equality eq) s1 s2 | {
"checked_file": "FStar.Seq.Equiv.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IntegerIntervals.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Algebra.CommMonoid.Equiv.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Seq.Equiv.fst"
} | [
"lemma"
] | [
"FStar.Algebra.CommMonoid.Equiv.equiv",
"FStar.Seq.Base.seq",
"FStar.Classical.move_requires_2",
"Prims.l_and",
"Prims.b2t",
"Prims.op_Equality",
"Prims.nat",
"FStar.Seq.Base.length",
"Prims.l_Forall",
"FStar.IntegerIntervals.under",
"FStar.Algebra.CommMonoid.Equiv.__proj__EQ__item__eq",
"FStar.Seq.Base.index",
"FStar.Seq.Equiv.eq_of_seq",
"FStar.Seq.Equiv.eq_of_seq_from_element_equality",
"Prims.unit",
"FStar.Seq.Equiv.eq_of_seq_element_equality",
"Prims.l_True",
"Prims.squash",
"Prims.l_iff",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | (*
Copyright 2022 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.
Author: A. Rozanov
*)
module FStar.Seq.Equiv
module CE = FStar.Algebra.CommMonoid.Equiv
open FStar.Seq.Base
open FStar.Seq.Properties
open FStar.IntegerIntervals
let rec eq_of_seq #c eq s1 s2
: Tot prop (decreases length s1) =
(length s1 = length s2 /\
(length s1 = 0 \/ (
let s1s, s1l = un_snoc s1 in
let s2s, s2l = un_snoc s2 in
eq.eq s1l s2l /\ eq_of_seq eq s1s s2s)))
let rec eq_of_seq_element_equality #c eq s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(decreases length s1) =
if (length s1 > 0) then
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_element_equality eq s1liat s2liat
let rec eq_of_seq_from_element_equality #c eq s1 s2
: Lemma (requires (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(ensures eq_of_seq eq s1 s2)
(decreases length s1) =
if length s1 = 0 then () else
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_from_element_equality eq s1liat s2liat
let eq_of_seq_condition #c eq s1 s2
: Lemma ((length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)) <==> | false | false | FStar.Seq.Equiv.fst | {
"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"
} | null | val eq_of_seq_condition (#c:_) (eq: CE.equiv c) (s1 s2: seq c)
: Lemma ((length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)) <==>
eq_of_seq eq s1 s2) | [] | FStar.Seq.Equiv.eq_of_seq_condition | {
"file_name": "ulib/FStar.Seq.Equiv.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | eq: FStar.Algebra.CommMonoid.Equiv.equiv c -> s1: FStar.Seq.Base.seq c -> s2: FStar.Seq.Base.seq c
-> FStar.Pervasives.Lemma
(ensures
FStar.Seq.Base.length s1 = FStar.Seq.Base.length s2 /\
(forall (i: FStar.IntegerIntervals.under (FStar.Seq.Base.length s1)).
EQ?.eq eq (FStar.Seq.Base.index s1 i) (FStar.Seq.Base.index s2 i)) <==>
FStar.Seq.Equiv.eq_of_seq eq s1 s2) | {
"end_col": 70,
"end_line": 59,
"start_col": 2,
"start_line": 58
} |
FStar.Pervasives.Lemma | val eq_of_seq_unsnoc (#c:_) (eq:CE.equiv c) (m:pos) (s1 s2: (z:seq c{length z==m}))
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq.eq (snd (un_snoc s1)) (snd (un_snoc s2)) /\
eq_of_seq eq (fst (un_snoc s1)) (fst (un_snoc s2))) | [
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"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
}
] | false | let eq_of_seq_unsnoc #c eq m (s1 s2: (z:seq c{length z==m}))
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq.eq (snd (un_snoc s1)) (snd (un_snoc s2)) /\
eq_of_seq eq (fst (un_snoc s1)) (fst (un_snoc s2))) =
eq_of_seq_element_equality eq s1 s2;
eq_of_seq_from_element_equality eq (fst (un_snoc s1)) (fst (un_snoc s2)) | val eq_of_seq_unsnoc (#c:_) (eq:CE.equiv c) (m:pos) (s1 s2: (z:seq c{length z==m}))
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq.eq (snd (un_snoc s1)) (snd (un_snoc s2)) /\
eq_of_seq eq (fst (un_snoc s1)) (fst (un_snoc s2)))
let eq_of_seq_unsnoc #c eq m (s1: (z: seq c {length z == m})) (s2: (z: seq c {length z == m}))
: Lemma (requires eq_of_seq eq s1 s2)
(ensures
eq.eq (snd (un_snoc s1)) (snd (un_snoc s2)) /\
eq_of_seq eq (fst (un_snoc s1)) (fst (un_snoc s2))) = | false | null | true | eq_of_seq_element_equality eq s1 s2;
eq_of_seq_from_element_equality eq (fst (un_snoc s1)) (fst (un_snoc s2)) | {
"checked_file": "FStar.Seq.Equiv.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IntegerIntervals.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Algebra.CommMonoid.Equiv.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Seq.Equiv.fst"
} | [
"lemma"
] | [
"FStar.Algebra.CommMonoid.Equiv.equiv",
"Prims.pos",
"FStar.Seq.Base.seq",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"Prims.op_GreaterThan",
"FStar.Seq.Base.length",
"FStar.Seq.Equiv.eq_of_seq_from_element_equality",
"FStar.Pervasives.Native.fst",
"FStar.Seq.Properties.un_snoc",
"Prims.unit",
"FStar.Seq.Equiv.eq_of_seq_element_equality",
"FStar.Seq.Equiv.eq_of_seq",
"Prims.squash",
"Prims.l_and",
"FStar.Algebra.CommMonoid.Equiv.__proj__EQ__item__eq",
"FStar.Pervasives.Native.snd",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | (*
Copyright 2022 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.
Author: A. Rozanov
*)
module FStar.Seq.Equiv
module CE = FStar.Algebra.CommMonoid.Equiv
open FStar.Seq.Base
open FStar.Seq.Properties
open FStar.IntegerIntervals
let rec eq_of_seq #c eq s1 s2
: Tot prop (decreases length s1) =
(length s1 = length s2 /\
(length s1 = 0 \/ (
let s1s, s1l = un_snoc s1 in
let s2s, s2l = un_snoc s2 in
eq.eq s1l s2l /\ eq_of_seq eq s1s s2s)))
let rec eq_of_seq_element_equality #c eq s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(decreases length s1) =
if (length s1 > 0) then
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_element_equality eq s1liat s2liat
let rec eq_of_seq_from_element_equality #c eq s1 s2
: Lemma (requires (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(ensures eq_of_seq eq s1 s2)
(decreases length s1) =
if length s1 = 0 then () else
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_from_element_equality eq s1liat s2liat
let eq_of_seq_condition #c eq s1 s2
: Lemma ((length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)) <==>
eq_of_seq eq s1 s2) =
Classical.move_requires_2 (eq_of_seq_element_equality eq) s1 s2;
Classical.move_requires_2 (eq_of_seq_from_element_equality eq) s1 s2
let rec eq_of_seq_reflexivity #c (eq: CE.equiv c) s
: Lemma (ensures eq_of_seq eq s s)
(decreases length s) =
if length s > 0 then
let liat, last = un_snoc s in
eq_of_seq_reflexivity #c eq liat;
eq.reflexivity last
let rec eq_of_seq_symmetry #c (eq: CE.equiv c) s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq_of_seq eq s2 s1)
(decreases length s1) =
if length s1 > 0 then
let lia1, las1 = un_snoc s1 in
let lia2, las2 = un_snoc s2 in
eq_of_seq_symmetry #c eq lia1 lia2;
eq.symmetry las1 las2
let rec eq_of_seq_transitivity #c (eq: CE.equiv c) s1 s2 s3
: Lemma (requires eq_of_seq eq s1 s2 /\ eq_of_seq eq s2 s3)
(ensures eq_of_seq eq s1 s3)
(decreases length s1) =
if length s1 > 0 then
let lia1, las1 = un_snoc s1 in
let lia2, las2 = un_snoc s2 in
let lia3, las3 = un_snoc s3 in
eq_of_seq_transitivity #c eq lia1 lia2 lia3;
eq.transitivity las1 las2 las3
let seq_equiv #c (eq: CE.equiv c) =
CE.EQ (eq_of_seq eq) (eq_of_seq_reflexivity eq)
(eq_of_seq_symmetry eq)
(eq_of_seq_transitivity eq)
let eq_of_seq_unsnoc #c eq m (s1 s2: (z:seq c{length z==m}))
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq.eq (snd (un_snoc s1)) (snd (un_snoc s2)) /\ | false | false | FStar.Seq.Equiv.fst | {
"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"
} | null | val eq_of_seq_unsnoc (#c:_) (eq:CE.equiv c) (m:pos) (s1 s2: (z:seq c{length z==m}))
: Lemma (requires eq_of_seq eq s1 s2)
(ensures eq.eq (snd (un_snoc s1)) (snd (un_snoc s2)) /\
eq_of_seq eq (fst (un_snoc s1)) (fst (un_snoc s2))) | [] | FStar.Seq.Equiv.eq_of_seq_unsnoc | {
"file_name": "ulib/FStar.Seq.Equiv.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} |
eq: FStar.Algebra.CommMonoid.Equiv.equiv c ->
m: Prims.pos ->
s1: z: FStar.Seq.Base.seq c {FStar.Seq.Base.length z == m} ->
s2: z: FStar.Seq.Base.seq c {FStar.Seq.Base.length z == m}
-> FStar.Pervasives.Lemma (requires FStar.Seq.Equiv.eq_of_seq eq s1 s2)
(ensures
EQ?.eq eq
(FStar.Pervasives.Native.snd (FStar.Seq.Properties.un_snoc s1))
(FStar.Pervasives.Native.snd (FStar.Seq.Properties.un_snoc s2)) /\
FStar.Seq.Equiv.eq_of_seq eq
(FStar.Pervasives.Native.fst (FStar.Seq.Properties.un_snoc s1))
(FStar.Pervasives.Native.fst (FStar.Seq.Properties.un_snoc s2))) | {
"end_col": 74,
"end_line": 100,
"start_col": 2,
"start_line": 99
} |
FStar.Pervasives.Lemma | val eq_of_seq_from_element_equality (#c:_) (eq: CE.equiv c) (s1 s2: seq c)
: Lemma (requires (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(ensures eq_of_seq eq s1 s2) | [
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"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
}
] | false | let rec eq_of_seq_from_element_equality #c eq s1 s2
: Lemma (requires (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(ensures eq_of_seq eq s1 s2)
(decreases length s1) =
if length s1 = 0 then () else
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_from_element_equality eq s1liat s2liat | val eq_of_seq_from_element_equality (#c:_) (eq: CE.equiv c) (s1 s2: seq c)
: Lemma (requires (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(ensures eq_of_seq eq s1 s2)
let rec eq_of_seq_from_element_equality #c eq s1 s2
: Lemma
(requires
(length s1 = length s2) /\
(forall (i: under (length s1)). ((index s1 i) `eq.eq` (index s2 i))))
(ensures eq_of_seq eq s1 s2)
(decreases length s1) = | false | null | true | if length s1 = 0
then ()
else
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_from_element_equality eq s1liat s2liat | {
"checked_file": "FStar.Seq.Equiv.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IntegerIntervals.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Algebra.CommMonoid.Equiv.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Seq.Equiv.fst"
} | [
"",
"lemma"
] | [
"FStar.Algebra.CommMonoid.Equiv.equiv",
"FStar.Seq.Base.seq",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.bool",
"FStar.Seq.Equiv.eq_of_seq_from_element_equality",
"Prims.unit",
"FStar.Pervasives.Native.tuple2",
"Prims.eq2",
"FStar.Seq.Properties.snoc",
"FStar.Pervasives.Native.fst",
"FStar.Pervasives.Native.snd",
"FStar.Seq.Properties.un_snoc",
"Prims.l_and",
"Prims.b2t",
"Prims.nat",
"Prims.l_Forall",
"FStar.IntegerIntervals.under",
"FStar.Algebra.CommMonoid.Equiv.__proj__EQ__item__eq",
"FStar.Seq.Base.index",
"Prims.squash",
"FStar.Seq.Equiv.eq_of_seq",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | (*
Copyright 2022 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.
Author: A. Rozanov
*)
module FStar.Seq.Equiv
module CE = FStar.Algebra.CommMonoid.Equiv
open FStar.Seq.Base
open FStar.Seq.Properties
open FStar.IntegerIntervals
let rec eq_of_seq #c eq s1 s2
: Tot prop (decreases length s1) =
(length s1 = length s2 /\
(length s1 = 0 \/ (
let s1s, s1l = un_snoc s1 in
let s2s, s2l = un_snoc s2 in
eq.eq s1l s2l /\ eq_of_seq eq s1s s2s)))
let rec eq_of_seq_element_equality #c eq s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(decreases length s1) =
if (length s1 > 0) then
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_element_equality eq s1liat s2liat
let rec eq_of_seq_from_element_equality #c eq s1 s2
: Lemma (requires (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(ensures eq_of_seq eq s1 s2) | false | false | FStar.Seq.Equiv.fst | {
"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"
} | null | val eq_of_seq_from_element_equality (#c:_) (eq: CE.equiv c) (s1 s2: seq c)
: Lemma (requires (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(ensures eq_of_seq eq s1 s2) | [
"recursion"
] | FStar.Seq.Equiv.eq_of_seq_from_element_equality | {
"file_name": "ulib/FStar.Seq.Equiv.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | eq: FStar.Algebra.CommMonoid.Equiv.equiv c -> s1: FStar.Seq.Base.seq c -> s2: FStar.Seq.Base.seq c
-> FStar.Pervasives.Lemma
(requires
FStar.Seq.Base.length s1 = FStar.Seq.Base.length s2 /\
(forall (i: FStar.IntegerIntervals.under (FStar.Seq.Base.length s1)).
EQ?.eq eq (FStar.Seq.Base.index s1 i) (FStar.Seq.Base.index s2 i)))
(ensures FStar.Seq.Equiv.eq_of_seq eq s1 s2)
(decreases FStar.Seq.Base.length s1) | {
"end_col": 50,
"end_line": 52,
"start_col": 2,
"start_line": 49
} |
FStar.Pervasives.Lemma | val eq_of_seq_element_equality (#c:_) (eq: CE.equiv c) (s1 s2: seq c)
: Lemma (requires eq_of_seq eq s1 s2)
(ensures length s1 = length s2 /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i))) | [
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.IntegerIntervals",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Properties",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Algebra.CommMonoid.Equiv",
"short_module": "CE"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"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
}
] | false | let rec eq_of_seq_element_equality #c eq s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
(decreases length s1) =
if (length s1 > 0) then
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_element_equality eq s1liat s2liat | val eq_of_seq_element_equality (#c:_) (eq: CE.equiv c) (s1 s2: seq c)
: Lemma (requires eq_of_seq eq s1 s2)
(ensures length s1 = length s2 /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i)))
let rec eq_of_seq_element_equality #c eq s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures
(length s1 = length s2) /\
(forall (i: under (length s1)). ((index s1 i) `eq.eq` (index s2 i))))
(decreases length s1) = | false | null | true | if (length s1 > 0)
then
let s1liat, s1last = un_snoc s1 in
let s2liat, s2last = un_snoc s2 in
eq_of_seq_element_equality eq s1liat s2liat | {
"checked_file": "FStar.Seq.Equiv.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IntegerIntervals.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Algebra.CommMonoid.Equiv.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Seq.Equiv.fst"
} | [
"",
"lemma"
] | [
"FStar.Algebra.CommMonoid.Equiv.equiv",
"FStar.Seq.Base.seq",
"Prims.op_GreaterThan",
"FStar.Seq.Base.length",
"FStar.Seq.Equiv.eq_of_seq_element_equality",
"Prims.unit",
"FStar.Pervasives.Native.tuple2",
"Prims.eq2",
"FStar.Seq.Properties.snoc",
"FStar.Pervasives.Native.fst",
"FStar.Pervasives.Native.snd",
"FStar.Seq.Properties.un_snoc",
"Prims.bool",
"FStar.Seq.Equiv.eq_of_seq",
"Prims.squash",
"Prims.l_and",
"Prims.b2t",
"Prims.op_Equality",
"Prims.nat",
"Prims.l_Forall",
"FStar.IntegerIntervals.under",
"FStar.Algebra.CommMonoid.Equiv.__proj__EQ__item__eq",
"FStar.Seq.Base.index",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | (*
Copyright 2022 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.
Author: A. Rozanov
*)
module FStar.Seq.Equiv
module CE = FStar.Algebra.CommMonoid.Equiv
open FStar.Seq.Base
open FStar.Seq.Properties
open FStar.IntegerIntervals
let rec eq_of_seq #c eq s1 s2
: Tot prop (decreases length s1) =
(length s1 = length s2 /\
(length s1 = 0 \/ (
let s1s, s1l = un_snoc s1 in
let s2s, s2l = un_snoc s2 in
eq.eq s1l s2l /\ eq_of_seq eq s1s s2s)))
let rec eq_of_seq_element_equality #c eq s1 s2
: Lemma (requires eq_of_seq eq s1 s2)
(ensures (length s1 = length s2) /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i))) | false | false | FStar.Seq.Equiv.fst | {
"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"
} | null | val eq_of_seq_element_equality (#c:_) (eq: CE.equiv c) (s1 s2: seq c)
: Lemma (requires eq_of_seq eq s1 s2)
(ensures length s1 = length s2 /\
(forall (i: under (length s1)). (index s1 i `eq.eq` index s2 i))) | [
"recursion"
] | FStar.Seq.Equiv.eq_of_seq_element_equality | {
"file_name": "ulib/FStar.Seq.Equiv.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | eq: FStar.Algebra.CommMonoid.Equiv.equiv c -> s1: FStar.Seq.Base.seq c -> s2: FStar.Seq.Base.seq c
-> FStar.Pervasives.Lemma (requires FStar.Seq.Equiv.eq_of_seq eq s1 s2)
(ensures
FStar.Seq.Base.length s1 = FStar.Seq.Base.length s2 /\
(forall (i: FStar.IntegerIntervals.under (FStar.Seq.Base.length s1)).
EQ?.eq eq (FStar.Seq.Base.index s1 i) (FStar.Seq.Base.index s2 i)))
(decreases FStar.Seq.Base.length s1) | {
"end_col": 45,
"end_line": 42,
"start_col": 2,
"start_line": 39
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let uint64_p = B.buffer uint_64 | let uint64_p = | false | null | false | B.buffer uint_64 | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"LowStar.Buffer.buffer",
"FStar.Integers.uint_64"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B" | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val uint64_p : Type0 | [] | EverCrypt.Hash.uint64_p | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 31,
"end_line": 43,
"start_col": 15,
"start_line": 43
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false | let is_valid_impl (i: impl) = | false | null | false | let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5 , () |)
| (| SHA1 , () |)
| (| SHA2_224 , () |)
| (| SHA2_256 , () |)
| (| SHA2_384 , () |)
| (| SHA2_512 , () |)
| (| SHA3_224 , () |)
| (| SHA3_256 , () |)
| (| SHA3_384 , () |)
| (| SHA3_512 , () |)
| (| Blake2S , M32 |)
| (| Blake2S , M128 |)
| (| Blake2B , M32 |)
| (| Blake2B , M256 |) -> true
| _ -> false | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"Hacl.Hash.Definitions.impl",
"Prims.dtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Prims.bool"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64 | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val is_valid_impl : i: Hacl.Hash.Definitions.impl -> Prims.bool | [] | EverCrypt.Hash.is_valid_impl | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | i: Hacl.Hash.Definitions.impl -> Prims.bool | {
"end_col": 14,
"end_line": 62,
"start_col": 2,
"start_line": 46
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let impl = i:impl { is_valid_impl i } | let impl = | false | null | false | i: impl{is_valid_impl i} | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"Hacl.Hash.Definitions.impl",
"Prims.b2t",
"EverCrypt.Hash.is_valid_impl"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val impl : Type0 | [] | EverCrypt.Hash.impl | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 37,
"end_line": 64,
"start_col": 11,
"start_line": 64
} |
|
Prims.Tot | val freeable_s: #(a: alg) -> state_s a -> Type0 | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let freeable_s #a s = B.freeable (p #a s) | val freeable_s: #(a: alg) -> state_s a -> Type0
let freeable_s #a s = | false | null | false | B.freeable (p #a s) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"EverCrypt.Hash.alg",
"EverCrypt.Hash.state_s",
"LowStar.Monotonic.Buffer.freeable",
"Hacl.Hash.Definitions.impl_word",
"EverCrypt.Hash.impl_of_state",
"LowStar.Buffer.trivial_preorder",
"EverCrypt.Hash.p"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |)
inline_for_extraction noextract
let sha2_384: impl = (| SHA2_384, () |)
inline_for_extraction noextract
let sha2_512: impl = (| SHA2_512, () |)
inline_for_extraction noextract
let sha3_224: impl = (| SHA3_224, () |)
inline_for_extraction noextract
let sha3_256: impl = (| SHA3_256, () |)
inline_for_extraction noextract
let sha3_384: impl = (| SHA3_384, () |)
inline_for_extraction noextract
let sha3_512: impl = (| SHA3_512, () |)
inline_for_extraction noextract
let blake2s_32: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2s_128: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M128 |)
inline_for_extraction noextract
let blake2b_32: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2b_256: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M256 |)
inline_for_extraction noextract
let alg_of_impl (i: impl { is_valid_impl i }): alg = dfst i
// JP: This is a slightly more complicated case than for AEAD... for AEAD,
// `state_s a = i & kv a & buffer uint8`
// because no matter the /implementation/, the resulting C type for the key is
// always a pointer to bytes. Here, that's no longer true because of Blake2, so
// we need to be a little more verbose.
noeq
type state_s: alg -> Type0 =
| MD5_s: p:Hacl.Hash.Definitions.state (|MD5, ()|) -> state_s MD5
| SHA1_s: p:Hacl.Hash.Definitions.state (|SHA1, ()|) -> state_s SHA1
| SHA2_224_s: p:Hacl.Hash.Definitions.state (|SHA2_224, ()|) -> state_s SHA2_224
| SHA2_256_s: p:Hacl.Hash.Definitions.state (|SHA2_256, ()|) -> state_s SHA2_256
| SHA2_384_s: p:Hacl.Hash.Definitions.state (|SHA2_384, ()|) -> state_s SHA2_384
| SHA2_512_s: p:Hacl.Hash.Definitions.state (|SHA2_512, ()|) -> state_s SHA2_512
| SHA3_224_s: p:Hacl.Hash.Definitions.state (|SHA3_224, ()|) -> state_s SHA3_224
| SHA3_256_s: p:Hacl.Hash.Definitions.state (|SHA3_256, ()|) -> state_s SHA3_256
| SHA3_384_s: p:Hacl.Hash.Definitions.state (|SHA3_384, ()|) -> state_s SHA3_384
| SHA3_512_s: p:Hacl.Hash.Definitions.state (|SHA3_512, ()|) -> state_s SHA3_512
| Blake2S_s: p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2S
| Blake2S_128_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec128 /\
EverCrypt.AutoConfig2.vec128_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M128|) ->
state_s Blake2S
| Blake2B_s: p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2B
| Blake2B_256_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec256 /\
EverCrypt.AutoConfig2.vec256_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M256|) -> state_s Blake2B
let invert_state_s (a: alg): Lemma
(requires True)
(ensures (inversion (state_s a)))
[ SMTPat (state_s a) ]
=
allow_inversion (state_s a)
[@@strict_on_arguments [1]]
inline_for_extraction
let impl_of_state #a (s: state_s a): i:impl { alg_of_impl i == a } =
match s with
| MD5_s _ -> md5
| SHA1_s _ -> sha1
| SHA2_224_s _ -> sha2_224
| SHA2_256_s _ -> sha2_256
| SHA2_384_s _ -> sha2_384
| SHA2_512_s _ -> sha2_512
| SHA3_224_s _ -> sha3_224
| SHA3_256_s _ -> sha3_256
| SHA3_384_s _ -> sha3_384
| SHA3_512_s _ -> sha3_512
| Blake2S_s _ -> blake2s_32
| Blake2S_128_s _ _ -> blake2s_128
| Blake2B_s _ -> blake2b_32
| Blake2B_256_s _ _ -> blake2b_256
// In state_s, the data type already captures what implementation we have... three
// design choices here:
// - turn state_s into a dependent pair of G.erased impl & (SHA2_s | SHA3_s |
// ...) so as not to repeat redundant information at run-time
// - hope that we can get away with returning dependent pairs only when needed.
// We're going for a third one in this module, which is more lightweight.
[@@strict_on_arguments [1]]
inline_for_extraction
let p #a (s: state_s a): Hacl.Hash.Definitions.state (impl_of_state s) =
match s with
| MD5_s p -> p
| SHA1_s p -> p
| SHA2_224_s p -> p
| SHA2_256_s p -> p
| SHA2_384_s p -> p
| SHA2_512_s p -> p
| SHA3_224_s p -> p
| SHA3_256_s p -> p
| SHA3_384_s p -> p
| SHA3_512_s p -> p
| Blake2S_s p -> p
| Blake2S_128_s _ p -> p
| Blake2B_s p -> p
| Blake2B_256_s _ p -> p | false | false | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val freeable_s: #(a: alg) -> state_s a -> Type0 | [] | EverCrypt.Hash.freeable_s | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: EverCrypt.Hash.state_s a -> Type0 | {
"end_col": 41,
"end_line": 178,
"start_col": 22,
"start_line": 178
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let uint32_p = B.buffer uint_32 | let uint32_p = | false | null | false | B.buffer uint_32 | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"LowStar.Buffer.buffer",
"FStar.Integers.uint_32"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B" | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val uint32_p : Type0 | [] | EverCrypt.Hash.uint32_p | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 31,
"end_line": 42,
"start_col": 15,
"start_line": 42
} |
|
FStar.Pervasives.Lemma | val invert_state_s (a: alg)
: Lemma (requires True) (ensures (inversion (state_s a))) [SMTPat (state_s a)] | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let invert_state_s (a: alg): Lemma
(requires True)
(ensures (inversion (state_s a)))
[ SMTPat (state_s a) ]
=
allow_inversion (state_s a) | val invert_state_s (a: alg)
: Lemma (requires True) (ensures (inversion (state_s a))) [SMTPat (state_s a)]
let invert_state_s (a: alg)
: Lemma (requires True) (ensures (inversion (state_s a))) [SMTPat (state_s a)] = | false | null | true | allow_inversion (state_s a) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"lemma"
] | [
"EverCrypt.Hash.alg",
"FStar.Pervasives.allow_inversion",
"EverCrypt.Hash.state_s",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"FStar.Pervasives.inversion",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |)
inline_for_extraction noextract
let sha2_384: impl = (| SHA2_384, () |)
inline_for_extraction noextract
let sha2_512: impl = (| SHA2_512, () |)
inline_for_extraction noextract
let sha3_224: impl = (| SHA3_224, () |)
inline_for_extraction noextract
let sha3_256: impl = (| SHA3_256, () |)
inline_for_extraction noextract
let sha3_384: impl = (| SHA3_384, () |)
inline_for_extraction noextract
let sha3_512: impl = (| SHA3_512, () |)
inline_for_extraction noextract
let blake2s_32: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2s_128: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M128 |)
inline_for_extraction noextract
let blake2b_32: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2b_256: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M256 |)
inline_for_extraction noextract
let alg_of_impl (i: impl { is_valid_impl i }): alg = dfst i
// JP: This is a slightly more complicated case than for AEAD... for AEAD,
// `state_s a = i & kv a & buffer uint8`
// because no matter the /implementation/, the resulting C type for the key is
// always a pointer to bytes. Here, that's no longer true because of Blake2, so
// we need to be a little more verbose.
noeq
type state_s: alg -> Type0 =
| MD5_s: p:Hacl.Hash.Definitions.state (|MD5, ()|) -> state_s MD5
| SHA1_s: p:Hacl.Hash.Definitions.state (|SHA1, ()|) -> state_s SHA1
| SHA2_224_s: p:Hacl.Hash.Definitions.state (|SHA2_224, ()|) -> state_s SHA2_224
| SHA2_256_s: p:Hacl.Hash.Definitions.state (|SHA2_256, ()|) -> state_s SHA2_256
| SHA2_384_s: p:Hacl.Hash.Definitions.state (|SHA2_384, ()|) -> state_s SHA2_384
| SHA2_512_s: p:Hacl.Hash.Definitions.state (|SHA2_512, ()|) -> state_s SHA2_512
| SHA3_224_s: p:Hacl.Hash.Definitions.state (|SHA3_224, ()|) -> state_s SHA3_224
| SHA3_256_s: p:Hacl.Hash.Definitions.state (|SHA3_256, ()|) -> state_s SHA3_256
| SHA3_384_s: p:Hacl.Hash.Definitions.state (|SHA3_384, ()|) -> state_s SHA3_384
| SHA3_512_s: p:Hacl.Hash.Definitions.state (|SHA3_512, ()|) -> state_s SHA3_512
| Blake2S_s: p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2S
| Blake2S_128_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec128 /\
EverCrypt.AutoConfig2.vec128_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M128|) ->
state_s Blake2S
| Blake2B_s: p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2B
| Blake2B_256_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec256 /\
EverCrypt.AutoConfig2.vec256_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M256|) -> state_s Blake2B
let invert_state_s (a: alg): Lemma
(requires True)
(ensures (inversion (state_s a)))
[ SMTPat (state_s a) ] | false | false | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val invert_state_s (a: alg)
: Lemma (requires True) (ensures (inversion (state_s a))) [SMTPat (state_s a)] | [] | EverCrypt.Hash.invert_state_s | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: EverCrypt.Hash.alg
-> FStar.Pervasives.Lemma (ensures FStar.Pervasives.inversion (EverCrypt.Hash.state_s a))
[SMTPat (EverCrypt.Hash.state_s a)] | {
"end_col": 29,
"end_line": 132,
"start_col": 2,
"start_line": 132
} |
Prims.Tot | val invariant_s: (#a:alg) -> state_s a -> HS.mem -> Type0 | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let invariant_s #a (s: state_s a) h =
B.live h (p s) | val invariant_s: (#a:alg) -> state_s a -> HS.mem -> Type0
let invariant_s #a (s: state_s a) h = | false | null | false | B.live h (p s) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"EverCrypt.Hash.alg",
"EverCrypt.Hash.state_s",
"FStar.Monotonic.HyperStack.mem",
"LowStar.Monotonic.Buffer.live",
"Hacl.Hash.Definitions.impl_word",
"EverCrypt.Hash.impl_of_state",
"LowStar.Buffer.trivial_preorder",
"EverCrypt.Hash.p"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |)
inline_for_extraction noextract
let sha2_384: impl = (| SHA2_384, () |)
inline_for_extraction noextract
let sha2_512: impl = (| SHA2_512, () |)
inline_for_extraction noextract
let sha3_224: impl = (| SHA3_224, () |)
inline_for_extraction noextract
let sha3_256: impl = (| SHA3_256, () |)
inline_for_extraction noextract
let sha3_384: impl = (| SHA3_384, () |)
inline_for_extraction noextract
let sha3_512: impl = (| SHA3_512, () |)
inline_for_extraction noextract
let blake2s_32: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2s_128: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M128 |)
inline_for_extraction noextract
let blake2b_32: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2b_256: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M256 |)
inline_for_extraction noextract
let alg_of_impl (i: impl { is_valid_impl i }): alg = dfst i
// JP: This is a slightly more complicated case than for AEAD... for AEAD,
// `state_s a = i & kv a & buffer uint8`
// because no matter the /implementation/, the resulting C type for the key is
// always a pointer to bytes. Here, that's no longer true because of Blake2, so
// we need to be a little more verbose.
noeq
type state_s: alg -> Type0 =
| MD5_s: p:Hacl.Hash.Definitions.state (|MD5, ()|) -> state_s MD5
| SHA1_s: p:Hacl.Hash.Definitions.state (|SHA1, ()|) -> state_s SHA1
| SHA2_224_s: p:Hacl.Hash.Definitions.state (|SHA2_224, ()|) -> state_s SHA2_224
| SHA2_256_s: p:Hacl.Hash.Definitions.state (|SHA2_256, ()|) -> state_s SHA2_256
| SHA2_384_s: p:Hacl.Hash.Definitions.state (|SHA2_384, ()|) -> state_s SHA2_384
| SHA2_512_s: p:Hacl.Hash.Definitions.state (|SHA2_512, ()|) -> state_s SHA2_512
| SHA3_224_s: p:Hacl.Hash.Definitions.state (|SHA3_224, ()|) -> state_s SHA3_224
| SHA3_256_s: p:Hacl.Hash.Definitions.state (|SHA3_256, ()|) -> state_s SHA3_256
| SHA3_384_s: p:Hacl.Hash.Definitions.state (|SHA3_384, ()|) -> state_s SHA3_384
| SHA3_512_s: p:Hacl.Hash.Definitions.state (|SHA3_512, ()|) -> state_s SHA3_512
| Blake2S_s: p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2S
| Blake2S_128_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec128 /\
EverCrypt.AutoConfig2.vec128_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M128|) ->
state_s Blake2S
| Blake2B_s: p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2B
| Blake2B_256_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec256 /\
EverCrypt.AutoConfig2.vec256_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M256|) -> state_s Blake2B
let invert_state_s (a: alg): Lemma
(requires True)
(ensures (inversion (state_s a)))
[ SMTPat (state_s a) ]
=
allow_inversion (state_s a)
[@@strict_on_arguments [1]]
inline_for_extraction
let impl_of_state #a (s: state_s a): i:impl { alg_of_impl i == a } =
match s with
| MD5_s _ -> md5
| SHA1_s _ -> sha1
| SHA2_224_s _ -> sha2_224
| SHA2_256_s _ -> sha2_256
| SHA2_384_s _ -> sha2_384
| SHA2_512_s _ -> sha2_512
| SHA3_224_s _ -> sha3_224
| SHA3_256_s _ -> sha3_256
| SHA3_384_s _ -> sha3_384
| SHA3_512_s _ -> sha3_512
| Blake2S_s _ -> blake2s_32
| Blake2S_128_s _ _ -> blake2s_128
| Blake2B_s _ -> blake2b_32
| Blake2B_256_s _ _ -> blake2b_256
// In state_s, the data type already captures what implementation we have... three
// design choices here:
// - turn state_s into a dependent pair of G.erased impl & (SHA2_s | SHA3_s |
// ...) so as not to repeat redundant information at run-time
// - hope that we can get away with returning dependent pairs only when needed.
// We're going for a third one in this module, which is more lightweight.
[@@strict_on_arguments [1]]
inline_for_extraction
let p #a (s: state_s a): Hacl.Hash.Definitions.state (impl_of_state s) =
match s with
| MD5_s p -> p
| SHA1_s p -> p
| SHA2_224_s p -> p
| SHA2_256_s p -> p
| SHA2_384_s p -> p
| SHA2_512_s p -> p
| SHA3_224_s p -> p
| SHA3_256_s p -> p
| SHA3_384_s p -> p
| SHA3_512_s p -> p
| Blake2S_s p -> p
| Blake2S_128_s _ p -> p
| Blake2B_s p -> p
| Blake2B_256_s _ p -> p
let freeable_s #a s = B.freeable (p #a s)
let footprint_s #a (s: state_s a) =
B.loc_addr_of_buffer (p s) | false | false | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val invariant_s: (#a:alg) -> state_s a -> HS.mem -> Type0 | [] | EverCrypt.Hash.invariant_s | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: EverCrypt.Hash.state_s a -> h: FStar.Monotonic.HyperStack.mem -> Type0 | {
"end_col": 16,
"end_line": 184,
"start_col": 2,
"start_line": 184
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let repr_eq (#a:alg) (r1 r2: Spec.Hash.Definitions.words_state a) =
Seq.equal r1 r2 | let repr_eq (#a: alg) (r1 r2: Spec.Hash.Definitions.words_state a) = | false | null | false | Seq.equal r1 r2 | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"EverCrypt.Hash.alg",
"Spec.Hash.Definitions.words_state",
"FStar.Seq.Base.equal",
"Spec.Hash.Definitions.word",
"Prims.prop"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |)
inline_for_extraction noextract
let sha2_384: impl = (| SHA2_384, () |)
inline_for_extraction noextract
let sha2_512: impl = (| SHA2_512, () |)
inline_for_extraction noextract
let sha3_224: impl = (| SHA3_224, () |)
inline_for_extraction noextract
let sha3_256: impl = (| SHA3_256, () |)
inline_for_extraction noextract
let sha3_384: impl = (| SHA3_384, () |)
inline_for_extraction noextract
let sha3_512: impl = (| SHA3_512, () |)
inline_for_extraction noextract
let blake2s_32: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2s_128: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M128 |)
inline_for_extraction noextract
let blake2b_32: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2b_256: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M256 |)
inline_for_extraction noextract
let alg_of_impl (i: impl { is_valid_impl i }): alg = dfst i
// JP: This is a slightly more complicated case than for AEAD... for AEAD,
// `state_s a = i & kv a & buffer uint8`
// because no matter the /implementation/, the resulting C type for the key is
// always a pointer to bytes. Here, that's no longer true because of Blake2, so
// we need to be a little more verbose.
noeq
type state_s: alg -> Type0 =
| MD5_s: p:Hacl.Hash.Definitions.state (|MD5, ()|) -> state_s MD5
| SHA1_s: p:Hacl.Hash.Definitions.state (|SHA1, ()|) -> state_s SHA1
| SHA2_224_s: p:Hacl.Hash.Definitions.state (|SHA2_224, ()|) -> state_s SHA2_224
| SHA2_256_s: p:Hacl.Hash.Definitions.state (|SHA2_256, ()|) -> state_s SHA2_256
| SHA2_384_s: p:Hacl.Hash.Definitions.state (|SHA2_384, ()|) -> state_s SHA2_384
| SHA2_512_s: p:Hacl.Hash.Definitions.state (|SHA2_512, ()|) -> state_s SHA2_512
| SHA3_224_s: p:Hacl.Hash.Definitions.state (|SHA3_224, ()|) -> state_s SHA3_224
| SHA3_256_s: p:Hacl.Hash.Definitions.state (|SHA3_256, ()|) -> state_s SHA3_256
| SHA3_384_s: p:Hacl.Hash.Definitions.state (|SHA3_384, ()|) -> state_s SHA3_384
| SHA3_512_s: p:Hacl.Hash.Definitions.state (|SHA3_512, ()|) -> state_s SHA3_512
| Blake2S_s: p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2S
| Blake2S_128_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec128 /\
EverCrypt.AutoConfig2.vec128_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M128|) ->
state_s Blake2S
| Blake2B_s: p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2B
| Blake2B_256_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec256 /\
EverCrypt.AutoConfig2.vec256_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M256|) -> state_s Blake2B
let invert_state_s (a: alg): Lemma
(requires True)
(ensures (inversion (state_s a)))
[ SMTPat (state_s a) ]
=
allow_inversion (state_s a)
[@@strict_on_arguments [1]]
inline_for_extraction
let impl_of_state #a (s: state_s a): i:impl { alg_of_impl i == a } =
match s with
| MD5_s _ -> md5
| SHA1_s _ -> sha1
| SHA2_224_s _ -> sha2_224
| SHA2_256_s _ -> sha2_256
| SHA2_384_s _ -> sha2_384
| SHA2_512_s _ -> sha2_512
| SHA3_224_s _ -> sha3_224
| SHA3_256_s _ -> sha3_256
| SHA3_384_s _ -> sha3_384
| SHA3_512_s _ -> sha3_512
| Blake2S_s _ -> blake2s_32
| Blake2S_128_s _ _ -> blake2s_128
| Blake2B_s _ -> blake2b_32
| Blake2B_256_s _ _ -> blake2b_256
// In state_s, the data type already captures what implementation we have... three
// design choices here:
// - turn state_s into a dependent pair of G.erased impl & (SHA2_s | SHA3_s |
// ...) so as not to repeat redundant information at run-time
// - hope that we can get away with returning dependent pairs only when needed.
// We're going for a third one in this module, which is more lightweight.
[@@strict_on_arguments [1]]
inline_for_extraction
let p #a (s: state_s a): Hacl.Hash.Definitions.state (impl_of_state s) =
match s with
| MD5_s p -> p
| SHA1_s p -> p
| SHA2_224_s p -> p
| SHA2_256_s p -> p
| SHA2_384_s p -> p
| SHA2_512_s p -> p
| SHA3_224_s p -> p
| SHA3_256_s p -> p
| SHA3_384_s p -> p
| SHA3_512_s p -> p
| Blake2S_s p -> p
| Blake2S_128_s _ p -> p
| Blake2B_s p -> p
| Blake2B_256_s _ p -> p
let freeable_s #a s = B.freeable (p #a s)
let footprint_s #a (s: state_s a) =
B.loc_addr_of_buffer (p s)
let invariant_s #a (s: state_s a) h =
B.live h (p s)
let repr #a s h: GTot _ =
let s = B.get h s 0 in
as_seq h (p s)
let alg_of_state a s =
let open LowStar.BufferOps in
match !*s with
| MD5_s _ -> MD5
| SHA1_s _ -> SHA1
| SHA2_224_s _ -> SHA2_224
| SHA2_256_s _ -> SHA2_256
| SHA2_384_s _ -> SHA2_384
| SHA2_512_s _ -> SHA2_512
| SHA3_224_s _ -> SHA3_224
| SHA3_256_s _ -> SHA3_256
| SHA3_384_s _ -> SHA3_384
| SHA3_512_s _ -> SHA3_512
| Blake2S_s _ -> Blake2S
| Blake2S_128_s _ _ -> Blake2S
| Blake2B_s _ -> Blake2B
| Blake2B_256_s _ _ -> Blake2B | false | false | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val repr_eq : r1: Spec.Hash.Definitions.words_state a -> r2: Spec.Hash.Definitions.words_state a -> Prims.prop | [] | EverCrypt.Hash.repr_eq | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | r1: Spec.Hash.Definitions.words_state a -> r2: Spec.Hash.Definitions.words_state a -> Prims.prop | {
"end_col": 17,
"end_line": 209,
"start_col": 2,
"start_line": 209
} |
|
Prims.GTot | val footprint_s: #a:alg -> state_s a -> GTot M.loc | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let footprint_s #a (s: state_s a) =
B.loc_addr_of_buffer (p s) | val footprint_s: #a:alg -> state_s a -> GTot M.loc
let footprint_s #a (s: state_s a) = | false | null | false | B.loc_addr_of_buffer (p s) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"sometrivial"
] | [
"EverCrypt.Hash.alg",
"EverCrypt.Hash.state_s",
"LowStar.Monotonic.Buffer.loc_addr_of_buffer",
"Hacl.Hash.Definitions.impl_word",
"EverCrypt.Hash.impl_of_state",
"LowStar.Buffer.trivial_preorder",
"EverCrypt.Hash.p",
"LowStar.Monotonic.Buffer.loc"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |)
inline_for_extraction noextract
let sha2_384: impl = (| SHA2_384, () |)
inline_for_extraction noextract
let sha2_512: impl = (| SHA2_512, () |)
inline_for_extraction noextract
let sha3_224: impl = (| SHA3_224, () |)
inline_for_extraction noextract
let sha3_256: impl = (| SHA3_256, () |)
inline_for_extraction noextract
let sha3_384: impl = (| SHA3_384, () |)
inline_for_extraction noextract
let sha3_512: impl = (| SHA3_512, () |)
inline_for_extraction noextract
let blake2s_32: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2s_128: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M128 |)
inline_for_extraction noextract
let blake2b_32: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2b_256: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M256 |)
inline_for_extraction noextract
let alg_of_impl (i: impl { is_valid_impl i }): alg = dfst i
// JP: This is a slightly more complicated case than for AEAD... for AEAD,
// `state_s a = i & kv a & buffer uint8`
// because no matter the /implementation/, the resulting C type for the key is
// always a pointer to bytes. Here, that's no longer true because of Blake2, so
// we need to be a little more verbose.
noeq
type state_s: alg -> Type0 =
| MD5_s: p:Hacl.Hash.Definitions.state (|MD5, ()|) -> state_s MD5
| SHA1_s: p:Hacl.Hash.Definitions.state (|SHA1, ()|) -> state_s SHA1
| SHA2_224_s: p:Hacl.Hash.Definitions.state (|SHA2_224, ()|) -> state_s SHA2_224
| SHA2_256_s: p:Hacl.Hash.Definitions.state (|SHA2_256, ()|) -> state_s SHA2_256
| SHA2_384_s: p:Hacl.Hash.Definitions.state (|SHA2_384, ()|) -> state_s SHA2_384
| SHA2_512_s: p:Hacl.Hash.Definitions.state (|SHA2_512, ()|) -> state_s SHA2_512
| SHA3_224_s: p:Hacl.Hash.Definitions.state (|SHA3_224, ()|) -> state_s SHA3_224
| SHA3_256_s: p:Hacl.Hash.Definitions.state (|SHA3_256, ()|) -> state_s SHA3_256
| SHA3_384_s: p:Hacl.Hash.Definitions.state (|SHA3_384, ()|) -> state_s SHA3_384
| SHA3_512_s: p:Hacl.Hash.Definitions.state (|SHA3_512, ()|) -> state_s SHA3_512
| Blake2S_s: p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2S
| Blake2S_128_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec128 /\
EverCrypt.AutoConfig2.vec128_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M128|) ->
state_s Blake2S
| Blake2B_s: p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2B
| Blake2B_256_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec256 /\
EverCrypt.AutoConfig2.vec256_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M256|) -> state_s Blake2B
let invert_state_s (a: alg): Lemma
(requires True)
(ensures (inversion (state_s a)))
[ SMTPat (state_s a) ]
=
allow_inversion (state_s a)
[@@strict_on_arguments [1]]
inline_for_extraction
let impl_of_state #a (s: state_s a): i:impl { alg_of_impl i == a } =
match s with
| MD5_s _ -> md5
| SHA1_s _ -> sha1
| SHA2_224_s _ -> sha2_224
| SHA2_256_s _ -> sha2_256
| SHA2_384_s _ -> sha2_384
| SHA2_512_s _ -> sha2_512
| SHA3_224_s _ -> sha3_224
| SHA3_256_s _ -> sha3_256
| SHA3_384_s _ -> sha3_384
| SHA3_512_s _ -> sha3_512
| Blake2S_s _ -> blake2s_32
| Blake2S_128_s _ _ -> blake2s_128
| Blake2B_s _ -> blake2b_32
| Blake2B_256_s _ _ -> blake2b_256
// In state_s, the data type already captures what implementation we have... three
// design choices here:
// - turn state_s into a dependent pair of G.erased impl & (SHA2_s | SHA3_s |
// ...) so as not to repeat redundant information at run-time
// - hope that we can get away with returning dependent pairs only when needed.
// We're going for a third one in this module, which is more lightweight.
[@@strict_on_arguments [1]]
inline_for_extraction
let p #a (s: state_s a): Hacl.Hash.Definitions.state (impl_of_state s) =
match s with
| MD5_s p -> p
| SHA1_s p -> p
| SHA2_224_s p -> p
| SHA2_256_s p -> p
| SHA2_384_s p -> p
| SHA2_512_s p -> p
| SHA3_224_s p -> p
| SHA3_256_s p -> p
| SHA3_384_s p -> p
| SHA3_512_s p -> p
| Blake2S_s p -> p
| Blake2S_128_s _ p -> p
| Blake2B_s p -> p
| Blake2B_256_s _ p -> p
let freeable_s #a s = B.freeable (p #a s) | false | false | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val footprint_s: #a:alg -> state_s a -> GTot M.loc | [] | EverCrypt.Hash.footprint_s | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: EverCrypt.Hash.state_s a -> Prims.GTot LowStar.Monotonic.Buffer.loc | {
"end_col": 28,
"end_line": 181,
"start_col": 2,
"start_line": 181
} |
Prims.Tot | val sha1:impl | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sha1: impl = (| SHA1, () |) | val sha1:impl
let sha1:impl = | false | null | false | (| SHA1, () |) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Spec.Hash.Definitions.SHA1"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |) | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sha1:impl | [] | EverCrypt.Hash.sha1 | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | EverCrypt.Hash.impl | {
"end_col": 31,
"end_line": 69,
"start_col": 17,
"start_line": 69
} |
Prims.Tot | val string_of_alg: alg -> C.String.t | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B" | val string_of_alg: alg -> C.String.t
let string_of_alg = | false | null | false | let open C.String in
function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B" | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"EverCrypt.Hash.alg",
"C.String.op_Bang_Dollar",
"C.String.t"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val string_of_alg: alg -> C.String.t | [] | EverCrypt.Hash.string_of_alg | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: EverCrypt.Hash.alg -> C.String.t | {
"end_col": 26,
"end_line": 40,
"start_col": 23,
"start_line": 26
} |
Prims.Tot | val md5:impl | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let md5: impl = (| MD5, () |) | val md5:impl
let md5:impl = | false | null | false | (| MD5, () |) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Spec.Hash.Definitions.MD5"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i } | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val md5:impl | [] | EverCrypt.Hash.md5 | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | EverCrypt.Hash.impl | {
"end_col": 29,
"end_line": 67,
"start_col": 16,
"start_line": 67
} |
Prims.Tot | val sha2_224:impl | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sha2_224: impl = (| SHA2_224, () |) | val sha2_224:impl
let sha2_224:impl = | false | null | false | (| SHA2_224, () |) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Spec.Hash.Definitions.SHA2_224"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |) | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sha2_224:impl | [] | EverCrypt.Hash.sha2_224 | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | EverCrypt.Hash.impl | {
"end_col": 39,
"end_line": 71,
"start_col": 21,
"start_line": 71
} |
Prims.Tot | val sha2_384:impl | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sha2_384: impl = (| SHA2_384, () |) | val sha2_384:impl
let sha2_384:impl = | false | null | false | (| SHA2_384, () |) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Spec.Hash.Definitions.SHA2_384"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |) | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sha2_384:impl | [] | EverCrypt.Hash.sha2_384 | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | EverCrypt.Hash.impl | {
"end_col": 39,
"end_line": 75,
"start_col": 21,
"start_line": 75
} |
Prims.GTot | val repr: #a:alg ->
s:state a -> h:HS.mem -> GTot (words_state a) | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let repr #a s h: GTot _ =
let s = B.get h s 0 in
as_seq h (p s) | val repr: #a:alg ->
s:state a -> h:HS.mem -> GTot (words_state a)
let repr #a s h : GTot _ = | false | null | false | let s = B.get h s 0 in
as_seq h (p s) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"sometrivial"
] | [
"EverCrypt.Hash.alg",
"EverCrypt.Hash.state",
"FStar.Monotonic.HyperStack.mem",
"Hacl.Hash.Definitions.as_seq",
"EverCrypt.Hash.impl_of_state",
"EverCrypt.Hash.p",
"EverCrypt.Hash.state_s",
"LowStar.Monotonic.Buffer.get",
"LowStar.Buffer.trivial_preorder",
"Spec.Hash.Definitions.words_state"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |)
inline_for_extraction noextract
let sha2_384: impl = (| SHA2_384, () |)
inline_for_extraction noextract
let sha2_512: impl = (| SHA2_512, () |)
inline_for_extraction noextract
let sha3_224: impl = (| SHA3_224, () |)
inline_for_extraction noextract
let sha3_256: impl = (| SHA3_256, () |)
inline_for_extraction noextract
let sha3_384: impl = (| SHA3_384, () |)
inline_for_extraction noextract
let sha3_512: impl = (| SHA3_512, () |)
inline_for_extraction noextract
let blake2s_32: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2s_128: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M128 |)
inline_for_extraction noextract
let blake2b_32: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2b_256: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M256 |)
inline_for_extraction noextract
let alg_of_impl (i: impl { is_valid_impl i }): alg = dfst i
// JP: This is a slightly more complicated case than for AEAD... for AEAD,
// `state_s a = i & kv a & buffer uint8`
// because no matter the /implementation/, the resulting C type for the key is
// always a pointer to bytes. Here, that's no longer true because of Blake2, so
// we need to be a little more verbose.
noeq
type state_s: alg -> Type0 =
| MD5_s: p:Hacl.Hash.Definitions.state (|MD5, ()|) -> state_s MD5
| SHA1_s: p:Hacl.Hash.Definitions.state (|SHA1, ()|) -> state_s SHA1
| SHA2_224_s: p:Hacl.Hash.Definitions.state (|SHA2_224, ()|) -> state_s SHA2_224
| SHA2_256_s: p:Hacl.Hash.Definitions.state (|SHA2_256, ()|) -> state_s SHA2_256
| SHA2_384_s: p:Hacl.Hash.Definitions.state (|SHA2_384, ()|) -> state_s SHA2_384
| SHA2_512_s: p:Hacl.Hash.Definitions.state (|SHA2_512, ()|) -> state_s SHA2_512
| SHA3_224_s: p:Hacl.Hash.Definitions.state (|SHA3_224, ()|) -> state_s SHA3_224
| SHA3_256_s: p:Hacl.Hash.Definitions.state (|SHA3_256, ()|) -> state_s SHA3_256
| SHA3_384_s: p:Hacl.Hash.Definitions.state (|SHA3_384, ()|) -> state_s SHA3_384
| SHA3_512_s: p:Hacl.Hash.Definitions.state (|SHA3_512, ()|) -> state_s SHA3_512
| Blake2S_s: p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2S
| Blake2S_128_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec128 /\
EverCrypt.AutoConfig2.vec128_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M128|) ->
state_s Blake2S
| Blake2B_s: p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2B
| Blake2B_256_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec256 /\
EverCrypt.AutoConfig2.vec256_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M256|) -> state_s Blake2B
let invert_state_s (a: alg): Lemma
(requires True)
(ensures (inversion (state_s a)))
[ SMTPat (state_s a) ]
=
allow_inversion (state_s a)
[@@strict_on_arguments [1]]
inline_for_extraction
let impl_of_state #a (s: state_s a): i:impl { alg_of_impl i == a } =
match s with
| MD5_s _ -> md5
| SHA1_s _ -> sha1
| SHA2_224_s _ -> sha2_224
| SHA2_256_s _ -> sha2_256
| SHA2_384_s _ -> sha2_384
| SHA2_512_s _ -> sha2_512
| SHA3_224_s _ -> sha3_224
| SHA3_256_s _ -> sha3_256
| SHA3_384_s _ -> sha3_384
| SHA3_512_s _ -> sha3_512
| Blake2S_s _ -> blake2s_32
| Blake2S_128_s _ _ -> blake2s_128
| Blake2B_s _ -> blake2b_32
| Blake2B_256_s _ _ -> blake2b_256
// In state_s, the data type already captures what implementation we have... three
// design choices here:
// - turn state_s into a dependent pair of G.erased impl & (SHA2_s | SHA3_s |
// ...) so as not to repeat redundant information at run-time
// - hope that we can get away with returning dependent pairs only when needed.
// We're going for a third one in this module, which is more lightweight.
[@@strict_on_arguments [1]]
inline_for_extraction
let p #a (s: state_s a): Hacl.Hash.Definitions.state (impl_of_state s) =
match s with
| MD5_s p -> p
| SHA1_s p -> p
| SHA2_224_s p -> p
| SHA2_256_s p -> p
| SHA2_384_s p -> p
| SHA2_512_s p -> p
| SHA3_224_s p -> p
| SHA3_256_s p -> p
| SHA3_384_s p -> p
| SHA3_512_s p -> p
| Blake2S_s p -> p
| Blake2S_128_s _ p -> p
| Blake2B_s p -> p
| Blake2B_256_s _ p -> p
let freeable_s #a s = B.freeable (p #a s)
let footprint_s #a (s: state_s a) =
B.loc_addr_of_buffer (p s)
let invariant_s #a (s: state_s a) h =
B.live h (p s) | false | false | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val repr: #a:alg ->
s:state a -> h:HS.mem -> GTot (words_state a) | [] | EverCrypt.Hash.repr | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: EverCrypt.Hash.state a -> h: FStar.Monotonic.HyperStack.mem
-> Prims.GTot (Spec.Hash.Definitions.words_state a) | {
"end_col": 16,
"end_line": 188,
"start_col": 25,
"start_line": 186
} |
Prims.Tot | val sha3_256:impl | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sha3_256: impl = (| SHA3_256, () |) | val sha3_256:impl
let sha3_256:impl = | false | null | false | (| SHA3_256, () |) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Spec.Hash.Definitions.SHA3_256"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |)
inline_for_extraction noextract
let sha2_384: impl = (| SHA2_384, () |)
inline_for_extraction noextract
let sha2_512: impl = (| SHA2_512, () |)
inline_for_extraction noextract
let sha3_224: impl = (| SHA3_224, () |) | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sha3_256:impl | [] | EverCrypt.Hash.sha3_256 | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | EverCrypt.Hash.impl | {
"end_col": 39,
"end_line": 81,
"start_col": 21,
"start_line": 81
} |
Prims.Tot | val sha2_512:impl | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sha2_512: impl = (| SHA2_512, () |) | val sha2_512:impl
let sha2_512:impl = | false | null | false | (| SHA2_512, () |) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Spec.Hash.Definitions.SHA2_512"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |)
inline_for_extraction noextract
let sha2_384: impl = (| SHA2_384, () |) | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sha2_512:impl | [] | EverCrypt.Hash.sha2_512 | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | EverCrypt.Hash.impl | {
"end_col": 39,
"end_line": 77,
"start_col": 21,
"start_line": 77
} |
Prims.Tot | val sha2_256:impl | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sha2_256: impl = (| SHA2_256, () |) | val sha2_256:impl
let sha2_256:impl = | false | null | false | (| SHA2_256, () |) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Spec.Hash.Definitions.SHA2_256"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |) | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sha2_256:impl | [] | EverCrypt.Hash.sha2_256 | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | EverCrypt.Hash.impl | {
"end_col": 39,
"end_line": 73,
"start_col": 21,
"start_line": 73
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let k224_256 =
LowStar.ImmutableBuffer.igcmalloc_of_list HS.root Spec.SHA2.Constants.k224_256_l | let k224_256 = | false | null | false | LowStar.ImmutableBuffer.igcmalloc_of_list HS.root Spec.SHA2.Constants.k224_256_l | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"LowStar.ImmutableBuffer.igcmalloc_of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U32",
"Lib.IntTypes.SEC",
"FStar.Monotonic.HyperHeap.root",
"Spec.SHA2.Constants.k224_256_l",
"LowStar.ImmutableBuffer.libuffer",
"FStar.Pervasives.normalize_term",
"Prims.nat",
"FStar.List.Tot.Base.length",
"FStar.Seq.Properties.seq_of_list",
"Prims.l_and",
"Prims.eq2",
"FStar.Monotonic.HyperHeap.rid",
"LowStar.Monotonic.Buffer.frameOf",
"LowStar.ImmutableBuffer.immutable_preorder",
"LowStar.Monotonic.Buffer.recallable"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |)
inline_for_extraction noextract
let sha2_384: impl = (| SHA2_384, () |)
inline_for_extraction noextract
let sha2_512: impl = (| SHA2_512, () |)
inline_for_extraction noextract
let sha3_224: impl = (| SHA3_224, () |)
inline_for_extraction noextract
let sha3_256: impl = (| SHA3_256, () |)
inline_for_extraction noextract
let sha3_384: impl = (| SHA3_384, () |)
inline_for_extraction noextract
let sha3_512: impl = (| SHA3_512, () |)
inline_for_extraction noextract
let blake2s_32: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2s_128: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M128 |)
inline_for_extraction noextract
let blake2b_32: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2b_256: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M256 |)
inline_for_extraction noextract
let alg_of_impl (i: impl { is_valid_impl i }): alg = dfst i
// JP: This is a slightly more complicated case than for AEAD... for AEAD,
// `state_s a = i & kv a & buffer uint8`
// because no matter the /implementation/, the resulting C type for the key is
// always a pointer to bytes. Here, that's no longer true because of Blake2, so
// we need to be a little more verbose.
noeq
type state_s: alg -> Type0 =
| MD5_s: p:Hacl.Hash.Definitions.state (|MD5, ()|) -> state_s MD5
| SHA1_s: p:Hacl.Hash.Definitions.state (|SHA1, ()|) -> state_s SHA1
| SHA2_224_s: p:Hacl.Hash.Definitions.state (|SHA2_224, ()|) -> state_s SHA2_224
| SHA2_256_s: p:Hacl.Hash.Definitions.state (|SHA2_256, ()|) -> state_s SHA2_256
| SHA2_384_s: p:Hacl.Hash.Definitions.state (|SHA2_384, ()|) -> state_s SHA2_384
| SHA2_512_s: p:Hacl.Hash.Definitions.state (|SHA2_512, ()|) -> state_s SHA2_512
| SHA3_224_s: p:Hacl.Hash.Definitions.state (|SHA3_224, ()|) -> state_s SHA3_224
| SHA3_256_s: p:Hacl.Hash.Definitions.state (|SHA3_256, ()|) -> state_s SHA3_256
| SHA3_384_s: p:Hacl.Hash.Definitions.state (|SHA3_384, ()|) -> state_s SHA3_384
| SHA3_512_s: p:Hacl.Hash.Definitions.state (|SHA3_512, ()|) -> state_s SHA3_512
| Blake2S_s: p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2S
| Blake2S_128_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec128 /\
EverCrypt.AutoConfig2.vec128_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2S, Hacl.Impl.Blake2.Core.M128|) ->
state_s Blake2S
| Blake2B_s: p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M32|) -> state_s Blake2B
| Blake2B_256_s:
_:squash (EverCrypt.TargetConfig.hacl_can_compile_vec256 /\
EverCrypt.AutoConfig2.vec256_enabled) ->
p:Hacl.Hash.Definitions.state (|Blake2B, Hacl.Impl.Blake2.Core.M256|) -> state_s Blake2B
let invert_state_s (a: alg): Lemma
(requires True)
(ensures (inversion (state_s a)))
[ SMTPat (state_s a) ]
=
allow_inversion (state_s a)
[@@strict_on_arguments [1]]
inline_for_extraction
let impl_of_state #a (s: state_s a): i:impl { alg_of_impl i == a } =
match s with
| MD5_s _ -> md5
| SHA1_s _ -> sha1
| SHA2_224_s _ -> sha2_224
| SHA2_256_s _ -> sha2_256
| SHA2_384_s _ -> sha2_384
| SHA2_512_s _ -> sha2_512
| SHA3_224_s _ -> sha3_224
| SHA3_256_s _ -> sha3_256
| SHA3_384_s _ -> sha3_384
| SHA3_512_s _ -> sha3_512
| Blake2S_s _ -> blake2s_32
| Blake2S_128_s _ _ -> blake2s_128
| Blake2B_s _ -> blake2b_32
| Blake2B_256_s _ _ -> blake2b_256
// In state_s, the data type already captures what implementation we have... three
// design choices here:
// - turn state_s into a dependent pair of G.erased impl & (SHA2_s | SHA3_s |
// ...) so as not to repeat redundant information at run-time
// - hope that we can get away with returning dependent pairs only when needed.
// We're going for a third one in this module, which is more lightweight.
[@@strict_on_arguments [1]]
inline_for_extraction
let p #a (s: state_s a): Hacl.Hash.Definitions.state (impl_of_state s) =
match s with
| MD5_s p -> p
| SHA1_s p -> p
| SHA2_224_s p -> p
| SHA2_256_s p -> p
| SHA2_384_s p -> p
| SHA2_512_s p -> p
| SHA3_224_s p -> p
| SHA3_256_s p -> p
| SHA3_384_s p -> p
| SHA3_512_s p -> p
| Blake2S_s p -> p
| Blake2S_128_s _ p -> p
| Blake2B_s p -> p
| Blake2B_256_s _ p -> p
let freeable_s #a s = B.freeable (p #a s)
let footprint_s #a (s: state_s a) =
B.loc_addr_of_buffer (p s)
let invariant_s #a (s: state_s a) h =
B.live h (p s)
let repr #a s h: GTot _ =
let s = B.get h s 0 in
as_seq h (p s)
let alg_of_state a s =
let open LowStar.BufferOps in
match !*s with
| MD5_s _ -> MD5
| SHA1_s _ -> SHA1
| SHA2_224_s _ -> SHA2_224
| SHA2_256_s _ -> SHA2_256
| SHA2_384_s _ -> SHA2_384
| SHA2_512_s _ -> SHA2_512
| SHA3_224_s _ -> SHA3_224
| SHA3_256_s _ -> SHA3_256
| SHA3_384_s _ -> SHA3_384
| SHA3_512_s _ -> SHA3_512
| Blake2S_s _ -> Blake2S
| Blake2S_128_s _ _ -> Blake2S
| Blake2B_s _ -> Blake2B
| Blake2B_256_s _ _ -> Blake2B
let repr_eq (#a:alg) (r1 r2: Spec.Hash.Definitions.words_state a) =
Seq.equal r1 r2
let fresh_is_disjoint l1 l2 h0 h1 = ()
let invariant_loc_in_footprint #a s m = ()
let frame_invariant #a l s h0 h1 =
let state = B.deref h0 s in
assert (repr_eq (repr s h0) (repr s h1))
inline_for_extraction noextract
[@@strict_on_arguments [0]]
let alloca a =
let s: state_s a =
match a with
| MD5 -> MD5_s (B.alloca 0ul 4ul)
| SHA1 -> SHA1_s (B.alloca 0ul 5ul)
| SHA2_224 -> SHA2_224_s (B.alloca 0ul 8ul)
| SHA2_256 -> SHA2_256_s (B.alloca 0ul 8ul)
| SHA2_384 -> SHA2_384_s (B.alloca 0UL 8ul)
| SHA2_512 -> SHA2_512_s (B.alloca 0UL 8ul)
| SHA3_224 -> SHA3_224_s (B.alloca 0UL 25ul)
| SHA3_256 -> SHA3_256_s (B.alloca 0UL 25ul)
| SHA3_384 -> SHA3_384_s (B.alloca 0UL 25ul)
| SHA3_512 -> SHA3_512_s (B.alloca 0UL 25ul)
| Blake2S ->
if EverCrypt.TargetConfig.hacl_can_compile_vec128 then
let vec128 = EverCrypt.AutoConfig2.has_vec128 () in
if vec128 then
let open Hacl.Impl.Blake2.Core in
[@inline_let] let i: impl = (| Blake2S , M128 |) in
Blake2S_128_s () (B.alloca (zero_element Spec.Blake2.Blake2S M128) (impl_state_len i))
else
Blake2S_s (B.alloca 0ul 16ul)
else
Blake2S_s (B.alloca 0ul 16ul)
| Blake2B ->
if EverCrypt.TargetConfig.hacl_can_compile_vec256 then
let vec256 = EverCrypt.AutoConfig2.has_vec256 () in
if vec256 then
let open Hacl.Impl.Blake2.Core in
[@inline_let] let i: impl = (| Blake2B , M256 |) in
Blake2B_256_s () (B.alloca (zero_element Spec.Blake2.Blake2B M256) (impl_state_len i))
else
Blake2B_s (B.alloca 0uL 16ul)
else
Blake2B_s (B.alloca 0uL 16ul)
in
B.alloca s 1ul
[@@strict_on_arguments [0]]
let create_in a r =
let h0 = ST.get () in
let s: state_s a =
match a with
| MD5 -> MD5_s (B.malloc r 0ul 4ul)
| SHA1 -> SHA1_s (B.malloc r 0ul 5ul)
| SHA2_224 -> SHA2_224_s (B.malloc r 0ul 8ul)
| SHA2_256 -> SHA2_256_s (B.malloc r 0ul 8ul)
| SHA2_384 -> SHA2_384_s (B.malloc r 0UL 8ul)
| SHA2_512 -> SHA2_512_s (B.malloc r 0UL 8ul)
| SHA3_224 -> SHA3_224_s (B.malloc r 0UL 25ul)
| SHA3_256 -> SHA3_256_s (B.malloc r 0UL 25ul)
| SHA3_384 -> SHA3_384_s (B.malloc r 0UL 25ul)
| SHA3_512 -> SHA3_512_s (B.malloc r 0UL 25ul)
| Blake2S ->
if EverCrypt.TargetConfig.hacl_can_compile_vec128 then
let vec128 = EverCrypt.AutoConfig2.has_vec128 () in
// Slightly frustrating duplication of the else-branch because we
// can't compile this using the if-and return optimization of krml.
if vec128 then
Blake2S_128_s () (Hacl.Blake2s_128.blake2s_malloc r)
else
Blake2S_s (B.malloc r 0ul 16ul)
else
Blake2S_s (B.malloc r 0ul 16ul)
| Blake2B ->
if EverCrypt.TargetConfig.hacl_can_compile_vec256 then
let vec256 = EverCrypt.AutoConfig2.has_vec256 () in
if vec256 then
Blake2B_256_s () (Hacl.Blake2b_256.blake2b_malloc r)
else
Blake2B_s (B.malloc r 0uL 16ul)
else
Blake2B_s (B.malloc r 0uL 16ul)
in
B.malloc r s 1ul
let create a =
create_in a HS.root
#push-options "--ifuel 1"
// NOTE: HACL* does not require suitable preconditions so the squashed proofs
// that we have the right CPU flags are useless. But it's good to demonstrate
// how to do it for future reference and/or future other implementations.
let init #a s =
match !*s with
| MD5_s p -> Hacl.Hash.MD5.legacy_init p
| SHA1_s p -> Hacl.Hash.SHA1.legacy_init p
| SHA2_224_s p -> Hacl.Hash.SHA2.init_224 p
| SHA2_256_s p -> Hacl.Hash.SHA2.init_256 p
| SHA2_384_s p -> Hacl.Hash.SHA2.init_384 p
| SHA2_512_s p -> Hacl.Hash.SHA2.init_512 p
| SHA3_224_s p -> Hacl.Hash.SHA3.init SHA3_224 p
| SHA3_256_s p -> Hacl.Hash.SHA3.init SHA3_256 p
| SHA3_384_s p -> Hacl.Hash.SHA3.init SHA3_384 p
| SHA3_512_s p -> Hacl.Hash.SHA3.init SHA3_512 p
| Blake2S_s p -> let _ = Hacl.Hash.Blake2.init_blake2s_32 p in ()
| Blake2S_128_s _ p ->
if EverCrypt.TargetConfig.hacl_can_compile_vec128 then
let _ = Hacl.Hash.Blake2.init_blake2s_128 p in ()
else LowStar.Ignore.ignore p
| Blake2B_s p -> let _ = Hacl.Hash.Blake2.init_blake2b_32 p in ()
| Blake2B_256_s _ p ->
if EverCrypt.TargetConfig.hacl_can_compile_vec256 then
let _ = Hacl.Hash.Blake2.init_blake2b_256 p in ()
else LowStar.Ignore.ignore p
#pop-options
friend Vale.SHA.SHA_helpers
// Avoid a cross-compilation unit symbol visibility... duplicate locally. | false | false | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val k224_256 : b:
LowStar.ImmutableBuffer.libuffer (Lib.IntTypes.int_t Lib.IntTypes.U32 Lib.IntTypes.SEC)
(FStar.Pervasives.normalize_term (FStar.List.Tot.Base.length Spec.SHA2.Constants.k224_256_l))
(FStar.Seq.Properties.seq_of_list Spec.SHA2.Constants.k224_256_l)
{ LowStar.Monotonic.Buffer.frameOf b == FStar.Monotonic.HyperHeap.root /\
LowStar.Monotonic.Buffer.recallable b } | [] | EverCrypt.Hash.k224_256 | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b:
LowStar.ImmutableBuffer.libuffer (Lib.IntTypes.int_t Lib.IntTypes.U32 Lib.IntTypes.SEC)
(FStar.Pervasives.normalize_term (FStar.List.Tot.Base.length Spec.SHA2.Constants.k224_256_l))
(FStar.Seq.Properties.seq_of_list Spec.SHA2.Constants.k224_256_l)
{ LowStar.Monotonic.Buffer.frameOf b == FStar.Monotonic.HyperHeap.root /\
LowStar.Monotonic.Buffer.recallable b } | {
"end_col": 82,
"end_line": 333,
"start_col": 2,
"start_line": 333
} |
|
Prims.Tot | val sha3_384:impl | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sha3_384: impl = (| SHA3_384, () |) | val sha3_384:impl
let sha3_384:impl = | false | null | false | (| SHA3_384, () |) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Spec.Hash.Definitions.SHA3_384"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |)
inline_for_extraction noextract
let sha2_384: impl = (| SHA2_384, () |)
inline_for_extraction noextract
let sha2_512: impl = (| SHA2_512, () |)
inline_for_extraction noextract
let sha3_224: impl = (| SHA3_224, () |)
inline_for_extraction noextract
let sha3_256: impl = (| SHA3_256, () |) | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sha3_384:impl | [] | EverCrypt.Hash.sha3_384 | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | EverCrypt.Hash.impl | {
"end_col": 39,
"end_line": 83,
"start_col": 21,
"start_line": 83
} |
Prims.Tot | val blake2s_128:impl | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let blake2s_128: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M128 |) | val blake2s_128:impl
let blake2s_128:impl = | false | null | false | (| Blake2S, Hacl.Impl.Blake2.Core.M128 |) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Spec.Hash.Definitions.Blake2S",
"Hacl.Impl.Blake2.Core.M128"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |)
inline_for_extraction noextract
let sha2_384: impl = (| SHA2_384, () |)
inline_for_extraction noextract
let sha2_512: impl = (| SHA2_512, () |)
inline_for_extraction noextract
let sha3_224: impl = (| SHA3_224, () |)
inline_for_extraction noextract
let sha3_256: impl = (| SHA3_256, () |)
inline_for_extraction noextract
let sha3_384: impl = (| SHA3_384, () |)
inline_for_extraction noextract
let sha3_512: impl = (| SHA3_512, () |)
inline_for_extraction noextract
let blake2s_32: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M32 |) | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2s_128:impl | [] | EverCrypt.Hash.blake2s_128 | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | EverCrypt.Hash.impl | {
"end_col": 65,
"end_line": 89,
"start_col": 24,
"start_line": 89
} |
Prims.Tot | val blake2b_32:impl | [
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "C.Failure",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "EverCrypt.AutoConfig2",
"short_module": "AC"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let blake2b_32: impl = (| Blake2B, Hacl.Impl.Blake2.Core.M32 |) | val blake2b_32:impl
let blake2b_32:impl = | false | null | false | (| Blake2B, Hacl.Impl.Blake2.Core.M32 |) | {
"checked_file": "EverCrypt.Hash.fst.checked",
"dependencies": [
"Vale.Wrapper.X64.Sha.fsti.checked",
"Vale.SHA.SHA_helpers.fst.checked",
"Spec.SHA2.Lemmas.fsti.checked",
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Hash.SHA3.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Blake2.fsti.checked",
"Hacl.Blake2s_128.fst.checked",
"Hacl.Blake2b_256.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Calc.fsti.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked",
"C.String.fsti.checked",
"C.Failure.fst.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Hash.fst"
} | [
"total"
] | [
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Spec.Hash.Definitions.Blake2B",
"Hacl.Impl.Blake2.Core.M32"
] | [] | module EverCrypt.Hash
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
open FStar.HyperStack.ST
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
module AC = EverCrypt.AutoConfig2
open LowStar.BufferOps
open FStar.Integers
open C.Failure
module U64 = FStar.UInt64
module U32 = FStar.UInt32
// Allow *just* the alg type to be inverted, so that the entire module can run
// with ifuel 0
let _: squash (inversion alg) = allow_inversion alg
let string_of_alg =
let open C.String in function
| MD5 -> !$"MD5"
| SHA1 -> !$"SHA1"
| SHA2_224 -> !$"SHA2_224"
| SHA2_256 -> !$"SHA2_256"
| SHA2_384 -> !$"SHA2_384"
| SHA2_512 -> !$"SHA2_512"
| SHA3_224 -> !$"SHA3_224"
| SHA3_256 -> !$"SHA3_256"
| SHA3_384 -> !$"SHA3_384"
| SHA3_512 -> !$"SHA3_512"
| Shake128 -> !$"Shake128"
| Shake256 -> !$"Shake256"
| Blake2S -> !$"Blake2S"
| Blake2B -> !$"Blake2B"
let uint32_p = B.buffer uint_32
let uint64_p = B.buffer uint_64
let is_valid_impl (i: impl) =
let open Hacl.Impl.Blake2.Core in
match i with
| (| MD5, () |)
| (| SHA1, () |)
| (| SHA2_224, () |)
| (| SHA2_256, () |)
| (| SHA2_384, () |)
| (| SHA2_512, () |)
| (| SHA3_224, () |)
| (| SHA3_256, () |)
| (| SHA3_384, () |)
| (| SHA3_512, () |)
| (| Blake2S, M32 |)
| (| Blake2S, M128 |)
| (| Blake2B, M32 |)
| (| Blake2B, M256 |) -> true
| _ -> false
let impl = i:impl { is_valid_impl i }
inline_for_extraction noextract
let md5: impl = (| MD5, () |)
inline_for_extraction noextract
let sha1: impl = (| SHA1, () |)
inline_for_extraction noextract
let sha2_224: impl = (| SHA2_224, () |)
inline_for_extraction noextract
let sha2_256: impl = (| SHA2_256, () |)
inline_for_extraction noextract
let sha2_384: impl = (| SHA2_384, () |)
inline_for_extraction noextract
let sha2_512: impl = (| SHA2_512, () |)
inline_for_extraction noextract
let sha3_224: impl = (| SHA3_224, () |)
inline_for_extraction noextract
let sha3_256: impl = (| SHA3_256, () |)
inline_for_extraction noextract
let sha3_384: impl = (| SHA3_384, () |)
inline_for_extraction noextract
let sha3_512: impl = (| SHA3_512, () |)
inline_for_extraction noextract
let blake2s_32: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M32 |)
inline_for_extraction noextract
let blake2s_128: impl = (| Blake2S, Hacl.Impl.Blake2.Core.M128 |) | false | true | EverCrypt.Hash.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2b_32:impl | [] | EverCrypt.Hash.blake2b_32 | {
"file_name": "providers/evercrypt/fst/EverCrypt.Hash.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | EverCrypt.Hash.impl | {
"end_col": 63,
"end_line": 91,
"start_col": 23,
"start_line": 91
} |
Subsets and Splits