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.Tot | val min_int (n: pos) : Tot int | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 min_int (n:pos) : Tot int = - (pow2 (n-1)) | val min_int (n: pos) : Tot int
let min_int (n: pos) : Tot int = | false | null | false | - (pow2 (n - 1)) | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"Prims.op_Minus",
"Prims.pow2",
"Prims.op_Subtraction",
"Prims.int"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs | false | true | FStar.Int.fsti | {
"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 min_int (n: pos) : Tot int | [] | FStar.Int.min_int | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | n: Prims.pos -> Prims.int | {
"end_col": 46,
"end_line": 42,
"start_col": 32,
"start_line": 42
} |
Prims.Pure | val decr (#n: pos) (a: int_t n)
: Pure (int_t n) (requires (b2t (a > min_int n))) (ensures (fun _ -> True)) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1 | val decr (#n: pos) (a: int_t n)
: Pure (int_t n) (requires (b2t (a > min_int n))) (ensures (fun _ -> True))
let decr (#n: pos) (a: int_t n)
: Pure (int_t n) (requires (b2t (a > min_int n))) (ensures (fun _ -> True)) = | false | null | false | a - 1 | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [] | [
"Prims.pos",
"FStar.Int.int_t",
"Prims.op_Subtraction",
"Prims.b2t",
"Prims.op_GreaterThan",
"FStar.Int.min_int",
"Prims.l_True"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n) | false | false | FStar.Int.fsti | {
"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 decr (#n: pos) (a: int_t n)
: Pure (int_t n) (requires (b2t (a > min_int n))) (ensures (fun _ -> True)) | [] | FStar.Int.decr | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> Prims.Pure (FStar.Int.int_t n) | {
"end_col": 9,
"end_line": 89,
"start_col": 4,
"start_line": 89
} |
Prims.Tot | val decr_mod (#n: pos) (a: int_t n) : Tot (int_t n) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1)) | val decr_mod (#n: pos) (a: int_t n) : Tot (int_t n)
let decr_mod (#n: pos) (a: int_t n) : Tot (int_t n) = | false | null | false | (a - 1) % (pow2 (n - 1)) | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.Int.int_t",
"Prims.op_Modulus",
"Prims.op_Subtraction",
"Prims.pow2"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1)) | false | false | FStar.Int.fsti | {
"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 decr_mod (#n: pos) (a: int_t n) : Tot (int_t n) | [] | FStar.Int.decr_mod | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> FStar.Int.int_t n | {
"end_col": 24,
"end_line": 103,
"start_col": 2,
"start_line": 103
} |
Prims.Tot | val op_At_Percent (v: int) (p: int{p > 0 /\ p % 2 = 0}) : Tot int | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m | val op_At_Percent (v: int) (p: int{p > 0 /\ p % 2 = 0}) : Tot int
let op_At_Percent (v: int) (p: int{p > 0 /\ p % 2 = 0}) : Tot int = | false | null | false | let m = v % p in
if m >= p / 2 then m - p else m | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.int",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_Equality",
"Prims.op_Modulus",
"Prims.op_GreaterThanOrEqual",
"FStar.Int.op_Slash",
"Prims.op_Subtraction",
"Prims.bool"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b | false | false | FStar.Int.fsti | {
"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 op_At_Percent (v: int) (p: int{p > 0 /\ p % 2 = 0}) : Tot int | [] | FStar.Int.op_At_Percent | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | v: Prims.int -> p: Prims.int{p > 0 /\ p % 2 = 0} -> Prims.int | {
"end_col": 48,
"end_line": 59,
"start_col": 58,
"start_line": 58
} |
Prims.Tot | val max_int (n: pos) : Tot int | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 max_int (n:pos) : Tot int = pow2 (n-1) - 1 | val max_int (n: pos) : Tot int
let max_int (n: pos) : Tot int = | false | null | false | pow2 (n - 1) - 1 | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.int"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs | false | true | FStar.Int.fsti | {
"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 max_int (n: pos) : Tot int | [] | FStar.Int.max_int | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | n: Prims.pos -> Prims.int | {
"end_col": 46,
"end_line": 41,
"start_col": 32,
"start_line": 41
} |
Prims.Tot | val sub_mod (#n: pos) (a b: int_t n) : Tot (int_t n) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n) | val sub_mod (#n: pos) (a b: int_t n) : Tot (int_t n)
let sub_mod (#n: pos) (a b: int_t n) : Tot (int_t n) = | false | null | false | (a - b) @% (pow2 n) | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.Int.int_t",
"FStar.Int.op_At_Percent",
"Prims.op_Subtraction",
"Prims.pow2"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c)) | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 sub_mod (#n: pos) (a b: int_t n) : Tot (int_t n) | [] | FStar.Int.sub_mod | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> b: FStar.Int.int_t n -> FStar.Int.int_t n | {
"end_col": 21,
"end_line": 135,
"start_col": 2,
"start_line": 135
} |
Prims.Tot | val pow2_minus_one (#n: pos{1 < n}) (m: nat{m < n}) : Tot (int_t n) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1 | val pow2_minus_one (#n: pos{1 < n}) (m: nat{m < n}) : Tot (int_t n)
let pow2_minus_one (#n: pos{1 < n}) (m: nat{m < n}) : Tot (int_t n) = | false | null | false | pow2_le_compat (n - 1) m;
pow2 m - 1 | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.nat",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.unit",
"FStar.Math.Lemmas.pow2_le_compat",
"FStar.Int.int_t"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 pow2_minus_one (#n: pos{1 < n}) (m: nat{m < n}) : Tot (int_t n) | [] | FStar.Int.pow2_minus_one | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | m: Prims.nat{m < n} -> FStar.Int.int_t n | {
"end_col": 12,
"end_line": 72,
"start_col": 2,
"start_line": 71
} |
Prims.Tot | val zero (n: pos) : Tot (int_t n) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 zero (n:pos) : Tot (int_t n) = 0 | val zero (n: pos) : Tot (int_t n)
let zero (n: pos) : Tot (int_t n) = | false | null | false | 0 | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.Int.int_t"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants | false | false | FStar.Int.fsti | {
"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 zero (n: pos) : Tot (int_t n) | [] | FStar.Int.zero | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | n: Prims.pos -> FStar.Int.int_t n | {
"end_col": 36,
"end_line": 63,
"start_col": 35,
"start_line": 63
} |
Prims.Tot | val add_mod (#n: pos) (a b: int_t n) : Tot (int_t n) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n) | val add_mod (#n: pos) (a b: int_t n) : Tot (int_t n)
let add_mod (#n: pos) (a b: int_t n) : Tot (int_t n) = | false | null | false | (a + b) @% (pow2 n) | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.Int.int_t",
"FStar.Int.op_At_Percent",
"Prims.op_Addition",
"Prims.pow2"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1" | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 add_mod (#n: pos) (a b: int_t n) : Tot (int_t n) | [] | FStar.Int.add_mod | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> b: FStar.Int.int_t n -> FStar.Int.int_t n | {
"end_col": 21,
"end_line": 120,
"start_col": 2,
"start_line": 120
} |
Prims.Tot | val incr_mod (#n: pos) (a: int_t n) : Tot (int_t n) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1)) | val incr_mod (#n: pos) (a: int_t n) : Tot (int_t n)
let incr_mod (#n: pos) (a: int_t n) : Tot (int_t n) = | false | null | false | (a + 1) % (pow2 (n - 1)) | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.Int.int_t",
"Prims.op_Modulus",
"Prims.op_Addition",
"Prims.pow2",
"Prims.op_Subtraction"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b)) | false | false | FStar.Int.fsti | {
"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 incr_mod (#n: pos) (a: int_t n) : Tot (int_t n) | [] | FStar.Int.incr_mod | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> FStar.Int.int_t n | {
"end_col": 24,
"end_line": 100,
"start_col": 2,
"start_line": 100
} |
Prims.Pure | val mul (#n: pos) (a b: int_t n)
: Pure (int_t n) (requires (size (a * b) n)) (ensures (fun _ -> True)) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b | val mul (#n: pos) (a b: int_t n)
: Pure (int_t n) (requires (size (a * b) n)) (ensures (fun _ -> True))
let mul (#n: pos) (a b: int_t n)
: Pure (int_t n) (requires (size (a * b) n)) (ensures (fun _ -> True)) = | false | null | false | a * b | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [] | [
"Prims.pos",
"FStar.Int.int_t",
"FStar.Mul.op_Star",
"FStar.Int.size",
"Prims.l_True"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n)) | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 mul (#n: pos) (a b: int_t n)
: Pure (int_t n) (requires (size (a * b) n)) (ensures (fun _ -> True)) | [] | FStar.Int.mul | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> b: FStar.Int.int_t n -> Prims.Pure (FStar.Int.int_t n) | {
"end_col": 9,
"end_line": 142,
"start_col": 4,
"start_line": 142
} |
Prims.Pure | val incr (#n: pos) (a: int_t n)
: Pure (int_t n) (requires (b2t (a < max_int n))) (ensures (fun _ -> True)) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1 | val incr (#n: pos) (a: int_t n)
: Pure (int_t n) (requires (b2t (a < max_int n))) (ensures (fun _ -> True))
let incr (#n: pos) (a: int_t n)
: Pure (int_t n) (requires (b2t (a < max_int n))) (ensures (fun _ -> True)) = | false | null | false | a + 1 | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [] | [
"Prims.pos",
"FStar.Int.int_t",
"Prims.op_Addition",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Int.max_int",
"Prims.l_True"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n) | false | false | FStar.Int.fsti | {
"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 incr (#n: pos) (a: int_t n)
: Pure (int_t n) (requires (b2t (a < max_int n))) (ensures (fun _ -> True)) | [] | FStar.Int.incr | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> Prims.Pure (FStar.Int.int_t n) | {
"end_col": 9,
"end_line": 84,
"start_col": 4,
"start_line": 84
} |
Prims.Pure | val sub (#n: pos) (a b: int_t n)
: Pure (int_t n) (requires (size (a - b) n)) (ensures (fun _ -> True)) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b | val sub (#n: pos) (a b: int_t n)
: Pure (int_t n) (requires (size (a - b) n)) (ensures (fun _ -> True))
let sub (#n: pos) (a b: int_t n)
: Pure (int_t n) (requires (size (a - b) n)) (ensures (fun _ -> True)) = | false | null | false | a - b | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [] | [
"Prims.pos",
"FStar.Int.int_t",
"Prims.op_Subtraction",
"FStar.Int.size",
"Prims.l_True"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n)) | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 sub (#n: pos) (a b: int_t n)
: Pure (int_t n) (requires (size (a - b) n)) (ensures (fun _ -> True)) | [] | FStar.Int.sub | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> b: FStar.Int.int_t n -> Prims.Pure (FStar.Int.int_t n) | {
"end_col": 9,
"end_line": 127,
"start_col": 4,
"start_line": 127
} |
Prims.Tot | val mod (#n: pos) (a: int_t n) (b: int_t n {b <> 0}) : Tot (int_t n) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 mod (#n:pos) (a:int_t n) (b:int_t n{b <> 0}) : Tot (int_t n) =
a - ((a/b) * b) | val mod (#n: pos) (a: int_t n) (b: int_t n {b <> 0}) : Tot (int_t n)
let mod (#n: pos) (a: int_t n) (b: int_t n {b <> 0}) : Tot (int_t n) = | false | null | false | a - ((a / b) * b) | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.Int.int_t",
"Prims.b2t",
"Prims.op_disEquality",
"Prims.int",
"Prims.op_Subtraction",
"FStar.Mul.op_Star",
"FStar.Int.op_Slash"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b
val mul_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a * b) n ==> a * b = c))
let mul_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a * b) @% (pow2 n)
#pop-options
(* Division primitives *)
let div (#n:pos) (a:int_t n) (b:int_t n{b <> 0})
: Pure (int_t n)
(requires (size (a / b) n))
(ensures (fun c -> b <> 0 ==> a / b = c))
= a / b
val div_underspec: #n:pos -> a:int_t n -> b:int_t n{b <> 0} -> Pure (int_t n)
(requires True)
(ensures (fun c ->
(b <> 0 /\ size (a / b) n) ==> a / b = c))
val div_size: #n:pos -> a:int_t n{min_int n < a} -> b:int_t n{b <> 0} ->
Lemma (requires (size a n)) (ensures (size (a / b) n))
let udiv (#n:pos) (a:int_t n{min_int n < a}) (b:int_t n{b <> 0})
: Tot (c:int_t n{b <> 0 ==> a / b = c})
= div_size #n a b;
a / b
(* Modulo primitives *) | false | false | FStar.Int.fsti | {
"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 mod (#n: pos) (a: int_t n) (b: int_t n {b <> 0}) : Tot (int_t n) | [] | FStar.Int.mod | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> b: FStar.Int.int_t n {b <> 0} -> FStar.Int.int_t n | {
"end_col": 17,
"end_line": 177,
"start_col": 2,
"start_line": 177
} |
Prims.Tot | val from_uint (#n: pos) (x: UInt.uint_t n) : Tot (int_t n) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 from_uint (#n:pos) (x:UInt.uint_t n) : Tot (int_t n) =
if x <= max_int n then x else x - pow2 n | val from_uint (#n: pos) (x: UInt.uint_t n) : Tot (int_t n)
let from_uint (#n: pos) (x: UInt.uint_t n) : Tot (int_t n) = | false | null | false | if x <= max_int n then x else x - pow2 n | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.UInt.uint_t",
"Prims.op_LessThanOrEqual",
"FStar.Int.max_int",
"Prims.bool",
"Prims.op_Subtraction",
"Prims.pow2",
"FStar.Int.int_t"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b
val mul_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a * b) n ==> a * b = c))
let mul_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a * b) @% (pow2 n)
#pop-options
(* Division primitives *)
let div (#n:pos) (a:int_t n) (b:int_t n{b <> 0})
: Pure (int_t n)
(requires (size (a / b) n))
(ensures (fun c -> b <> 0 ==> a / b = c))
= a / b
val div_underspec: #n:pos -> a:int_t n -> b:int_t n{b <> 0} -> Pure (int_t n)
(requires True)
(ensures (fun c ->
(b <> 0 /\ size (a / b) n) ==> a / b = c))
val div_size: #n:pos -> a:int_t n{min_int n < a} -> b:int_t n{b <> 0} ->
Lemma (requires (size a n)) (ensures (size (a / b) n))
let udiv (#n:pos) (a:int_t n{min_int n < a}) (b:int_t n{b <> 0})
: Tot (c:int_t n{b <> 0 ==> a / b = c})
= div_size #n a b;
a / b
(* Modulo primitives *)
let mod (#n:pos) (a:int_t n) (b:int_t n{b <> 0}) : Tot (int_t n) =
a - ((a/b) * b)
(* Comparison operators *)
let eq #n (a:int_t n) (b:int_t n) : Tot bool = a = b
let gt #n (a:int_t n) (b:int_t n) : Tot bool = a > b
let gte #n (a:int_t n) (b:int_t n) : Tot bool = a >= b
let lt #n (a:int_t n) (b:int_t n) : Tot bool = a < b
let lte #n (a:int_t n) (b:int_t n) : Tot bool = a <= b
#push-options "--initial_fuel 1 --max_fuel 1"
/// Casts
let to_uint (#n:pos) (x:int_t n) : Tot (UInt.uint_t n) =
if 0 <= x then x else x + pow2 n | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 from_uint (#n: pos) (x: UInt.uint_t n) : Tot (int_t n) | [] | FStar.Int.from_uint | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.UInt.uint_t n -> FStar.Int.int_t n | {
"end_col": 42,
"end_line": 194,
"start_col": 2,
"start_line": 194
} |
Prims.Pure | val add (#n: pos) (a b: int_t n)
: Pure (int_t n) (requires (size (a + b) n)) (ensures (fun _ -> True)) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b | val add (#n: pos) (a b: int_t n)
: Pure (int_t n) (requires (size (a + b) n)) (ensures (fun _ -> True))
let add (#n: pos) (a b: int_t n)
: Pure (int_t n) (requires (size (a + b) n)) (ensures (fun _ -> True)) = | false | null | false | a + b | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [] | [
"Prims.pos",
"FStar.Int.int_t",
"Prims.op_Addition",
"FStar.Int.size",
"Prims.l_True"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n)) | false | false | FStar.Int.fsti | {
"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 add (#n: pos) (a b: int_t n)
: Pure (int_t n) (requires (size (a + b) n)) (ensures (fun _ -> True)) | [] | FStar.Int.add | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> b: FStar.Int.int_t n -> Prims.Pure (FStar.Int.int_t n) | {
"end_col": 9,
"end_line": 110,
"start_col": 4,
"start_line": 110
} |
Prims.Tot | val mul_mod (#n: pos) (a b: int_t n) : Tot (int_t n) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 mul_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a * b) @% (pow2 n) | val mul_mod (#n: pos) (a b: int_t n) : Tot (int_t n)
let mul_mod (#n: pos) (a b: int_t n) : Tot (int_t n) = | false | null | false | (a * b) @% (pow2 n) | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.Int.int_t",
"FStar.Int.op_At_Percent",
"FStar.Mul.op_Star",
"Prims.pow2"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b
val mul_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a * b) n ==> a * b = c)) | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 mul_mod (#n: pos) (a b: int_t n) : Tot (int_t n) | [] | FStar.Int.mul_mod | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> b: FStar.Int.int_t n -> FStar.Int.int_t n | {
"end_col": 21,
"end_line": 150,
"start_col": 2,
"start_line": 150
} |
Prims.Tot | val udiv (#n: pos) (a: int_t n {min_int n < a}) (b: int_t n {b <> 0})
: Tot (c: int_t n {b <> 0 ==> a / b = c}) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 udiv (#n:pos) (a:int_t n{min_int n < a}) (b:int_t n{b <> 0})
: Tot (c:int_t n{b <> 0 ==> a / b = c})
= div_size #n a b;
a / b | val udiv (#n: pos) (a: int_t n {min_int n < a}) (b: int_t n {b <> 0})
: Tot (c: int_t n {b <> 0 ==> a / b = c})
let udiv (#n: pos) (a: int_t n {min_int n < a}) (b: int_t n {b <> 0})
: Tot (c: int_t n {b <> 0 ==> a / b = c}) = | false | null | false | div_size #n a b;
a / b | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.Int.int_t",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Int.min_int",
"Prims.op_disEquality",
"Prims.int",
"FStar.Int.op_Slash",
"Prims.unit",
"FStar.Int.div_size",
"Prims.l_imp",
"Prims.op_Equality"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b
val mul_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a * b) n ==> a * b = c))
let mul_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a * b) @% (pow2 n)
#pop-options
(* Division primitives *)
let div (#n:pos) (a:int_t n) (b:int_t n{b <> 0})
: Pure (int_t n)
(requires (size (a / b) n))
(ensures (fun c -> b <> 0 ==> a / b = c))
= a / b
val div_underspec: #n:pos -> a:int_t n -> b:int_t n{b <> 0} -> Pure (int_t n)
(requires True)
(ensures (fun c ->
(b <> 0 /\ size (a / b) n) ==> a / b = c))
val div_size: #n:pos -> a:int_t n{min_int n < a} -> b:int_t n{b <> 0} ->
Lemma (requires (size a n)) (ensures (size (a / b) n))
let udiv (#n:pos) (a:int_t n{min_int n < a}) (b:int_t n{b <> 0}) | false | false | FStar.Int.fsti | {
"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 udiv (#n: pos) (a: int_t n {min_int n < a}) (b: int_t n {b <> 0})
: Tot (c: int_t n {b <> 0 ==> a / b = c}) | [] | FStar.Int.udiv | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n {FStar.Int.min_int n < a} -> b: FStar.Int.int_t n {b <> 0}
-> c: FStar.Int.int_t n {b <> 0 ==> a / b = c} | {
"end_col": 9,
"end_line": 172,
"start_col": 4,
"start_line": 171
} |
Prims.Tot | val eq (#n: _) (a b: int_t n) : Tot bool | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 eq #n (a:int_t n) (b:int_t n) : Tot bool = a = b | val eq (#n: _) (a b: int_t n) : Tot bool
let eq #n (a: int_t n) (b: int_t n) : Tot bool = | false | null | false | a = b | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.Int.int_t",
"Prims.op_Equality",
"Prims.bool"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b
val mul_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a * b) n ==> a * b = c))
let mul_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a * b) @% (pow2 n)
#pop-options
(* Division primitives *)
let div (#n:pos) (a:int_t n) (b:int_t n{b <> 0})
: Pure (int_t n)
(requires (size (a / b) n))
(ensures (fun c -> b <> 0 ==> a / b = c))
= a / b
val div_underspec: #n:pos -> a:int_t n -> b:int_t n{b <> 0} -> Pure (int_t n)
(requires True)
(ensures (fun c ->
(b <> 0 /\ size (a / b) n) ==> a / b = c))
val div_size: #n:pos -> a:int_t n{min_int n < a} -> b:int_t n{b <> 0} ->
Lemma (requires (size a n)) (ensures (size (a / b) n))
let udiv (#n:pos) (a:int_t n{min_int n < a}) (b:int_t n{b <> 0})
: Tot (c:int_t n{b <> 0 ==> a / b = c})
= div_size #n a b;
a / b
(* Modulo primitives *)
let mod (#n:pos) (a:int_t n) (b:int_t n{b <> 0}) : Tot (int_t n) =
a - ((a/b) * b) | false | false | FStar.Int.fsti | {
"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 (#n: _) (a b: int_t n) : Tot bool | [] | FStar.Int.eq | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> b: FStar.Int.int_t n -> Prims.bool | {
"end_col": 52,
"end_line": 180,
"start_col": 47,
"start_line": 180
} |
Prims.Tot | val minus (#n: pos{1 < n}) (a: int_t n) : Tot (int_t n) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 minus (#n:pos{1 < n}) (a:int_t n) : Tot (int_t n) =
add_mod (lognot a) 1 | val minus (#n: pos{1 < n}) (a: int_t n) : Tot (int_t n)
let minus (#n: pos{1 < n}) (a: int_t n) : Tot (int_t n) = | false | null | false | add_mod (lognot a) 1 | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Int.int_t",
"FStar.Int.add_mod",
"FStar.Int.lognot"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b
val mul_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a * b) n ==> a * b = c))
let mul_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a * b) @% (pow2 n)
#pop-options
(* Division primitives *)
let div (#n:pos) (a:int_t n) (b:int_t n{b <> 0})
: Pure (int_t n)
(requires (size (a / b) n))
(ensures (fun c -> b <> 0 ==> a / b = c))
= a / b
val div_underspec: #n:pos -> a:int_t n -> b:int_t n{b <> 0} -> Pure (int_t n)
(requires True)
(ensures (fun c ->
(b <> 0 /\ size (a / b) n) ==> a / b = c))
val div_size: #n:pos -> a:int_t n{min_int n < a} -> b:int_t n{b <> 0} ->
Lemma (requires (size a n)) (ensures (size (a / b) n))
let udiv (#n:pos) (a:int_t n{min_int n < a}) (b:int_t n{b <> 0})
: Tot (c:int_t n{b <> 0 ==> a / b = c})
= div_size #n a b;
a / b
(* Modulo primitives *)
let mod (#n:pos) (a:int_t n) (b:int_t n{b <> 0}) : Tot (int_t n) =
a - ((a/b) * b)
(* Comparison operators *)
let eq #n (a:int_t n) (b:int_t n) : Tot bool = a = b
let gt #n (a:int_t n) (b:int_t n) : Tot bool = a > b
let gte #n (a:int_t n) (b:int_t n) : Tot bool = a >= b
let lt #n (a:int_t n) (b:int_t n) : Tot bool = a < b
let lte #n (a:int_t n) (b:int_t n) : Tot bool = a <= b
#push-options "--initial_fuel 1 --max_fuel 1"
/// Casts
let to_uint (#n:pos) (x:int_t n) : Tot (UInt.uint_t n) =
if 0 <= x then x else x + pow2 n
let from_uint (#n:pos) (x:UInt.uint_t n) : Tot (int_t n) =
if x <= max_int n then x else x - pow2 n
val to_uint_injective: #n:pos -> x:int_t n
-> Lemma (ensures from_uint (to_uint x) == x) [SMTPat (to_uint x)]
let to_int_t (m:pos) (a:int) : Tot (int_t m) = a @% pow2 m
open FStar.Seq
(* WARNING: Mind the big endian vs little endian definition *)
let to_vec (#n:pos) (num:int_t n) : Tot (bv_t n) =
UInt.to_vec (to_uint num)
let from_vec (#n:pos) (vec:bv_t n) : Tot (int_t n) =
let x = UInt.from_vec vec in
if max_int n < x then x - pow2 n else x
val to_vec_lemma_1: #n:pos -> a:int_t n -> b:int_t n ->
Lemma (requires a = b) (ensures equal (to_vec a) (to_vec b))
val to_vec_lemma_2: #n:pos -> a:int_t n -> b:int_t n ->
Lemma (requires equal (to_vec a) (to_vec b)) (ensures a = b)
val inverse_aux: #n:nat -> vec:bv_t n -> i:nat{i < n} ->
Lemma (requires True) (ensures index vec i = index (to_vec (from_vec vec)) i)
[SMTPat (index (to_vec (from_vec vec)) i)]
val inverse_vec_lemma: #n:pos -> vec:bv_t n ->
Lemma (requires True) (ensures equal vec (to_vec (from_vec vec)))
[SMTPat (to_vec (from_vec vec))]
val inverse_num_lemma: #n:pos -> num:int_t n ->
Lemma (requires True) (ensures num = from_vec (to_vec num))
[SMTPat (from_vec (to_vec num))]
val from_vec_lemma_1: #n:pos -> a:bv_t n -> b:bv_t n ->
Lemma (requires equal a b) (ensures from_vec a = from_vec b)
val from_vec_lemma_2: #n:pos -> a:bv_t n -> b:bv_t n ->
Lemma (requires from_vec a = from_vec b) (ensures equal a b)
(* Relations between constants in BitVector and in UInt. *)
val zero_to_vec_lemma: #n:pos -> i:nat{i < n} ->
Lemma (requires True) (ensures index (to_vec (zero n)) i = index (zero_vec #n) i)
[SMTPat (index (to_vec (zero n)) i)]
val zero_from_vec_lemma: #n:pos ->
Lemma (requires True) (ensures from_vec (zero_vec #n) = zero n)
[SMTPat (from_vec (zero_vec #n))]
val one_to_vec_lemma: #n:pos{1 < n} -> i:nat{i < n} ->
Lemma (requires True)
(ensures index (to_vec (one n)) i = index (elem_vec #n (n - 1)) i)
[SMTPat (index (to_vec (one n)) i)]
val pow2_to_vec_lemma: #n:pos -> p:nat{p < n-1} -> i:nat{i < n} ->
Lemma (requires True)
(ensures index (to_vec (pow2_n #n p)) i = index (elem_vec #n (n - p - 1)) i)
[SMTPat (index (to_vec (pow2_n #n p)) i)]
val pow2_from_vec_lemma: #n:pos -> p:pos{p < n-1} ->
Lemma (requires True) (ensures from_vec (elem_vec #n p) = pow2_n #n (n - p - 1))
[SMTPat (from_vec (elem_vec #n p))]
val ones_to_vec_lemma: #n:pos -> i:nat{i < n} ->
Lemma (requires True)
(ensures index (to_vec (ones n)) i = index (ones_vec #n) i)
[SMTPat (index (to_vec (ones n)) i)]
val ones_from_vec_lemma: #n:pos ->
Lemma (requires True) (ensures from_vec (ones_vec #n) = ones n)
[SMTPat (from_vec (ones_vec #n))]
(* (nth a i) returns a boolean indicating the i-th bit of a. *)
let nth (#n:pos) (a:int_t n) (i:nat{i < n}) : Tot bool = index (to_vec #n a) i
val nth_lemma: #n:pos -> a:int_t n -> b:int_t n ->
Lemma (requires forall (i:nat{i < n}). nth a i = nth b i)
(ensures a = b)
(* Lemmas for constants *)
val zero_nth_lemma: #n:pos -> i:nat{i < n} ->
Lemma (requires True) (ensures nth (zero n) i = false)
[SMTPat (nth (zero n) i)]
val one_nth_lemma: #n:pos{1 < n} -> i:nat{i < n} ->
Lemma (requires True)
(ensures (i = n - 1 ==> nth (one n) i = true) /\
(i < n - 1 ==> nth (one n) i = false))
[SMTPat (nth (one n) i)]
val ones_nth_lemma: #n:pos -> i:nat{i < n} ->
Lemma (requires True) (ensures (nth (ones n) i) = true)
[SMTPat (nth (ones n) i)]
(* Bitwise operators *)
let logand (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
from_vec #n (logand_vec #n (to_vec #n a) (to_vec #n b))
let logxor (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
from_vec #n (logxor_vec #n (to_vec #n a) (to_vec #n b))
let logor (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
from_vec #n (logor_vec #n (to_vec #n a) (to_vec #n b))
let lognot (#n:pos) (a:int_t n) : Tot (int_t n)=
from_vec #n (lognot_vec #n (to_vec #n a))
(* Bitwise operators definitions *)
val logand_definition: #n:pos -> a:int_t n -> b:int_t n -> i:nat{i < n} ->
Lemma (requires True)
(ensures (nth (logand a b) i = (nth a i && nth b i)))
[SMTPat (nth (logand a b) i)]
val logxor_definition: #n:pos -> a:int_t n -> b:int_t n -> i:nat{i < n} ->
Lemma (requires True)
(ensures (nth (logxor a b) i = (nth a i <> nth b i)))
[SMTPat (nth (logxor a b) i)]
val logor_definition: #n:pos -> a:int_t n -> b:int_t n -> i:nat{i < n} ->
Lemma (requires True)
(ensures (nth (logor a b) i = (nth a i || nth b i)))
[SMTPat (nth (logor a b) i)]
val lognot_definition: #n:pos -> a:int_t n -> i:nat{i < n} ->
Lemma (requires True)
(ensures (nth (lognot a) i = not(nth a i)))
[SMTPat (nth (lognot a) i)]
(* Two's complement unary minus *)
inline_for_extraction | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 minus (#n: pos{1 < n}) (a: int_t n) : Tot (int_t n) | [] | FStar.Int.minus | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> FStar.Int.int_t n | {
"end_col": 22,
"end_line": 328,
"start_col": 2,
"start_line": 328
} |
Prims.Tot | val to_vec (#n: pos) (num: int_t n) : Tot (bv_t n) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 to_vec (#n:pos) (num:int_t n) : Tot (bv_t n) =
UInt.to_vec (to_uint num) | val to_vec (#n: pos) (num: int_t n) : Tot (bv_t n)
let to_vec (#n: pos) (num: int_t n) : Tot (bv_t n) = | false | null | false | UInt.to_vec (to_uint num) | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.Int.int_t",
"FStar.UInt.to_vec",
"FStar.Int.to_uint",
"FStar.BitVector.bv_t"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b
val mul_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a * b) n ==> a * b = c))
let mul_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a * b) @% (pow2 n)
#pop-options
(* Division primitives *)
let div (#n:pos) (a:int_t n) (b:int_t n{b <> 0})
: Pure (int_t n)
(requires (size (a / b) n))
(ensures (fun c -> b <> 0 ==> a / b = c))
= a / b
val div_underspec: #n:pos -> a:int_t n -> b:int_t n{b <> 0} -> Pure (int_t n)
(requires True)
(ensures (fun c ->
(b <> 0 /\ size (a / b) n) ==> a / b = c))
val div_size: #n:pos -> a:int_t n{min_int n < a} -> b:int_t n{b <> 0} ->
Lemma (requires (size a n)) (ensures (size (a / b) n))
let udiv (#n:pos) (a:int_t n{min_int n < a}) (b:int_t n{b <> 0})
: Tot (c:int_t n{b <> 0 ==> a / b = c})
= div_size #n a b;
a / b
(* Modulo primitives *)
let mod (#n:pos) (a:int_t n) (b:int_t n{b <> 0}) : Tot (int_t n) =
a - ((a/b) * b)
(* Comparison operators *)
let eq #n (a:int_t n) (b:int_t n) : Tot bool = a = b
let gt #n (a:int_t n) (b:int_t n) : Tot bool = a > b
let gte #n (a:int_t n) (b:int_t n) : Tot bool = a >= b
let lt #n (a:int_t n) (b:int_t n) : Tot bool = a < b
let lte #n (a:int_t n) (b:int_t n) : Tot bool = a <= b
#push-options "--initial_fuel 1 --max_fuel 1"
/// Casts
let to_uint (#n:pos) (x:int_t n) : Tot (UInt.uint_t n) =
if 0 <= x then x else x + pow2 n
let from_uint (#n:pos) (x:UInt.uint_t n) : Tot (int_t n) =
if x <= max_int n then x else x - pow2 n
val to_uint_injective: #n:pos -> x:int_t n
-> Lemma (ensures from_uint (to_uint x) == x) [SMTPat (to_uint x)]
let to_int_t (m:pos) (a:int) : Tot (int_t m) = a @% pow2 m
open FStar.Seq
(* WARNING: Mind the big endian vs little endian definition *) | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 to_vec (#n: pos) (num: int_t n) : Tot (bv_t n) | [] | FStar.Int.to_vec | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | num: FStar.Int.int_t n -> FStar.BitVector.bv_t n | {
"end_col": 27,
"end_line": 206,
"start_col": 2,
"start_line": 206
} |
Prims.Pure | val div (#n: pos) (a: int_t n) (b: int_t n {b <> 0})
: Pure (int_t n) (requires (size (a / b) n)) (ensures (fun c -> b <> 0 ==> a / b = c)) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 (#n:pos) (a:int_t n) (b:int_t n{b <> 0})
: Pure (int_t n)
(requires (size (a / b) n))
(ensures (fun c -> b <> 0 ==> a / b = c))
= a / b | val div (#n: pos) (a: int_t n) (b: int_t n {b <> 0})
: Pure (int_t n) (requires (size (a / b) n)) (ensures (fun c -> b <> 0 ==> a / b = c))
let div (#n: pos) (a: int_t n) (b: int_t n {b <> 0})
: Pure (int_t n) (requires (size (a / b) n)) (ensures (fun c -> b <> 0 ==> a / b = c)) = | false | null | false | a / b | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [] | [
"Prims.pos",
"FStar.Int.int_t",
"Prims.b2t",
"Prims.op_disEquality",
"Prims.int",
"FStar.Int.op_Slash",
"FStar.Int.size",
"Prims.l_imp",
"Prims.op_Equality"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b
val mul_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a * b) n ==> a * b = c))
let mul_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a * b) @% (pow2 n)
#pop-options
(* Division primitives *)
let div (#n:pos) (a:int_t n) (b:int_t n{b <> 0})
: Pure (int_t n)
(requires (size (a / b) n)) | false | false | FStar.Int.fsti | {
"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 div (#n: pos) (a: int_t n) (b: int_t n {b <> 0})
: Pure (int_t n) (requires (size (a / b) n)) (ensures (fun c -> b <> 0 ==> a / b = c)) | [] | FStar.Int.div | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> b: FStar.Int.int_t n {b <> 0} -> Prims.Pure (FStar.Int.int_t n) | {
"end_col": 7,
"end_line": 159,
"start_col": 2,
"start_line": 159
} |
Prims.Tot | val to_int_t (m: pos) (a: int) : Tot (int_t m) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 to_int_t (m:pos) (a:int) : Tot (int_t m) = a @% pow2 m | val to_int_t (m: pos) (a: int) : Tot (int_t m)
let to_int_t (m: pos) (a: int) : Tot (int_t m) = | false | null | false | a @% pow2 m | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"Prims.int",
"FStar.Int.op_At_Percent",
"Prims.pow2",
"FStar.Int.int_t"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b
val mul_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a * b) n ==> a * b = c))
let mul_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a * b) @% (pow2 n)
#pop-options
(* Division primitives *)
let div (#n:pos) (a:int_t n) (b:int_t n{b <> 0})
: Pure (int_t n)
(requires (size (a / b) n))
(ensures (fun c -> b <> 0 ==> a / b = c))
= a / b
val div_underspec: #n:pos -> a:int_t n -> b:int_t n{b <> 0} -> Pure (int_t n)
(requires True)
(ensures (fun c ->
(b <> 0 /\ size (a / b) n) ==> a / b = c))
val div_size: #n:pos -> a:int_t n{min_int n < a} -> b:int_t n{b <> 0} ->
Lemma (requires (size a n)) (ensures (size (a / b) n))
let udiv (#n:pos) (a:int_t n{min_int n < a}) (b:int_t n{b <> 0})
: Tot (c:int_t n{b <> 0 ==> a / b = c})
= div_size #n a b;
a / b
(* Modulo primitives *)
let mod (#n:pos) (a:int_t n) (b:int_t n{b <> 0}) : Tot (int_t n) =
a - ((a/b) * b)
(* Comparison operators *)
let eq #n (a:int_t n) (b:int_t n) : Tot bool = a = b
let gt #n (a:int_t n) (b:int_t n) : Tot bool = a > b
let gte #n (a:int_t n) (b:int_t n) : Tot bool = a >= b
let lt #n (a:int_t n) (b:int_t n) : Tot bool = a < b
let lte #n (a:int_t n) (b:int_t n) : Tot bool = a <= b
#push-options "--initial_fuel 1 --max_fuel 1"
/// Casts
let to_uint (#n:pos) (x:int_t n) : Tot (UInt.uint_t n) =
if 0 <= x then x else x + pow2 n
let from_uint (#n:pos) (x:UInt.uint_t n) : Tot (int_t n) =
if x <= max_int n then x else x - pow2 n
val to_uint_injective: #n:pos -> x:int_t n
-> Lemma (ensures from_uint (to_uint x) == x) [SMTPat (to_uint x)] | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 to_int_t (m: pos) (a: int) : Tot (int_t m) | [] | FStar.Int.to_int_t | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | m: Prims.pos -> a: Prims.int -> FStar.Int.int_t m | {
"end_col": 58,
"end_line": 199,
"start_col": 47,
"start_line": 199
} |
Prims.Tot | val to_uint (#n: pos) (x: int_t n) : Tot (UInt.uint_t n) | [
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 to_uint (#n:pos) (x:int_t n) : Tot (UInt.uint_t n) =
if 0 <= x then x else x + pow2 n | val to_uint (#n: pos) (x: int_t n) : Tot (UInt.uint_t n)
let to_uint (#n: pos) (x: int_t n) : Tot (UInt.uint_t n) = | false | null | false | if 0 <= x then x else x + pow2 n | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.Int.int_t",
"Prims.op_LessThanOrEqual",
"Prims.bool",
"Prims.op_Addition",
"Prims.pow2",
"FStar.UInt.uint_t"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b
val mul_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a * b) n ==> a * b = c))
let mul_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a * b) @% (pow2 n)
#pop-options
(* Division primitives *)
let div (#n:pos) (a:int_t n) (b:int_t n{b <> 0})
: Pure (int_t n)
(requires (size (a / b) n))
(ensures (fun c -> b <> 0 ==> a / b = c))
= a / b
val div_underspec: #n:pos -> a:int_t n -> b:int_t n{b <> 0} -> Pure (int_t n)
(requires True)
(ensures (fun c ->
(b <> 0 /\ size (a / b) n) ==> a / b = c))
val div_size: #n:pos -> a:int_t n{min_int n < a} -> b:int_t n{b <> 0} ->
Lemma (requires (size a n)) (ensures (size (a / b) n))
let udiv (#n:pos) (a:int_t n{min_int n < a}) (b:int_t n{b <> 0})
: Tot (c:int_t n{b <> 0 ==> a / b = c})
= div_size #n a b;
a / b
(* Modulo primitives *)
let mod (#n:pos) (a:int_t n) (b:int_t n{b <> 0}) : Tot (int_t n) =
a - ((a/b) * b)
(* Comparison operators *)
let eq #n (a:int_t n) (b:int_t n) : Tot bool = a = b
let gt #n (a:int_t n) (b:int_t n) : Tot bool = a > b
let gte #n (a:int_t n) (b:int_t n) : Tot bool = a >= b
let lt #n (a:int_t n) (b:int_t n) : Tot bool = a < b
let lte #n (a:int_t n) (b:int_t n) : Tot bool = a <= b
#push-options "--initial_fuel 1 --max_fuel 1"
/// Casts | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 to_uint (#n: pos) (x: int_t n) : Tot (UInt.uint_t n) | [] | FStar.Int.to_uint | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.Int.int_t n -> FStar.UInt.uint_t n | {
"end_col": 34,
"end_line": 191,
"start_col": 2,
"start_line": 191
} |
Prims.Tot | val nth (#n: pos) (a: int_t n) (i: nat{i < n}) : Tot bool | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 nth (#n:pos) (a:int_t n) (i:nat{i < n}) : Tot bool = index (to_vec #n a) i | val nth (#n: pos) (a: int_t n) (i: nat{i < n}) : Tot bool
let nth (#n: pos) (a: int_t n) (i: nat{i < n}) : Tot bool = | false | null | false | index (to_vec #n a) i | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.Int.int_t",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.index",
"Prims.bool",
"FStar.Int.to_vec"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b
val mul_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a * b) n ==> a * b = c))
let mul_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a * b) @% (pow2 n)
#pop-options
(* Division primitives *)
let div (#n:pos) (a:int_t n) (b:int_t n{b <> 0})
: Pure (int_t n)
(requires (size (a / b) n))
(ensures (fun c -> b <> 0 ==> a / b = c))
= a / b
val div_underspec: #n:pos -> a:int_t n -> b:int_t n{b <> 0} -> Pure (int_t n)
(requires True)
(ensures (fun c ->
(b <> 0 /\ size (a / b) n) ==> a / b = c))
val div_size: #n:pos -> a:int_t n{min_int n < a} -> b:int_t n{b <> 0} ->
Lemma (requires (size a n)) (ensures (size (a / b) n))
let udiv (#n:pos) (a:int_t n{min_int n < a}) (b:int_t n{b <> 0})
: Tot (c:int_t n{b <> 0 ==> a / b = c})
= div_size #n a b;
a / b
(* Modulo primitives *)
let mod (#n:pos) (a:int_t n) (b:int_t n{b <> 0}) : Tot (int_t n) =
a - ((a/b) * b)
(* Comparison operators *)
let eq #n (a:int_t n) (b:int_t n) : Tot bool = a = b
let gt #n (a:int_t n) (b:int_t n) : Tot bool = a > b
let gte #n (a:int_t n) (b:int_t n) : Tot bool = a >= b
let lt #n (a:int_t n) (b:int_t n) : Tot bool = a < b
let lte #n (a:int_t n) (b:int_t n) : Tot bool = a <= b
#push-options "--initial_fuel 1 --max_fuel 1"
/// Casts
let to_uint (#n:pos) (x:int_t n) : Tot (UInt.uint_t n) =
if 0 <= x then x else x + pow2 n
let from_uint (#n:pos) (x:UInt.uint_t n) : Tot (int_t n) =
if x <= max_int n then x else x - pow2 n
val to_uint_injective: #n:pos -> x:int_t n
-> Lemma (ensures from_uint (to_uint x) == x) [SMTPat (to_uint x)]
let to_int_t (m:pos) (a:int) : Tot (int_t m) = a @% pow2 m
open FStar.Seq
(* WARNING: Mind the big endian vs little endian definition *)
let to_vec (#n:pos) (num:int_t n) : Tot (bv_t n) =
UInt.to_vec (to_uint num)
let from_vec (#n:pos) (vec:bv_t n) : Tot (int_t n) =
let x = UInt.from_vec vec in
if max_int n < x then x - pow2 n else x
val to_vec_lemma_1: #n:pos -> a:int_t n -> b:int_t n ->
Lemma (requires a = b) (ensures equal (to_vec a) (to_vec b))
val to_vec_lemma_2: #n:pos -> a:int_t n -> b:int_t n ->
Lemma (requires equal (to_vec a) (to_vec b)) (ensures a = b)
val inverse_aux: #n:nat -> vec:bv_t n -> i:nat{i < n} ->
Lemma (requires True) (ensures index vec i = index (to_vec (from_vec vec)) i)
[SMTPat (index (to_vec (from_vec vec)) i)]
val inverse_vec_lemma: #n:pos -> vec:bv_t n ->
Lemma (requires True) (ensures equal vec (to_vec (from_vec vec)))
[SMTPat (to_vec (from_vec vec))]
val inverse_num_lemma: #n:pos -> num:int_t n ->
Lemma (requires True) (ensures num = from_vec (to_vec num))
[SMTPat (from_vec (to_vec num))]
val from_vec_lemma_1: #n:pos -> a:bv_t n -> b:bv_t n ->
Lemma (requires equal a b) (ensures from_vec a = from_vec b)
val from_vec_lemma_2: #n:pos -> a:bv_t n -> b:bv_t n ->
Lemma (requires from_vec a = from_vec b) (ensures equal a b)
(* Relations between constants in BitVector and in UInt. *)
val zero_to_vec_lemma: #n:pos -> i:nat{i < n} ->
Lemma (requires True) (ensures index (to_vec (zero n)) i = index (zero_vec #n) i)
[SMTPat (index (to_vec (zero n)) i)]
val zero_from_vec_lemma: #n:pos ->
Lemma (requires True) (ensures from_vec (zero_vec #n) = zero n)
[SMTPat (from_vec (zero_vec #n))]
val one_to_vec_lemma: #n:pos{1 < n} -> i:nat{i < n} ->
Lemma (requires True)
(ensures index (to_vec (one n)) i = index (elem_vec #n (n - 1)) i)
[SMTPat (index (to_vec (one n)) i)]
val pow2_to_vec_lemma: #n:pos -> p:nat{p < n-1} -> i:nat{i < n} ->
Lemma (requires True)
(ensures index (to_vec (pow2_n #n p)) i = index (elem_vec #n (n - p - 1)) i)
[SMTPat (index (to_vec (pow2_n #n p)) i)]
val pow2_from_vec_lemma: #n:pos -> p:pos{p < n-1} ->
Lemma (requires True) (ensures from_vec (elem_vec #n p) = pow2_n #n (n - p - 1))
[SMTPat (from_vec (elem_vec #n p))]
val ones_to_vec_lemma: #n:pos -> i:nat{i < n} ->
Lemma (requires True)
(ensures index (to_vec (ones n)) i = index (ones_vec #n) i)
[SMTPat (index (to_vec (ones n)) i)]
val ones_from_vec_lemma: #n:pos ->
Lemma (requires True) (ensures from_vec (ones_vec #n) = ones n)
[SMTPat (from_vec (ones_vec #n))] | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 nth (#n: pos) (a: int_t n) (i: nat{i < n}) : Tot bool | [] | FStar.Int.nth | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.Int.int_t n -> i: Prims.nat{i < n} -> Prims.bool | {
"end_col": 78,
"end_line": 270,
"start_col": 57,
"start_line": 270
} |
Prims.Tot | val from_vec (#n: pos) (vec: bv_t n) : Tot (int_t n) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BitVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"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 from_vec (#n:pos) (vec:bv_t n) : Tot (int_t n) =
let x = UInt.from_vec vec in
if max_int n < x then x - pow2 n else x | val from_vec (#n: pos) (vec: bv_t n) : Tot (int_t n)
let from_vec (#n: pos) (vec: bv_t n) : Tot (int_t n) = | false | null | false | let x = UInt.from_vec vec in
if max_int n < x then x - pow2 n else x | {
"checked_file": "FStar.Int.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Int.fsti"
} | [
"total"
] | [
"Prims.pos",
"FStar.BitVector.bv_t",
"Prims.op_LessThan",
"FStar.Int.max_int",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.bool",
"FStar.Int.int_t",
"FStar.UInt.uint_t",
"FStar.UInt.from_vec"
] | [] | (*
Copyright 2008-2018 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.Int
(* NOTE: anything that you fix/update here should be reflected in [FStar.UInt.fsti], which is mostly
* a copy-paste of this module. *)
open FStar.Mul
open FStar.BitVector
open FStar.Math.Lemmas
val pow2_values: x:nat -> Lemma
(let p = pow2 x in
match x with
| 0 -> p=1
| 1 -> p=2
| 8 -> p=256
| 16 -> p=65536
| 31 -> p=2147483648
| 32 -> p=4294967296
| 63 -> p=9223372036854775808
| 64 -> p=18446744073709551616
| _ -> True)
[SMTPat (pow2 x)]
/// Specs
let max_int (n:pos) : Tot int = pow2 (n-1) - 1
let min_int (n:pos) : Tot int = - (pow2 (n-1))
let fits (x:int) (n:pos) : Tot bool = min_int n <= x && x <= max_int n
let size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)
(* Machine integer type *)
type int_t (n:pos) = x:int{size x n}
/// Multiplicative operator semantics, see C11 6.5.5
(* Truncation towards zero division *)
let op_Slash (a:int) (b:int{b <> 0}) : Tot int =
if (a >= 0 && b < 0) || (a < 0 && b >= 0) then - (abs a / abs b)
else abs a / abs b
(* Wrap-around modulo: wraps into [-p/2; p/2[ *)
let op_At_Percent (v:int) (p:int{p>0/\ p%2=0}) : Tot int =
let m = v % p in if m >= p/2 then m - p else m
/// Constants
let zero (n:pos) : Tot (int_t n) = 0
#push-options "--initial_fuel 1 --max_fuel 1"
let pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =
pow2_le_compat (n - 2) p; pow2 p
let pow2_minus_one (#n:pos{1 < n}) (m:nat{m < n}) : Tot (int_t n) =
pow2_le_compat (n - 1) m;
pow2 m - 1
let one (n:pos{1 < n}) : Tot (int_t n) = 1
#pop-options
let ones (n:pos) : Tot (int_t n) = -1
(* Increment and decrement *)
let incr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a < max_int n))) (ensures (fun _ -> True))
= a + 1
let decr (#n:pos) (a:int_t n)
: Pure (int_t n)
(requires (b2t (a > min_int n))) (ensures (fun _ -> True))
= a - 1
val incr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a < max_int n)))
(ensures (fun b -> a + 1 = b))
val decr_underspec: #n:pos -> a:int_t n -> Pure (int_t n)
(requires (b2t (a > min_int n)))
(ensures (fun b -> a - 1 = b))
let incr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a + 1) % (pow2 (n-1))
let decr_mod (#n:pos) (a:int_t n) : Tot (int_t n) =
(a - 1) % (pow2 (n-1))
(* Addition primitives *)
let add (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a + b) n))
(ensures (fun _ -> True))
= a + b
val add_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a + b) n ==> a + b = c))
#push-options "--initial_fuel 1 --max_fuel 1"
let add_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a + b) @% (pow2 n)
(* Subtraction primitives *)
let sub (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a - b) n))
(ensures (fun _ -> True))
= a - b
val sub_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a - b) n ==> a - b = c))
let sub_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a - b) @% (pow2 n)
(* Multiplication primitives *)
let mul (#n:pos) (a:int_t n) (b:int_t n)
: Pure (int_t n)
(requires (size (a * b) n))
(ensures (fun _ -> True))
= a * b
val mul_underspec: #n:pos -> a:int_t n -> b:int_t n -> Pure (int_t n)
(requires True)
(ensures (fun c ->
size (a * b) n ==> a * b = c))
let mul_mod (#n:pos) (a:int_t n) (b:int_t n) : Tot (int_t n) =
(a * b) @% (pow2 n)
#pop-options
(* Division primitives *)
let div (#n:pos) (a:int_t n) (b:int_t n{b <> 0})
: Pure (int_t n)
(requires (size (a / b) n))
(ensures (fun c -> b <> 0 ==> a / b = c))
= a / b
val div_underspec: #n:pos -> a:int_t n -> b:int_t n{b <> 0} -> Pure (int_t n)
(requires True)
(ensures (fun c ->
(b <> 0 /\ size (a / b) n) ==> a / b = c))
val div_size: #n:pos -> a:int_t n{min_int n < a} -> b:int_t n{b <> 0} ->
Lemma (requires (size a n)) (ensures (size (a / b) n))
let udiv (#n:pos) (a:int_t n{min_int n < a}) (b:int_t n{b <> 0})
: Tot (c:int_t n{b <> 0 ==> a / b = c})
= div_size #n a b;
a / b
(* Modulo primitives *)
let mod (#n:pos) (a:int_t n) (b:int_t n{b <> 0}) : Tot (int_t n) =
a - ((a/b) * b)
(* Comparison operators *)
let eq #n (a:int_t n) (b:int_t n) : Tot bool = a = b
let gt #n (a:int_t n) (b:int_t n) : Tot bool = a > b
let gte #n (a:int_t n) (b:int_t n) : Tot bool = a >= b
let lt #n (a:int_t n) (b:int_t n) : Tot bool = a < b
let lte #n (a:int_t n) (b:int_t n) : Tot bool = a <= b
#push-options "--initial_fuel 1 --max_fuel 1"
/// Casts
let to_uint (#n:pos) (x:int_t n) : Tot (UInt.uint_t n) =
if 0 <= x then x else x + pow2 n
let from_uint (#n:pos) (x:UInt.uint_t n) : Tot (int_t n) =
if x <= max_int n then x else x - pow2 n
val to_uint_injective: #n:pos -> x:int_t n
-> Lemma (ensures from_uint (to_uint x) == x) [SMTPat (to_uint x)]
let to_int_t (m:pos) (a:int) : Tot (int_t m) = a @% pow2 m
open FStar.Seq
(* WARNING: Mind the big endian vs little endian definition *)
let to_vec (#n:pos) (num:int_t n) : Tot (bv_t n) =
UInt.to_vec (to_uint num) | false | false | FStar.Int.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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 from_vec (#n: pos) (vec: bv_t n) : Tot (int_t n) | [] | FStar.Int.from_vec | {
"file_name": "ulib/FStar.Int.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | vec: FStar.BitVector.bv_t n -> FStar.Int.int_t n | {
"end_col": 41,
"end_line": 210,
"start_col": 52,
"start_line": 208
} |
Prims.Tot | [
{
"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 alg = fixed_len_alg | let alg = | false | null | false | fixed_len_alg | {
"checked_file": "EverCrypt.Hash.fsti.checked",
"dependencies": [
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Integers.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"EverCrypt.Helpers.fsti.checked",
"C.String.fsti.checked"
],
"interface_file": false,
"source_file": "EverCrypt.Hash.fsti"
} | [
"total"
] | [
"Spec.Hash.Definitions.fixed_len_alg"
] | [] | module EverCrypt.Hash
open EverCrypt.Helpers
open FStar.HyperStack.ST
open FStar.Integers
open Spec.Hash.Definitions
open Hacl.Hash.Definitions
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
/// Algorithmic agility for hash specifications. We reuse the agile
/// specifications from HACL*'s specs/ directory.
/// SUPPORTED ALGORITHMS see e.g. https://en.wikipedia.org/wiki/SHA-1
/// for a global comparison and lengths
///
/// * We support all variants of SHA2.
/// * MD5 and SHA1 are still required by TLS 1.2, included for legacy
/// purpose only
/// * SHA3 will be provided by HACL*
///
/// ``hash_alg``, from Spec.Hash.Definitions, lists all supported algorithms | false | true | EverCrypt.Hash.fsti | {
"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 alg : Type0 | [] | EverCrypt.Hash.alg | {
"file_name": "providers/evercrypt/EverCrypt.Hash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 23,
"end_line": 24,
"start_col": 10,
"start_line": 24
} |
|
Prims.Tot | val preserves_freeable (#a: _) (s: state a) (h0 h1: 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 preserves_freeable #a (s: state a) (h0 h1: HS.mem): Type0 =
freeable h0 s ==> freeable h1 s | val preserves_freeable (#a: _) (s: state a) (h0 h1: HS.mem) : Type0
let preserves_freeable #a (s: state a) (h0: HS.mem) (h1: HS.mem) : Type0 = | false | null | false | freeable h0 s ==> freeable h1 s | {
"checked_file": "EverCrypt.Hash.fsti.checked",
"dependencies": [
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Integers.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"EverCrypt.Helpers.fsti.checked",
"C.String.fsti.checked"
],
"interface_file": false,
"source_file": "EverCrypt.Hash.fsti"
} | [
"total"
] | [
"EverCrypt.Hash.alg",
"EverCrypt.Hash.state",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_imp",
"EverCrypt.Hash.freeable"
] | [] | module EverCrypt.Hash
open EverCrypt.Helpers
open FStar.HyperStack.ST
open FStar.Integers
open Spec.Hash.Definitions
open Hacl.Hash.Definitions
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
/// Algorithmic agility for hash specifications. We reuse the agile
/// specifications from HACL*'s specs/ directory.
/// SUPPORTED ALGORITHMS see e.g. https://en.wikipedia.org/wiki/SHA-1
/// for a global comparison and lengths
///
/// * We support all variants of SHA2.
/// * MD5 and SHA1 are still required by TLS 1.2, included for legacy
/// purpose only
/// * SHA3 will be provided by HACL*
///
/// ``hash_alg``, from Spec.Hash.Definitions, lists all supported algorithms
unfold
let alg = fixed_len_alg
/// TODO: move this one to Hacl.Hash.Definitions
val string_of_alg: alg -> C.String.t
/// kept only for functional backward compatibility, never assumed to be secure
type broken_alg = a:alg {a = MD5 \/ a = SHA1}
/// HMAC/HKDF ALGORITHMS; we make security assumptions only for constructions
/// based on those.
type alg13 = a:alg { a=SHA2_256 \/ a=SHA2_384 \/ a=SHA2_512 }
/// No pattern (would fire too often)!
let uint32_fits_maxLength (a: alg) (x: UInt32.t): Lemma
(requires True)
(ensures UInt32.v x `less_than_max_input_length` a)
=
assert_norm (pow2 32 < pow2 61);
assert_norm (pow2 61 < pow2 125)
/// To specify their low-level incremental computations, we assume
/// Merkle-Damgard/sponge-like algorithms:
///
/// The hash state is kept in an accumulator, with
/// - an initial value
/// - an update function, adding a block of bytes;
/// - an extract (also: "finish") function, returning a hash tag.
///
/// Before hashing, some algorithm-specific padding and length encoding is
/// appended to the input bytestring.
///
/// This is not a general-purpose incremental specification, which would support
/// adding text fragments of arbitrary lengths (for that, see
/// EverCrypt.Hash.Incremental).
/// Stateful interface implementing the agile specifications.
module HS = FStar.HyperStack
module B = LowStar.Buffer
module M = LowStar.Modifies
module G = FStar.Ghost
open LowStar.BufferOps
/// do not use as argument of ghost functions
type e_alg = G.erased alg
[@CAbstractStruct]
val state_s: alg -> Type0
// pointer to abstract implementation state
let state alg = B.pointer (state_s alg)
// abstract freeable (deep) predicate; only needed for create/free pairs
inline_for_extraction noextract
val freeable_s: #(a: alg) -> state_s a -> Type0
inline_for_extraction noextract
let freeable (#a: alg) (h: HS.mem) (p: state a) =
B.freeable p /\ freeable_s (B.deref h p)
// NS: note that the state is the first argument to the invariant so that we can
// do partial applications in pre- and post-conditions
val footprint_s: #a:alg -> state_s a -> GTot M.loc
let footprint (#a:alg) (s: state a) (m: HS.mem) =
M.(loc_union (loc_addr_of_buffer s) (footprint_s (B.deref m s)))
// TR: the following pattern is necessary because, if we generically
// add such a pattern directly on `loc_includes_union_l`, then
// verification will blowup whenever both sides of `loc_includes` are
// `loc_union`s. We would like to break all unions on the
// right-hand-side of `loc_includes` first, using
// `loc_includes_union_r`. Here the pattern is on `footprint_s`,
// because we already expose the fact that `footprint` is a
// `loc_union`. (In other words, the pattern should be on every
// smallest location that is not exposed to be a `loc_union`.)
let loc_includes_union_l_footprint_s
(l1 l2: M.loc) (#a: alg) (s: state_s a)
: Lemma
(requires (
M.loc_includes l1 (footprint_s s) \/ M.loc_includes l2 (footprint_s s)
))
(ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))
[SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))]
= M.loc_includes_union_l l1 l2 (footprint_s s)
inline_for_extraction noextract
val invariant_s: (#a:alg) -> state_s a -> HS.mem -> Type0
inline_for_extraction noextract
let invariant (#a:alg) (s: state a) (m: HS.mem) =
B.live m s /\
M.(loc_disjoint (loc_addr_of_buffer s) (footprint_s (B.deref m s))) /\
invariant_s (B.get m s 0) m
//18-07-06 as_acc a better name? not really a representation
val repr: #a:alg ->
s:state a -> h:HS.mem -> GTot (words_state a)
val alg_of_state: a:e_alg -> (
let a = G.reveal a in
s: state a -> Stack alg
(fun h0 -> invariant s h0)
(fun h0 a' h1 -> h0 == h1 /\ a' == a))
val fresh_is_disjoint: l1:M.loc -> l2:M.loc -> h0:HS.mem -> h1:HS.mem -> Lemma
(requires (B.fresh_loc l1 h0 h1 /\ l2 `B.loc_in` h0))
(ensures (M.loc_disjoint l1 l2))
// TR: this lemma is necessary to prove that the footprint is disjoint
// from any fresh memory location.
val invariant_loc_in_footprint
(#a: alg)
(s: state a)
(m: HS.mem)
: Lemma
(requires (invariant s m))
(ensures (B.loc_in (footprint s m) m))
[SMTPat (invariant s m)]
// TR: frame_invariant, just like all lemmas eliminating `modifies`
// clauses, should have `modifies_inert` as a precondition instead of
// `modifies`, in order to use it in all cases where a modifies clause
// is produced but should not be composed with `modifies_trans` for
// pattern reasons (e.g. push_frame, pop_frame)
// 18-07-12 why not bundling the next two lemmas?
val frame_invariant: #a:alg -> l:M.loc -> s:state a -> h0:HS.mem -> h1:HS.mem -> Lemma
(requires (
invariant s h0 /\
M.loc_disjoint l (footprint s h0) /\
M.modifies l h0 h1))
(ensures (
invariant s h1 /\
repr s h0 == repr s h1))
let frame_invariant_implies_footprint_preservation
(#a: alg)
(l: M.loc)
(s: state a)
(h0 h1: HS.mem): Lemma
(requires (
invariant s h0 /\
M.loc_disjoint l (footprint s h0) /\
M.modifies l h0 h1))
(ensures (
footprint s h1 == footprint s h0))
=
()
inline_for_extraction noextract | false | false | EverCrypt.Hash.fsti | {
"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 preserves_freeable (#a: _) (s: state a) (h0 h1: HS.mem) : Type0 | [] | EverCrypt.Hash.preserves_freeable | {
"file_name": "providers/evercrypt/EverCrypt.Hash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
s: EverCrypt.Hash.state a ->
h0: FStar.Monotonic.HyperStack.mem ->
h1: FStar.Monotonic.HyperStack.mem
-> Type0 | {
"end_col": 33,
"end_line": 180,
"start_col": 2,
"start_line": 180
} |
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 state alg = B.pointer (state_s alg) | let state alg = | false | null | false | B.pointer (state_s alg) | {
"checked_file": "EverCrypt.Hash.fsti.checked",
"dependencies": [
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Integers.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"EverCrypt.Helpers.fsti.checked",
"C.String.fsti.checked"
],
"interface_file": false,
"source_file": "EverCrypt.Hash.fsti"
} | [
"total"
] | [
"EverCrypt.Hash.alg",
"LowStar.Buffer.pointer",
"EverCrypt.Hash.state_s"
] | [] | module EverCrypt.Hash
open EverCrypt.Helpers
open FStar.HyperStack.ST
open FStar.Integers
open Spec.Hash.Definitions
open Hacl.Hash.Definitions
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
/// Algorithmic agility for hash specifications. We reuse the agile
/// specifications from HACL*'s specs/ directory.
/// SUPPORTED ALGORITHMS see e.g. https://en.wikipedia.org/wiki/SHA-1
/// for a global comparison and lengths
///
/// * We support all variants of SHA2.
/// * MD5 and SHA1 are still required by TLS 1.2, included for legacy
/// purpose only
/// * SHA3 will be provided by HACL*
///
/// ``hash_alg``, from Spec.Hash.Definitions, lists all supported algorithms
unfold
let alg = fixed_len_alg
/// TODO: move this one to Hacl.Hash.Definitions
val string_of_alg: alg -> C.String.t
/// kept only for functional backward compatibility, never assumed to be secure
type broken_alg = a:alg {a = MD5 \/ a = SHA1}
/// HMAC/HKDF ALGORITHMS; we make security assumptions only for constructions
/// based on those.
type alg13 = a:alg { a=SHA2_256 \/ a=SHA2_384 \/ a=SHA2_512 }
/// No pattern (would fire too often)!
let uint32_fits_maxLength (a: alg) (x: UInt32.t): Lemma
(requires True)
(ensures UInt32.v x `less_than_max_input_length` a)
=
assert_norm (pow2 32 < pow2 61);
assert_norm (pow2 61 < pow2 125)
/// To specify their low-level incremental computations, we assume
/// Merkle-Damgard/sponge-like algorithms:
///
/// The hash state is kept in an accumulator, with
/// - an initial value
/// - an update function, adding a block of bytes;
/// - an extract (also: "finish") function, returning a hash tag.
///
/// Before hashing, some algorithm-specific padding and length encoding is
/// appended to the input bytestring.
///
/// This is not a general-purpose incremental specification, which would support
/// adding text fragments of arbitrary lengths (for that, see
/// EverCrypt.Hash.Incremental).
/// Stateful interface implementing the agile specifications.
module HS = FStar.HyperStack
module B = LowStar.Buffer
module M = LowStar.Modifies
module G = FStar.Ghost
open LowStar.BufferOps
/// do not use as argument of ghost functions
type e_alg = G.erased alg
[@CAbstractStruct]
val state_s: alg -> Type0 | false | true | EverCrypt.Hash.fsti | {
"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 state : alg: EverCrypt.Hash.alg -> Type0 | [] | EverCrypt.Hash.state | {
"file_name": "providers/evercrypt/EverCrypt.Hash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | alg: EverCrypt.Hash.alg -> Type0 | {
"end_col": 39,
"end_line": 76,
"start_col": 16,
"start_line": 76
} |
|
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 freeable (#a: alg) (h: HS.mem) (p: state a) =
B.freeable p /\ freeable_s (B.deref h p) | let freeable (#a: alg) (h: HS.mem) (p: state a) = | false | null | false | B.freeable p /\ freeable_s (B.deref h p) | {
"checked_file": "EverCrypt.Hash.fsti.checked",
"dependencies": [
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Integers.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"EverCrypt.Helpers.fsti.checked",
"C.String.fsti.checked"
],
"interface_file": false,
"source_file": "EverCrypt.Hash.fsti"
} | [
"total"
] | [
"EverCrypt.Hash.alg",
"FStar.Monotonic.HyperStack.mem",
"EverCrypt.Hash.state",
"Prims.l_and",
"LowStar.Monotonic.Buffer.freeable",
"EverCrypt.Hash.state_s",
"LowStar.Buffer.trivial_preorder",
"EverCrypt.Hash.freeable_s",
"LowStar.Monotonic.Buffer.deref",
"Prims.logical"
] | [] | module EverCrypt.Hash
open EverCrypt.Helpers
open FStar.HyperStack.ST
open FStar.Integers
open Spec.Hash.Definitions
open Hacl.Hash.Definitions
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
/// Algorithmic agility for hash specifications. We reuse the agile
/// specifications from HACL*'s specs/ directory.
/// SUPPORTED ALGORITHMS see e.g. https://en.wikipedia.org/wiki/SHA-1
/// for a global comparison and lengths
///
/// * We support all variants of SHA2.
/// * MD5 and SHA1 are still required by TLS 1.2, included for legacy
/// purpose only
/// * SHA3 will be provided by HACL*
///
/// ``hash_alg``, from Spec.Hash.Definitions, lists all supported algorithms
unfold
let alg = fixed_len_alg
/// TODO: move this one to Hacl.Hash.Definitions
val string_of_alg: alg -> C.String.t
/// kept only for functional backward compatibility, never assumed to be secure
type broken_alg = a:alg {a = MD5 \/ a = SHA1}
/// HMAC/HKDF ALGORITHMS; we make security assumptions only for constructions
/// based on those.
type alg13 = a:alg { a=SHA2_256 \/ a=SHA2_384 \/ a=SHA2_512 }
/// No pattern (would fire too often)!
let uint32_fits_maxLength (a: alg) (x: UInt32.t): Lemma
(requires True)
(ensures UInt32.v x `less_than_max_input_length` a)
=
assert_norm (pow2 32 < pow2 61);
assert_norm (pow2 61 < pow2 125)
/// To specify their low-level incremental computations, we assume
/// Merkle-Damgard/sponge-like algorithms:
///
/// The hash state is kept in an accumulator, with
/// - an initial value
/// - an update function, adding a block of bytes;
/// - an extract (also: "finish") function, returning a hash tag.
///
/// Before hashing, some algorithm-specific padding and length encoding is
/// appended to the input bytestring.
///
/// This is not a general-purpose incremental specification, which would support
/// adding text fragments of arbitrary lengths (for that, see
/// EverCrypt.Hash.Incremental).
/// Stateful interface implementing the agile specifications.
module HS = FStar.HyperStack
module B = LowStar.Buffer
module M = LowStar.Modifies
module G = FStar.Ghost
open LowStar.BufferOps
/// do not use as argument of ghost functions
type e_alg = G.erased alg
[@CAbstractStruct]
val state_s: alg -> Type0
// pointer to abstract implementation state
let state alg = B.pointer (state_s alg)
// abstract freeable (deep) predicate; only needed for create/free pairs
inline_for_extraction noextract
val freeable_s: #(a: alg) -> state_s a -> Type0
inline_for_extraction noextract | false | false | EverCrypt.Hash.fsti | {
"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 : h: FStar.Monotonic.HyperStack.mem -> p: EverCrypt.Hash.state a -> Prims.logical | [] | EverCrypt.Hash.freeable | {
"file_name": "providers/evercrypt/EverCrypt.Hash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | h: FStar.Monotonic.HyperStack.mem -> p: EverCrypt.Hash.state a -> Prims.logical | {
"end_col": 42,
"end_line": 84,
"start_col": 2,
"start_line": 84
} |
|
Prims.GTot | [
{
"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 (#a:alg) (s: state a) (m: HS.mem) =
M.(loc_union (loc_addr_of_buffer s) (footprint_s (B.deref m s))) | let footprint (#a: alg) (s: state a) (m: HS.mem) = | false | null | false | let open M in loc_union (loc_addr_of_buffer s) (footprint_s (B.deref m s)) | {
"checked_file": "EverCrypt.Hash.fsti.checked",
"dependencies": [
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Integers.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"EverCrypt.Helpers.fsti.checked",
"C.String.fsti.checked"
],
"interface_file": false,
"source_file": "EverCrypt.Hash.fsti"
} | [
"sometrivial"
] | [
"EverCrypt.Hash.alg",
"EverCrypt.Hash.state",
"FStar.Monotonic.HyperStack.mem",
"LowStar.Monotonic.Buffer.loc_union",
"LowStar.Monotonic.Buffer.loc_addr_of_buffer",
"EverCrypt.Hash.state_s",
"LowStar.Buffer.trivial_preorder",
"EverCrypt.Hash.footprint_s",
"LowStar.Monotonic.Buffer.deref",
"LowStar.Monotonic.Buffer.loc"
] | [] | module EverCrypt.Hash
open EverCrypt.Helpers
open FStar.HyperStack.ST
open FStar.Integers
open Spec.Hash.Definitions
open Hacl.Hash.Definitions
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
/// Algorithmic agility for hash specifications. We reuse the agile
/// specifications from HACL*'s specs/ directory.
/// SUPPORTED ALGORITHMS see e.g. https://en.wikipedia.org/wiki/SHA-1
/// for a global comparison and lengths
///
/// * We support all variants of SHA2.
/// * MD5 and SHA1 are still required by TLS 1.2, included for legacy
/// purpose only
/// * SHA3 will be provided by HACL*
///
/// ``hash_alg``, from Spec.Hash.Definitions, lists all supported algorithms
unfold
let alg = fixed_len_alg
/// TODO: move this one to Hacl.Hash.Definitions
val string_of_alg: alg -> C.String.t
/// kept only for functional backward compatibility, never assumed to be secure
type broken_alg = a:alg {a = MD5 \/ a = SHA1}
/// HMAC/HKDF ALGORITHMS; we make security assumptions only for constructions
/// based on those.
type alg13 = a:alg { a=SHA2_256 \/ a=SHA2_384 \/ a=SHA2_512 }
/// No pattern (would fire too often)!
let uint32_fits_maxLength (a: alg) (x: UInt32.t): Lemma
(requires True)
(ensures UInt32.v x `less_than_max_input_length` a)
=
assert_norm (pow2 32 < pow2 61);
assert_norm (pow2 61 < pow2 125)
/// To specify their low-level incremental computations, we assume
/// Merkle-Damgard/sponge-like algorithms:
///
/// The hash state is kept in an accumulator, with
/// - an initial value
/// - an update function, adding a block of bytes;
/// - an extract (also: "finish") function, returning a hash tag.
///
/// Before hashing, some algorithm-specific padding and length encoding is
/// appended to the input bytestring.
///
/// This is not a general-purpose incremental specification, which would support
/// adding text fragments of arbitrary lengths (for that, see
/// EverCrypt.Hash.Incremental).
/// Stateful interface implementing the agile specifications.
module HS = FStar.HyperStack
module B = LowStar.Buffer
module M = LowStar.Modifies
module G = FStar.Ghost
open LowStar.BufferOps
/// do not use as argument of ghost functions
type e_alg = G.erased alg
[@CAbstractStruct]
val state_s: alg -> Type0
// pointer to abstract implementation state
let state alg = B.pointer (state_s alg)
// abstract freeable (deep) predicate; only needed for create/free pairs
inline_for_extraction noextract
val freeable_s: #(a: alg) -> state_s a -> Type0
inline_for_extraction noextract
let freeable (#a: alg) (h: HS.mem) (p: state a) =
B.freeable p /\ freeable_s (B.deref h p)
// NS: note that the state is the first argument to the invariant so that we can
// do partial applications in pre- and post-conditions
val footprint_s: #a:alg -> state_s a -> GTot M.loc | false | false | EverCrypt.Hash.fsti | {
"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: EverCrypt.Hash.state a -> m: FStar.Monotonic.HyperStack.mem
-> Prims.GTot LowStar.Monotonic.Buffer.loc | [] | EverCrypt.Hash.footprint | {
"file_name": "providers/evercrypt/EverCrypt.Hash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: EverCrypt.Hash.state a -> m: FStar.Monotonic.HyperStack.mem
-> Prims.GTot LowStar.Monotonic.Buffer.loc | {
"end_col": 66,
"end_line": 90,
"start_col": 2,
"start_line": 90
} |
|
FStar.HyperStack.ST.ST | val free (#a: e_alg)
: (let a = Ghost.reveal a in
s: state a
-> ST unit
(requires fun h0 -> freeable h0 s /\ invariant s h0)
(ensures fun h0 _ h1 -> let open M in modifies (footprint s h0) h0 h1)) | [
{
"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 free: #a:e_alg -> (
let a = Ghost.reveal a in
s:state a -> ST unit
(requires fun h0 ->
freeable h0 s /\
invariant s h0)
(ensures fun h0 _ h1 ->
M.(modifies (footprint s h0) h0 h1)))
= free_ | val free (#a: e_alg)
: (let a = Ghost.reveal a in
s: state a
-> ST unit
(requires fun h0 -> freeable h0 s /\ invariant s h0)
(ensures fun h0 _ h1 -> let open M in modifies (footprint s h0) h0 h1))
let free: #a: e_alg
-> (let a = Ghost.reveal a in
s: state a
-> ST unit
(requires fun h0 -> freeable h0 s /\ invariant s h0)
(ensures fun h0 _ h1 -> let open M in modifies (footprint s h0) h0 h1)) = | true | null | false | free_ | {
"checked_file": "EverCrypt.Hash.fsti.checked",
"dependencies": [
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Integers.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"EverCrypt.Helpers.fsti.checked",
"C.String.fsti.checked"
],
"interface_file": false,
"source_file": "EverCrypt.Hash.fsti"
} | [] | [
"EverCrypt.Hash.free_"
] | [] | module EverCrypt.Hash
open EverCrypt.Helpers
open FStar.HyperStack.ST
open FStar.Integers
open Spec.Hash.Definitions
open Hacl.Hash.Definitions
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
/// Algorithmic agility for hash specifications. We reuse the agile
/// specifications from HACL*'s specs/ directory.
/// SUPPORTED ALGORITHMS see e.g. https://en.wikipedia.org/wiki/SHA-1
/// for a global comparison and lengths
///
/// * We support all variants of SHA2.
/// * MD5 and SHA1 are still required by TLS 1.2, included for legacy
/// purpose only
/// * SHA3 will be provided by HACL*
///
/// ``hash_alg``, from Spec.Hash.Definitions, lists all supported algorithms
unfold
let alg = fixed_len_alg
/// TODO: move this one to Hacl.Hash.Definitions
val string_of_alg: alg -> C.String.t
/// kept only for functional backward compatibility, never assumed to be secure
type broken_alg = a:alg {a = MD5 \/ a = SHA1}
/// HMAC/HKDF ALGORITHMS; we make security assumptions only for constructions
/// based on those.
type alg13 = a:alg { a=SHA2_256 \/ a=SHA2_384 \/ a=SHA2_512 }
/// No pattern (would fire too often)!
let uint32_fits_maxLength (a: alg) (x: UInt32.t): Lemma
(requires True)
(ensures UInt32.v x `less_than_max_input_length` a)
=
assert_norm (pow2 32 < pow2 61);
assert_norm (pow2 61 < pow2 125)
/// To specify their low-level incremental computations, we assume
/// Merkle-Damgard/sponge-like algorithms:
///
/// The hash state is kept in an accumulator, with
/// - an initial value
/// - an update function, adding a block of bytes;
/// - an extract (also: "finish") function, returning a hash tag.
///
/// Before hashing, some algorithm-specific padding and length encoding is
/// appended to the input bytestring.
///
/// This is not a general-purpose incremental specification, which would support
/// adding text fragments of arbitrary lengths (for that, see
/// EverCrypt.Hash.Incremental).
/// Stateful interface implementing the agile specifications.
module HS = FStar.HyperStack
module B = LowStar.Buffer
module M = LowStar.Modifies
module G = FStar.Ghost
open LowStar.BufferOps
/// do not use as argument of ghost functions
type e_alg = G.erased alg
[@CAbstractStruct]
val state_s: alg -> Type0
// pointer to abstract implementation state
let state alg = B.pointer (state_s alg)
// abstract freeable (deep) predicate; only needed for create/free pairs
inline_for_extraction noextract
val freeable_s: #(a: alg) -> state_s a -> Type0
inline_for_extraction noextract
let freeable (#a: alg) (h: HS.mem) (p: state a) =
B.freeable p /\ freeable_s (B.deref h p)
// NS: note that the state is the first argument to the invariant so that we can
// do partial applications in pre- and post-conditions
val footprint_s: #a:alg -> state_s a -> GTot M.loc
let footprint (#a:alg) (s: state a) (m: HS.mem) =
M.(loc_union (loc_addr_of_buffer s) (footprint_s (B.deref m s)))
// TR: the following pattern is necessary because, if we generically
// add such a pattern directly on `loc_includes_union_l`, then
// verification will blowup whenever both sides of `loc_includes` are
// `loc_union`s. We would like to break all unions on the
// right-hand-side of `loc_includes` first, using
// `loc_includes_union_r`. Here the pattern is on `footprint_s`,
// because we already expose the fact that `footprint` is a
// `loc_union`. (In other words, the pattern should be on every
// smallest location that is not exposed to be a `loc_union`.)
let loc_includes_union_l_footprint_s
(l1 l2: M.loc) (#a: alg) (s: state_s a)
: Lemma
(requires (
M.loc_includes l1 (footprint_s s) \/ M.loc_includes l2 (footprint_s s)
))
(ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))
[SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))]
= M.loc_includes_union_l l1 l2 (footprint_s s)
inline_for_extraction noextract
val invariant_s: (#a:alg) -> state_s a -> HS.mem -> Type0
inline_for_extraction noextract
let invariant (#a:alg) (s: state a) (m: HS.mem) =
B.live m s /\
M.(loc_disjoint (loc_addr_of_buffer s) (footprint_s (B.deref m s))) /\
invariant_s (B.get m s 0) m
//18-07-06 as_acc a better name? not really a representation
val repr: #a:alg ->
s:state a -> h:HS.mem -> GTot (words_state a)
val alg_of_state: a:e_alg -> (
let a = G.reveal a in
s: state a -> Stack alg
(fun h0 -> invariant s h0)
(fun h0 a' h1 -> h0 == h1 /\ a' == a))
val fresh_is_disjoint: l1:M.loc -> l2:M.loc -> h0:HS.mem -> h1:HS.mem -> Lemma
(requires (B.fresh_loc l1 h0 h1 /\ l2 `B.loc_in` h0))
(ensures (M.loc_disjoint l1 l2))
// TR: this lemma is necessary to prove that the footprint is disjoint
// from any fresh memory location.
val invariant_loc_in_footprint
(#a: alg)
(s: state a)
(m: HS.mem)
: Lemma
(requires (invariant s m))
(ensures (B.loc_in (footprint s m) m))
[SMTPat (invariant s m)]
// TR: frame_invariant, just like all lemmas eliminating `modifies`
// clauses, should have `modifies_inert` as a precondition instead of
// `modifies`, in order to use it in all cases where a modifies clause
// is produced but should not be composed with `modifies_trans` for
// pattern reasons (e.g. push_frame, pop_frame)
// 18-07-12 why not bundling the next two lemmas?
val frame_invariant: #a:alg -> l:M.loc -> s:state a -> h0:HS.mem -> h1:HS.mem -> Lemma
(requires (
invariant s h0 /\
M.loc_disjoint l (footprint s h0) /\
M.modifies l h0 h1))
(ensures (
invariant s h1 /\
repr s h0 == repr s h1))
let frame_invariant_implies_footprint_preservation
(#a: alg)
(l: M.loc)
(s: state a)
(h0 h1: HS.mem): Lemma
(requires (
invariant s h0 /\
M.loc_disjoint l (footprint s h0) /\
M.modifies l h0 h1))
(ensures (
footprint s h1 == footprint s h0))
=
()
inline_for_extraction noextract
let preserves_freeable #a (s: state a) (h0 h1: HS.mem): Type0 =
freeable h0 s ==> freeable h1 s
/// This function will generally not extract properly, so it should be used with
/// great care. Callers must:
/// - run with evercrypt/fst in scope to benefit from the definition of this function
/// - know, at call-site, the concrete value of a via suitable usage of inline_for_extraction
inline_for_extraction noextract
val alloca: a:alg -> StackInline (state a)
(requires (fun _ -> True))
(ensures (fun h0 s h1 ->
invariant s h1 /\
M.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint s h1) h0 h1 /\
M.(loc_includes (loc_region_only true (HS.get_tip h1)) (footprint s h1))))
(** @type: true
*)
val create_in: a:alg -> r:HS.rid -> ST (state a)
(requires (fun _ ->
HyperStack.ST.is_eternal_region r))
(ensures (fun h0 s h1 ->
invariant s h1 /\
M.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint s h1) h0 h1 /\
M.(loc_includes (loc_region_only true r) (footprint s h1)) /\
freeable h1 s))
(** @type: true
*)
val create: a:alg -> ST (state a)
(requires fun h0 -> True)
(ensures fun h0 s h1 ->
invariant s h1 /\
M.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint s h1) h0 h1 /\
freeable h1 s)
(** @type: true
*)
val init: #a:e_alg -> (
let a = Ghost.reveal a in
s: state a -> Stack unit
(requires invariant s)
(ensures fun h0 _ h1 ->
invariant s h1 /\
repr s h1 == Spec.Agile.Hash.init a /\
M.(modifies (footprint s h0) h0 h1) /\
footprint s h0 == footprint s h1 /\
preserves_freeable s h0 h1))
val update_multi_256: Hacl.Hash.Definitions.update_multi_st (|SHA2_256, ()|)
inline_for_extraction noextract
val update_multi_224: Hacl.Hash.Definitions.update_multi_st (|SHA2_224, ()|)
inline_for_extraction noextract
let ev_of_uint64 a (prevlen: UInt64.t { UInt64.v prevlen % block_length a = 0 }): Spec.Hash.Definitions.extra_state a =
(if is_blake a then UInt64.v prevlen else ())
/// The ``update_multi`` method
// Note that we pass the data length in bytes (rather than blocks).
(** @type: true
*)
val update_multi:
#a:e_alg -> (
let a = Ghost.reveal a in
s:state a ->
prevlen : uint64_t { UInt64.v prevlen % block_length a = 0 } ->
blocks:B.buffer Lib.IntTypes.uint8 { B.length blocks % block_length a = 0 } ->
len: UInt32.t { v len = B.length blocks } ->
Stack unit
(requires fun h0 ->
invariant s h0 /\
B.live h0 blocks /\
Spec.Agile.Hash.update_multi_pre a (ev_of_uint64 a prevlen) (B.as_seq h0 blocks) /\
M.(loc_disjoint (footprint s h0) (loc_buffer blocks)))
(ensures fun h0 _ h1 ->
M.(modifies (footprint s h0) h0 h1) /\
footprint s h0 == footprint s h1 /\
invariant s h1 /\
repr s h1 == Spec.Agile.Hash.update_multi a (repr s h0)
(ev_of_uint64 a prevlen) (B.as_seq h0 blocks) /\
preserves_freeable s h0 h1))
inline_for_extraction noextract
let prev_len_of_uint64 a (prevlen: UInt64.t { UInt64.v prevlen % block_length a = 0 }): Spec.Hash.Incremental.prev_length_t a =
(if is_keccak a then () else UInt64.v prevlen)
/// The ``update_last`` method with support for blake2
// 18-03-05 note the *new* length-passing convention!
// 18-03-03 it is best to let the caller keep track of lengths.
// 18-03-03 the last block is *never* complete so there is room for the 1st byte of padding.
// 18-10-10 using uint64 for the length as the is the only thing that TLS needs
// and also saves the need for a (painful) indexed type
// 18-10-15 a crucial bit is that this function reveals that last @| padding is a multiple of the
// block size; indeed, any caller will want to know this in order to reason
// about that sequence concatenation
(** @type: true
*)
val update_last:
#a:e_alg -> (
let a = Ghost.reveal a in
s:state a ->
prev_len:uint64_t ->
last:B.buffer Lib.IntTypes.uint8 { B.length last <= block_length a } ->
last_len:uint32_t {
v last_len = B.length last /\
(v prev_len + v last_len) `less_than_max_input_length` a /\
v prev_len % block_length a = 0 } ->
Stack unit
(requires fun h0 ->
invariant s h0 /\
B.live h0 last /\
Spec.Agile.Hash.update_multi_pre a (ev_of_uint64 a prev_len) (B.as_seq h0 last) /\
M.(loc_disjoint (footprint s h0) (loc_buffer last)))
(ensures fun h0 _ h1 ->
invariant s h1 /\
repr s h1 ==
Spec.Hash.Incremental.update_last a (repr s h0) (prev_len_of_uint64 a prev_len)
(B.as_seq h0 last) /\
M.(modifies (footprint s h0) h0 h1) /\
footprint s h0 == footprint s h1 /\
preserves_freeable s h0 h1))
(** @type: true
*)
val finish:
#a:e_alg -> (
let a = Ghost.reveal a in
s:state a ->
dst:B.buffer Lib.IntTypes.uint8 { B.length dst = hash_length a } ->
Stack unit
(requires fun h0 ->
invariant s h0 /\
B.live h0 dst /\
M.(loc_disjoint (footprint s h0) (loc_buffer dst)))
(ensures fun h0 _ h1 ->
invariant s h1 /\
M.(modifies (loc_buffer dst `loc_union` footprint s h0) h0 h1) /\
footprint s h0 == footprint s h1 /\
(* The 0UL value is dummy: it is actually useless *)
B.as_seq h1 dst == Spec.Agile.Hash.finish a (repr s h0) () /\
preserves_freeable s h0 h1))
(** @type: true
*)
val free_:
#a:e_alg -> (
let a = Ghost.reveal a in
s:state a -> ST unit
(requires fun h0 ->
freeable h0 s /\
invariant s h0)
(ensures fun h0 _ h1 ->
M.(modifies (footprint s h0) h0 h1)))
// Avoids C-level collisions with the stdlib free.
// Not clear why we need to repeat the type annotation.
inline_for_extraction noextract
let free: #a:e_alg -> (
let a = Ghost.reveal a in
s:state a -> ST unit
(requires fun h0 ->
freeable h0 s /\
invariant s h0)
(ensures fun h0 _ h1 -> | false | false | EverCrypt.Hash.fsti | {
"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 free (#a: e_alg)
: (let a = Ghost.reveal a in
s: state a
-> ST unit
(requires fun h0 -> freeable h0 s /\ invariant s h0)
(ensures fun h0 _ h1 -> let open M in modifies (footprint s h0) h0 h1)) | [] | EverCrypt.Hash.free | {
"file_name": "providers/evercrypt/EverCrypt.Hash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: EverCrypt.Hash.state (FStar.Ghost.reveal a) -> FStar.HyperStack.ST.ST Prims.unit | {
"end_col": 8,
"end_line": 347,
"start_col": 3,
"start_line": 347
} |
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 invariant (#a:alg) (s: state a) (m: HS.mem) =
B.live m s /\
M.(loc_disjoint (loc_addr_of_buffer s) (footprint_s (B.deref m s))) /\
invariant_s (B.get m s 0) m | let invariant (#a: alg) (s: state a) (m: HS.mem) = | false | null | false | B.live m s /\ M.(loc_disjoint (loc_addr_of_buffer s) (footprint_s (B.deref m s))) /\
invariant_s (B.get m s 0) m | {
"checked_file": "EverCrypt.Hash.fsti.checked",
"dependencies": [
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Integers.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"EverCrypt.Helpers.fsti.checked",
"C.String.fsti.checked"
],
"interface_file": false,
"source_file": "EverCrypt.Hash.fsti"
} | [
"total"
] | [
"EverCrypt.Hash.alg",
"EverCrypt.Hash.state",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"LowStar.Monotonic.Buffer.live",
"EverCrypt.Hash.state_s",
"LowStar.Buffer.trivial_preorder",
"LowStar.Monotonic.Buffer.loc_disjoint",
"LowStar.Monotonic.Buffer.loc_addr_of_buffer",
"EverCrypt.Hash.footprint_s",
"LowStar.Monotonic.Buffer.deref",
"EverCrypt.Hash.invariant_s",
"LowStar.Monotonic.Buffer.get",
"Prims.logical"
] | [] | module EverCrypt.Hash
open EverCrypt.Helpers
open FStar.HyperStack.ST
open FStar.Integers
open Spec.Hash.Definitions
open Hacl.Hash.Definitions
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
/// Algorithmic agility for hash specifications. We reuse the agile
/// specifications from HACL*'s specs/ directory.
/// SUPPORTED ALGORITHMS see e.g. https://en.wikipedia.org/wiki/SHA-1
/// for a global comparison and lengths
///
/// * We support all variants of SHA2.
/// * MD5 and SHA1 are still required by TLS 1.2, included for legacy
/// purpose only
/// * SHA3 will be provided by HACL*
///
/// ``hash_alg``, from Spec.Hash.Definitions, lists all supported algorithms
unfold
let alg = fixed_len_alg
/// TODO: move this one to Hacl.Hash.Definitions
val string_of_alg: alg -> C.String.t
/// kept only for functional backward compatibility, never assumed to be secure
type broken_alg = a:alg {a = MD5 \/ a = SHA1}
/// HMAC/HKDF ALGORITHMS; we make security assumptions only for constructions
/// based on those.
type alg13 = a:alg { a=SHA2_256 \/ a=SHA2_384 \/ a=SHA2_512 }
/// No pattern (would fire too often)!
let uint32_fits_maxLength (a: alg) (x: UInt32.t): Lemma
(requires True)
(ensures UInt32.v x `less_than_max_input_length` a)
=
assert_norm (pow2 32 < pow2 61);
assert_norm (pow2 61 < pow2 125)
/// To specify their low-level incremental computations, we assume
/// Merkle-Damgard/sponge-like algorithms:
///
/// The hash state is kept in an accumulator, with
/// - an initial value
/// - an update function, adding a block of bytes;
/// - an extract (also: "finish") function, returning a hash tag.
///
/// Before hashing, some algorithm-specific padding and length encoding is
/// appended to the input bytestring.
///
/// This is not a general-purpose incremental specification, which would support
/// adding text fragments of arbitrary lengths (for that, see
/// EverCrypt.Hash.Incremental).
/// Stateful interface implementing the agile specifications.
module HS = FStar.HyperStack
module B = LowStar.Buffer
module M = LowStar.Modifies
module G = FStar.Ghost
open LowStar.BufferOps
/// do not use as argument of ghost functions
type e_alg = G.erased alg
[@CAbstractStruct]
val state_s: alg -> Type0
// pointer to abstract implementation state
let state alg = B.pointer (state_s alg)
// abstract freeable (deep) predicate; only needed for create/free pairs
inline_for_extraction noextract
val freeable_s: #(a: alg) -> state_s a -> Type0
inline_for_extraction noextract
let freeable (#a: alg) (h: HS.mem) (p: state a) =
B.freeable p /\ freeable_s (B.deref h p)
// NS: note that the state is the first argument to the invariant so that we can
// do partial applications in pre- and post-conditions
val footprint_s: #a:alg -> state_s a -> GTot M.loc
let footprint (#a:alg) (s: state a) (m: HS.mem) =
M.(loc_union (loc_addr_of_buffer s) (footprint_s (B.deref m s)))
// TR: the following pattern is necessary because, if we generically
// add such a pattern directly on `loc_includes_union_l`, then
// verification will blowup whenever both sides of `loc_includes` are
// `loc_union`s. We would like to break all unions on the
// right-hand-side of `loc_includes` first, using
// `loc_includes_union_r`. Here the pattern is on `footprint_s`,
// because we already expose the fact that `footprint` is a
// `loc_union`. (In other words, the pattern should be on every
// smallest location that is not exposed to be a `loc_union`.)
let loc_includes_union_l_footprint_s
(l1 l2: M.loc) (#a: alg) (s: state_s a)
: Lemma
(requires (
M.loc_includes l1 (footprint_s s) \/ M.loc_includes l2 (footprint_s s)
))
(ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))
[SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))]
= M.loc_includes_union_l l1 l2 (footprint_s s)
inline_for_extraction noextract
val invariant_s: (#a:alg) -> state_s a -> HS.mem -> Type0
inline_for_extraction noextract | false | false | EverCrypt.Hash.fsti | {
"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: EverCrypt.Hash.state a -> m: FStar.Monotonic.HyperStack.mem -> Prims.logical | [] | EverCrypt.Hash.invariant | {
"file_name": "providers/evercrypt/EverCrypt.Hash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: EverCrypt.Hash.state a -> m: FStar.Monotonic.HyperStack.mem -> Prims.logical | {
"end_col": 29,
"end_line": 120,
"start_col": 2,
"start_line": 118
} |
|
FStar.Pervasives.Lemma | val loc_includes_union_l_footprint_s (l1 l2: M.loc) (#a: alg) (s: state_s a)
: Lemma (requires (M.loc_includes l1 (footprint_s s) \/ M.loc_includes l2 (footprint_s s)))
(ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))
[SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))] | [
{
"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 loc_includes_union_l_footprint_s
(l1 l2: M.loc) (#a: alg) (s: state_s a)
: Lemma
(requires (
M.loc_includes l1 (footprint_s s) \/ M.loc_includes l2 (footprint_s s)
))
(ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))
[SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))]
= M.loc_includes_union_l l1 l2 (footprint_s s) | val loc_includes_union_l_footprint_s (l1 l2: M.loc) (#a: alg) (s: state_s a)
: Lemma (requires (M.loc_includes l1 (footprint_s s) \/ M.loc_includes l2 (footprint_s s)))
(ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))
[SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))]
let loc_includes_union_l_footprint_s (l1 l2: M.loc) (#a: alg) (s: state_s a)
: Lemma (requires (M.loc_includes l1 (footprint_s s) \/ M.loc_includes l2 (footprint_s s)))
(ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))
[SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))] = | false | null | true | M.loc_includes_union_l l1 l2 (footprint_s s) | {
"checked_file": "EverCrypt.Hash.fsti.checked",
"dependencies": [
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Integers.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"EverCrypt.Helpers.fsti.checked",
"C.String.fsti.checked"
],
"interface_file": false,
"source_file": "EverCrypt.Hash.fsti"
} | [
"lemma"
] | [
"LowStar.Monotonic.Buffer.loc",
"EverCrypt.Hash.alg",
"EverCrypt.Hash.state_s",
"LowStar.Monotonic.Buffer.loc_includes_union_l",
"EverCrypt.Hash.footprint_s",
"Prims.unit",
"Prims.l_or",
"LowStar.Monotonic.Buffer.loc_includes",
"Prims.squash",
"LowStar.Monotonic.Buffer.loc_union",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | module EverCrypt.Hash
open EverCrypt.Helpers
open FStar.HyperStack.ST
open FStar.Integers
open Spec.Hash.Definitions
open Hacl.Hash.Definitions
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
/// Algorithmic agility for hash specifications. We reuse the agile
/// specifications from HACL*'s specs/ directory.
/// SUPPORTED ALGORITHMS see e.g. https://en.wikipedia.org/wiki/SHA-1
/// for a global comparison and lengths
///
/// * We support all variants of SHA2.
/// * MD5 and SHA1 are still required by TLS 1.2, included for legacy
/// purpose only
/// * SHA3 will be provided by HACL*
///
/// ``hash_alg``, from Spec.Hash.Definitions, lists all supported algorithms
unfold
let alg = fixed_len_alg
/// TODO: move this one to Hacl.Hash.Definitions
val string_of_alg: alg -> C.String.t
/// kept only for functional backward compatibility, never assumed to be secure
type broken_alg = a:alg {a = MD5 \/ a = SHA1}
/// HMAC/HKDF ALGORITHMS; we make security assumptions only for constructions
/// based on those.
type alg13 = a:alg { a=SHA2_256 \/ a=SHA2_384 \/ a=SHA2_512 }
/// No pattern (would fire too often)!
let uint32_fits_maxLength (a: alg) (x: UInt32.t): Lemma
(requires True)
(ensures UInt32.v x `less_than_max_input_length` a)
=
assert_norm (pow2 32 < pow2 61);
assert_norm (pow2 61 < pow2 125)
/// To specify their low-level incremental computations, we assume
/// Merkle-Damgard/sponge-like algorithms:
///
/// The hash state is kept in an accumulator, with
/// - an initial value
/// - an update function, adding a block of bytes;
/// - an extract (also: "finish") function, returning a hash tag.
///
/// Before hashing, some algorithm-specific padding and length encoding is
/// appended to the input bytestring.
///
/// This is not a general-purpose incremental specification, which would support
/// adding text fragments of arbitrary lengths (for that, see
/// EverCrypt.Hash.Incremental).
/// Stateful interface implementing the agile specifications.
module HS = FStar.HyperStack
module B = LowStar.Buffer
module M = LowStar.Modifies
module G = FStar.Ghost
open LowStar.BufferOps
/// do not use as argument of ghost functions
type e_alg = G.erased alg
[@CAbstractStruct]
val state_s: alg -> Type0
// pointer to abstract implementation state
let state alg = B.pointer (state_s alg)
// abstract freeable (deep) predicate; only needed for create/free pairs
inline_for_extraction noextract
val freeable_s: #(a: alg) -> state_s a -> Type0
inline_for_extraction noextract
let freeable (#a: alg) (h: HS.mem) (p: state a) =
B.freeable p /\ freeable_s (B.deref h p)
// NS: note that the state is the first argument to the invariant so that we can
// do partial applications in pre- and post-conditions
val footprint_s: #a:alg -> state_s a -> GTot M.loc
let footprint (#a:alg) (s: state a) (m: HS.mem) =
M.(loc_union (loc_addr_of_buffer s) (footprint_s (B.deref m s)))
// TR: the following pattern is necessary because, if we generically
// add such a pattern directly on `loc_includes_union_l`, then
// verification will blowup whenever both sides of `loc_includes` are
// `loc_union`s. We would like to break all unions on the
// right-hand-side of `loc_includes` first, using
// `loc_includes_union_r`. Here the pattern is on `footprint_s`,
// because we already expose the fact that `footprint` is a
// `loc_union`. (In other words, the pattern should be on every
// smallest location that is not exposed to be a `loc_union`.)
let loc_includes_union_l_footprint_s
(l1 l2: M.loc) (#a: alg) (s: state_s a)
: Lemma
(requires (
M.loc_includes l1 (footprint_s s) \/ M.loc_includes l2 (footprint_s s)
))
(ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s))) | false | false | EverCrypt.Hash.fsti | {
"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 loc_includes_union_l_footprint_s (l1 l2: M.loc) (#a: alg) (s: state_s a)
: Lemma (requires (M.loc_includes l1 (footprint_s s) \/ M.loc_includes l2 (footprint_s s)))
(ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))
[SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))] | [] | EverCrypt.Hash.loc_includes_union_l_footprint_s | {
"file_name": "providers/evercrypt/EverCrypt.Hash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | l1: LowStar.Monotonic.Buffer.loc -> l2: LowStar.Monotonic.Buffer.loc -> s: EverCrypt.Hash.state_s a
-> FStar.Pervasives.Lemma
(requires
LowStar.Monotonic.Buffer.loc_includes l1 (EverCrypt.Hash.footprint_s s) \/
LowStar.Monotonic.Buffer.loc_includes l2 (EverCrypt.Hash.footprint_s s))
(ensures
LowStar.Monotonic.Buffer.loc_includes (LowStar.Monotonic.Buffer.loc_union l1 l2)
(EverCrypt.Hash.footprint_s s))
[
SMTPat (LowStar.Monotonic.Buffer.loc_includes (LowStar.Monotonic.Buffer.loc_union l1 l2)
(EverCrypt.Hash.footprint_s s))
] | {
"end_col": 46,
"end_line": 111,
"start_col": 2,
"start_line": 111
} |
FStar.Pervasives.Lemma | val uint32_fits_maxLength (a: alg) (x: UInt32.t)
: Lemma (requires True) (ensures (UInt32.v x) `less_than_max_input_length` a) | [
{
"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_fits_maxLength (a: alg) (x: UInt32.t): Lemma
(requires True)
(ensures UInt32.v x `less_than_max_input_length` a)
=
assert_norm (pow2 32 < pow2 61);
assert_norm (pow2 61 < pow2 125) | val uint32_fits_maxLength (a: alg) (x: UInt32.t)
: Lemma (requires True) (ensures (UInt32.v x) `less_than_max_input_length` a)
let uint32_fits_maxLength (a: alg) (x: UInt32.t)
: Lemma (requires True) (ensures (UInt32.v x) `less_than_max_input_length` a) = | false | null | true | assert_norm (pow2 32 < pow2 61);
assert_norm (pow2 61 < pow2 125) | {
"checked_file": "EverCrypt.Hash.fsti.checked",
"dependencies": [
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Integers.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"EverCrypt.Helpers.fsti.checked",
"C.String.fsti.checked"
],
"interface_file": false,
"source_file": "EverCrypt.Hash.fsti"
} | [
"lemma"
] | [
"EverCrypt.Hash.alg",
"FStar.UInt32.t",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"FStar.Integers.op_Less",
"FStar.Integers.Signed",
"FStar.Integers.Winfinite",
"Prims.pow2",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Spec.Hash.Definitions.less_than_max_input_length",
"FStar.UInt32.v",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module EverCrypt.Hash
open EverCrypt.Helpers
open FStar.HyperStack.ST
open FStar.Integers
open Spec.Hash.Definitions
open Hacl.Hash.Definitions
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
/// Algorithmic agility for hash specifications. We reuse the agile
/// specifications from HACL*'s specs/ directory.
/// SUPPORTED ALGORITHMS see e.g. https://en.wikipedia.org/wiki/SHA-1
/// for a global comparison and lengths
///
/// * We support all variants of SHA2.
/// * MD5 and SHA1 are still required by TLS 1.2, included for legacy
/// purpose only
/// * SHA3 will be provided by HACL*
///
/// ``hash_alg``, from Spec.Hash.Definitions, lists all supported algorithms
unfold
let alg = fixed_len_alg
/// TODO: move this one to Hacl.Hash.Definitions
val string_of_alg: alg -> C.String.t
/// kept only for functional backward compatibility, never assumed to be secure
type broken_alg = a:alg {a = MD5 \/ a = SHA1}
/// HMAC/HKDF ALGORITHMS; we make security assumptions only for constructions
/// based on those.
type alg13 = a:alg { a=SHA2_256 \/ a=SHA2_384 \/ a=SHA2_512 }
/// No pattern (would fire too often)!
let uint32_fits_maxLength (a: alg) (x: UInt32.t): Lemma
(requires True)
(ensures UInt32.v x `less_than_max_input_length` a) | false | false | EverCrypt.Hash.fsti | {
"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_fits_maxLength (a: alg) (x: UInt32.t)
: Lemma (requires True) (ensures (UInt32.v x) `less_than_max_input_length` a) | [] | EverCrypt.Hash.uint32_fits_maxLength | {
"file_name": "providers/evercrypt/EverCrypt.Hash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: EverCrypt.Hash.alg -> x: FStar.UInt32.t
-> FStar.Pervasives.Lemma
(ensures Spec.Hash.Definitions.less_than_max_input_length (FStar.UInt32.v x) a) | {
"end_col": 34,
"end_line": 42,
"start_col": 2,
"start_line": 41
} |
Prims.Tot | val prev_len_of_uint64 (a: _) (prevlen: UInt64.t{UInt64.v prevlen % block_length a = 0})
: Spec.Hash.Incremental.prev_length_t 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 prev_len_of_uint64 a (prevlen: UInt64.t { UInt64.v prevlen % block_length a = 0 }): Spec.Hash.Incremental.prev_length_t a =
(if is_keccak a then () else UInt64.v prevlen) | val prev_len_of_uint64 (a: _) (prevlen: UInt64.t{UInt64.v prevlen % block_length a = 0})
: Spec.Hash.Incremental.prev_length_t a
let prev_len_of_uint64 a (prevlen: UInt64.t{UInt64.v prevlen % block_length a = 0})
: Spec.Hash.Incremental.prev_length_t a = | false | null | false | (if is_keccak a then () else UInt64.v prevlen) | {
"checked_file": "EverCrypt.Hash.fsti.checked",
"dependencies": [
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Integers.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"EverCrypt.Helpers.fsti.checked",
"C.String.fsti.checked"
],
"interface_file": false,
"source_file": "EverCrypt.Hash.fsti"
} | [
"total"
] | [
"Spec.Hash.Definitions.hash_alg",
"FStar.UInt64.t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.Integers.op_Percent",
"FStar.Integers.Signed",
"FStar.Integers.Winfinite",
"FStar.UInt64.v",
"Spec.Hash.Definitions.block_length",
"Spec.Hash.Definitions.is_keccak",
"Prims.bool",
"Spec.Hash.Incremental.Definitions.prev_length_t"
] | [] | module EverCrypt.Hash
open EverCrypt.Helpers
open FStar.HyperStack.ST
open FStar.Integers
open Spec.Hash.Definitions
open Hacl.Hash.Definitions
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
/// Algorithmic agility for hash specifications. We reuse the agile
/// specifications from HACL*'s specs/ directory.
/// SUPPORTED ALGORITHMS see e.g. https://en.wikipedia.org/wiki/SHA-1
/// for a global comparison and lengths
///
/// * We support all variants of SHA2.
/// * MD5 and SHA1 are still required by TLS 1.2, included for legacy
/// purpose only
/// * SHA3 will be provided by HACL*
///
/// ``hash_alg``, from Spec.Hash.Definitions, lists all supported algorithms
unfold
let alg = fixed_len_alg
/// TODO: move this one to Hacl.Hash.Definitions
val string_of_alg: alg -> C.String.t
/// kept only for functional backward compatibility, never assumed to be secure
type broken_alg = a:alg {a = MD5 \/ a = SHA1}
/// HMAC/HKDF ALGORITHMS; we make security assumptions only for constructions
/// based on those.
type alg13 = a:alg { a=SHA2_256 \/ a=SHA2_384 \/ a=SHA2_512 }
/// No pattern (would fire too often)!
let uint32_fits_maxLength (a: alg) (x: UInt32.t): Lemma
(requires True)
(ensures UInt32.v x `less_than_max_input_length` a)
=
assert_norm (pow2 32 < pow2 61);
assert_norm (pow2 61 < pow2 125)
/// To specify their low-level incremental computations, we assume
/// Merkle-Damgard/sponge-like algorithms:
///
/// The hash state is kept in an accumulator, with
/// - an initial value
/// - an update function, adding a block of bytes;
/// - an extract (also: "finish") function, returning a hash tag.
///
/// Before hashing, some algorithm-specific padding and length encoding is
/// appended to the input bytestring.
///
/// This is not a general-purpose incremental specification, which would support
/// adding text fragments of arbitrary lengths (for that, see
/// EverCrypt.Hash.Incremental).
/// Stateful interface implementing the agile specifications.
module HS = FStar.HyperStack
module B = LowStar.Buffer
module M = LowStar.Modifies
module G = FStar.Ghost
open LowStar.BufferOps
/// do not use as argument of ghost functions
type e_alg = G.erased alg
[@CAbstractStruct]
val state_s: alg -> Type0
// pointer to abstract implementation state
let state alg = B.pointer (state_s alg)
// abstract freeable (deep) predicate; only needed for create/free pairs
inline_for_extraction noextract
val freeable_s: #(a: alg) -> state_s a -> Type0
inline_for_extraction noextract
let freeable (#a: alg) (h: HS.mem) (p: state a) =
B.freeable p /\ freeable_s (B.deref h p)
// NS: note that the state is the first argument to the invariant so that we can
// do partial applications in pre- and post-conditions
val footprint_s: #a:alg -> state_s a -> GTot M.loc
let footprint (#a:alg) (s: state a) (m: HS.mem) =
M.(loc_union (loc_addr_of_buffer s) (footprint_s (B.deref m s)))
// TR: the following pattern is necessary because, if we generically
// add such a pattern directly on `loc_includes_union_l`, then
// verification will blowup whenever both sides of `loc_includes` are
// `loc_union`s. We would like to break all unions on the
// right-hand-side of `loc_includes` first, using
// `loc_includes_union_r`. Here the pattern is on `footprint_s`,
// because we already expose the fact that `footprint` is a
// `loc_union`. (In other words, the pattern should be on every
// smallest location that is not exposed to be a `loc_union`.)
let loc_includes_union_l_footprint_s
(l1 l2: M.loc) (#a: alg) (s: state_s a)
: Lemma
(requires (
M.loc_includes l1 (footprint_s s) \/ M.loc_includes l2 (footprint_s s)
))
(ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))
[SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))]
= M.loc_includes_union_l l1 l2 (footprint_s s)
inline_for_extraction noextract
val invariant_s: (#a:alg) -> state_s a -> HS.mem -> Type0
inline_for_extraction noextract
let invariant (#a:alg) (s: state a) (m: HS.mem) =
B.live m s /\
M.(loc_disjoint (loc_addr_of_buffer s) (footprint_s (B.deref m s))) /\
invariant_s (B.get m s 0) m
//18-07-06 as_acc a better name? not really a representation
val repr: #a:alg ->
s:state a -> h:HS.mem -> GTot (words_state a)
val alg_of_state: a:e_alg -> (
let a = G.reveal a in
s: state a -> Stack alg
(fun h0 -> invariant s h0)
(fun h0 a' h1 -> h0 == h1 /\ a' == a))
val fresh_is_disjoint: l1:M.loc -> l2:M.loc -> h0:HS.mem -> h1:HS.mem -> Lemma
(requires (B.fresh_loc l1 h0 h1 /\ l2 `B.loc_in` h0))
(ensures (M.loc_disjoint l1 l2))
// TR: this lemma is necessary to prove that the footprint is disjoint
// from any fresh memory location.
val invariant_loc_in_footprint
(#a: alg)
(s: state a)
(m: HS.mem)
: Lemma
(requires (invariant s m))
(ensures (B.loc_in (footprint s m) m))
[SMTPat (invariant s m)]
// TR: frame_invariant, just like all lemmas eliminating `modifies`
// clauses, should have `modifies_inert` as a precondition instead of
// `modifies`, in order to use it in all cases where a modifies clause
// is produced but should not be composed with `modifies_trans` for
// pattern reasons (e.g. push_frame, pop_frame)
// 18-07-12 why not bundling the next two lemmas?
val frame_invariant: #a:alg -> l:M.loc -> s:state a -> h0:HS.mem -> h1:HS.mem -> Lemma
(requires (
invariant s h0 /\
M.loc_disjoint l (footprint s h0) /\
M.modifies l h0 h1))
(ensures (
invariant s h1 /\
repr s h0 == repr s h1))
let frame_invariant_implies_footprint_preservation
(#a: alg)
(l: M.loc)
(s: state a)
(h0 h1: HS.mem): Lemma
(requires (
invariant s h0 /\
M.loc_disjoint l (footprint s h0) /\
M.modifies l h0 h1))
(ensures (
footprint s h1 == footprint s h0))
=
()
inline_for_extraction noextract
let preserves_freeable #a (s: state a) (h0 h1: HS.mem): Type0 =
freeable h0 s ==> freeable h1 s
/// This function will generally not extract properly, so it should be used with
/// great care. Callers must:
/// - run with evercrypt/fst in scope to benefit from the definition of this function
/// - know, at call-site, the concrete value of a via suitable usage of inline_for_extraction
inline_for_extraction noextract
val alloca: a:alg -> StackInline (state a)
(requires (fun _ -> True))
(ensures (fun h0 s h1 ->
invariant s h1 /\
M.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint s h1) h0 h1 /\
M.(loc_includes (loc_region_only true (HS.get_tip h1)) (footprint s h1))))
(** @type: true
*)
val create_in: a:alg -> r:HS.rid -> ST (state a)
(requires (fun _ ->
HyperStack.ST.is_eternal_region r))
(ensures (fun h0 s h1 ->
invariant s h1 /\
M.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint s h1) h0 h1 /\
M.(loc_includes (loc_region_only true r) (footprint s h1)) /\
freeable h1 s))
(** @type: true
*)
val create: a:alg -> ST (state a)
(requires fun h0 -> True)
(ensures fun h0 s h1 ->
invariant s h1 /\
M.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint s h1) h0 h1 /\
freeable h1 s)
(** @type: true
*)
val init: #a:e_alg -> (
let a = Ghost.reveal a in
s: state a -> Stack unit
(requires invariant s)
(ensures fun h0 _ h1 ->
invariant s h1 /\
repr s h1 == Spec.Agile.Hash.init a /\
M.(modifies (footprint s h0) h0 h1) /\
footprint s h0 == footprint s h1 /\
preserves_freeable s h0 h1))
val update_multi_256: Hacl.Hash.Definitions.update_multi_st (|SHA2_256, ()|)
inline_for_extraction noextract
val update_multi_224: Hacl.Hash.Definitions.update_multi_st (|SHA2_224, ()|)
inline_for_extraction noextract
let ev_of_uint64 a (prevlen: UInt64.t { UInt64.v prevlen % block_length a = 0 }): Spec.Hash.Definitions.extra_state a =
(if is_blake a then UInt64.v prevlen else ())
/// The ``update_multi`` method
// Note that we pass the data length in bytes (rather than blocks).
(** @type: true
*)
val update_multi:
#a:e_alg -> (
let a = Ghost.reveal a in
s:state a ->
prevlen : uint64_t { UInt64.v prevlen % block_length a = 0 } ->
blocks:B.buffer Lib.IntTypes.uint8 { B.length blocks % block_length a = 0 } ->
len: UInt32.t { v len = B.length blocks } ->
Stack unit
(requires fun h0 ->
invariant s h0 /\
B.live h0 blocks /\
Spec.Agile.Hash.update_multi_pre a (ev_of_uint64 a prevlen) (B.as_seq h0 blocks) /\
M.(loc_disjoint (footprint s h0) (loc_buffer blocks)))
(ensures fun h0 _ h1 ->
M.(modifies (footprint s h0) h0 h1) /\
footprint s h0 == footprint s h1 /\
invariant s h1 /\
repr s h1 == Spec.Agile.Hash.update_multi a (repr s h0)
(ev_of_uint64 a prevlen) (B.as_seq h0 blocks) /\
preserves_freeable s h0 h1))
inline_for_extraction noextract | false | false | EverCrypt.Hash.fsti | {
"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 prev_len_of_uint64 (a: _) (prevlen: UInt64.t{UInt64.v prevlen % block_length a = 0})
: Spec.Hash.Incremental.prev_length_t a | [] | EverCrypt.Hash.prev_len_of_uint64 | {
"file_name": "providers/evercrypt/EverCrypt.Hash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Spec.Hash.Definitions.hash_alg ->
prevlen: FStar.UInt64.t{FStar.UInt64.v prevlen % Spec.Hash.Definitions.block_length a = 0}
-> Spec.Hash.Incremental.Definitions.prev_length_t a | {
"end_col": 48,
"end_line": 266,
"start_col": 2,
"start_line": 266
} |
Prims.Tot | val ev_of_uint64 (a: _) (prevlen: UInt64.t{UInt64.v prevlen % block_length a = 0})
: Spec.Hash.Definitions.extra_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 ev_of_uint64 a (prevlen: UInt64.t { UInt64.v prevlen % block_length a = 0 }): Spec.Hash.Definitions.extra_state a =
(if is_blake a then UInt64.v prevlen else ()) | val ev_of_uint64 (a: _) (prevlen: UInt64.t{UInt64.v prevlen % block_length a = 0})
: Spec.Hash.Definitions.extra_state a
let ev_of_uint64 a (prevlen: UInt64.t{UInt64.v prevlen % block_length a = 0})
: Spec.Hash.Definitions.extra_state a = | false | null | false | (if is_blake a then UInt64.v prevlen) | {
"checked_file": "EverCrypt.Hash.fsti.checked",
"dependencies": [
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Integers.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"EverCrypt.Helpers.fsti.checked",
"C.String.fsti.checked"
],
"interface_file": false,
"source_file": "EverCrypt.Hash.fsti"
} | [
"total"
] | [
"Spec.Hash.Definitions.hash_alg",
"FStar.UInt64.t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.Integers.op_Percent",
"FStar.Integers.Signed",
"FStar.Integers.Winfinite",
"FStar.UInt64.v",
"Spec.Hash.Definitions.block_length",
"Spec.Hash.Definitions.is_blake",
"Prims.bool",
"Spec.Hash.Definitions.extra_state"
] | [] | module EverCrypt.Hash
open EverCrypt.Helpers
open FStar.HyperStack.ST
open FStar.Integers
open Spec.Hash.Definitions
open Hacl.Hash.Definitions
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
/// Algorithmic agility for hash specifications. We reuse the agile
/// specifications from HACL*'s specs/ directory.
/// SUPPORTED ALGORITHMS see e.g. https://en.wikipedia.org/wiki/SHA-1
/// for a global comparison and lengths
///
/// * We support all variants of SHA2.
/// * MD5 and SHA1 are still required by TLS 1.2, included for legacy
/// purpose only
/// * SHA3 will be provided by HACL*
///
/// ``hash_alg``, from Spec.Hash.Definitions, lists all supported algorithms
unfold
let alg = fixed_len_alg
/// TODO: move this one to Hacl.Hash.Definitions
val string_of_alg: alg -> C.String.t
/// kept only for functional backward compatibility, never assumed to be secure
type broken_alg = a:alg {a = MD5 \/ a = SHA1}
/// HMAC/HKDF ALGORITHMS; we make security assumptions only for constructions
/// based on those.
type alg13 = a:alg { a=SHA2_256 \/ a=SHA2_384 \/ a=SHA2_512 }
/// No pattern (would fire too often)!
let uint32_fits_maxLength (a: alg) (x: UInt32.t): Lemma
(requires True)
(ensures UInt32.v x `less_than_max_input_length` a)
=
assert_norm (pow2 32 < pow2 61);
assert_norm (pow2 61 < pow2 125)
/// To specify their low-level incremental computations, we assume
/// Merkle-Damgard/sponge-like algorithms:
///
/// The hash state is kept in an accumulator, with
/// - an initial value
/// - an update function, adding a block of bytes;
/// - an extract (also: "finish") function, returning a hash tag.
///
/// Before hashing, some algorithm-specific padding and length encoding is
/// appended to the input bytestring.
///
/// This is not a general-purpose incremental specification, which would support
/// adding text fragments of arbitrary lengths (for that, see
/// EverCrypt.Hash.Incremental).
/// Stateful interface implementing the agile specifications.
module HS = FStar.HyperStack
module B = LowStar.Buffer
module M = LowStar.Modifies
module G = FStar.Ghost
open LowStar.BufferOps
/// do not use as argument of ghost functions
type e_alg = G.erased alg
[@CAbstractStruct]
val state_s: alg -> Type0
// pointer to abstract implementation state
let state alg = B.pointer (state_s alg)
// abstract freeable (deep) predicate; only needed for create/free pairs
inline_for_extraction noextract
val freeable_s: #(a: alg) -> state_s a -> Type0
inline_for_extraction noextract
let freeable (#a: alg) (h: HS.mem) (p: state a) =
B.freeable p /\ freeable_s (B.deref h p)
// NS: note that the state is the first argument to the invariant so that we can
// do partial applications in pre- and post-conditions
val footprint_s: #a:alg -> state_s a -> GTot M.loc
let footprint (#a:alg) (s: state a) (m: HS.mem) =
M.(loc_union (loc_addr_of_buffer s) (footprint_s (B.deref m s)))
// TR: the following pattern is necessary because, if we generically
// add such a pattern directly on `loc_includes_union_l`, then
// verification will blowup whenever both sides of `loc_includes` are
// `loc_union`s. We would like to break all unions on the
// right-hand-side of `loc_includes` first, using
// `loc_includes_union_r`. Here the pattern is on `footprint_s`,
// because we already expose the fact that `footprint` is a
// `loc_union`. (In other words, the pattern should be on every
// smallest location that is not exposed to be a `loc_union`.)
let loc_includes_union_l_footprint_s
(l1 l2: M.loc) (#a: alg) (s: state_s a)
: Lemma
(requires (
M.loc_includes l1 (footprint_s s) \/ M.loc_includes l2 (footprint_s s)
))
(ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))
[SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))]
= M.loc_includes_union_l l1 l2 (footprint_s s)
inline_for_extraction noextract
val invariant_s: (#a:alg) -> state_s a -> HS.mem -> Type0
inline_for_extraction noextract
let invariant (#a:alg) (s: state a) (m: HS.mem) =
B.live m s /\
M.(loc_disjoint (loc_addr_of_buffer s) (footprint_s (B.deref m s))) /\
invariant_s (B.get m s 0) m
//18-07-06 as_acc a better name? not really a representation
val repr: #a:alg ->
s:state a -> h:HS.mem -> GTot (words_state a)
val alg_of_state: a:e_alg -> (
let a = G.reveal a in
s: state a -> Stack alg
(fun h0 -> invariant s h0)
(fun h0 a' h1 -> h0 == h1 /\ a' == a))
val fresh_is_disjoint: l1:M.loc -> l2:M.loc -> h0:HS.mem -> h1:HS.mem -> Lemma
(requires (B.fresh_loc l1 h0 h1 /\ l2 `B.loc_in` h0))
(ensures (M.loc_disjoint l1 l2))
// TR: this lemma is necessary to prove that the footprint is disjoint
// from any fresh memory location.
val invariant_loc_in_footprint
(#a: alg)
(s: state a)
(m: HS.mem)
: Lemma
(requires (invariant s m))
(ensures (B.loc_in (footprint s m) m))
[SMTPat (invariant s m)]
// TR: frame_invariant, just like all lemmas eliminating `modifies`
// clauses, should have `modifies_inert` as a precondition instead of
// `modifies`, in order to use it in all cases where a modifies clause
// is produced but should not be composed with `modifies_trans` for
// pattern reasons (e.g. push_frame, pop_frame)
// 18-07-12 why not bundling the next two lemmas?
val frame_invariant: #a:alg -> l:M.loc -> s:state a -> h0:HS.mem -> h1:HS.mem -> Lemma
(requires (
invariant s h0 /\
M.loc_disjoint l (footprint s h0) /\
M.modifies l h0 h1))
(ensures (
invariant s h1 /\
repr s h0 == repr s h1))
let frame_invariant_implies_footprint_preservation
(#a: alg)
(l: M.loc)
(s: state a)
(h0 h1: HS.mem): Lemma
(requires (
invariant s h0 /\
M.loc_disjoint l (footprint s h0) /\
M.modifies l h0 h1))
(ensures (
footprint s h1 == footprint s h0))
=
()
inline_for_extraction noextract
let preserves_freeable #a (s: state a) (h0 h1: HS.mem): Type0 =
freeable h0 s ==> freeable h1 s
/// This function will generally not extract properly, so it should be used with
/// great care. Callers must:
/// - run with evercrypt/fst in scope to benefit from the definition of this function
/// - know, at call-site, the concrete value of a via suitable usage of inline_for_extraction
inline_for_extraction noextract
val alloca: a:alg -> StackInline (state a)
(requires (fun _ -> True))
(ensures (fun h0 s h1 ->
invariant s h1 /\
M.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint s h1) h0 h1 /\
M.(loc_includes (loc_region_only true (HS.get_tip h1)) (footprint s h1))))
(** @type: true
*)
val create_in: a:alg -> r:HS.rid -> ST (state a)
(requires (fun _ ->
HyperStack.ST.is_eternal_region r))
(ensures (fun h0 s h1 ->
invariant s h1 /\
M.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint s h1) h0 h1 /\
M.(loc_includes (loc_region_only true r) (footprint s h1)) /\
freeable h1 s))
(** @type: true
*)
val create: a:alg -> ST (state a)
(requires fun h0 -> True)
(ensures fun h0 s h1 ->
invariant s h1 /\
M.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint s h1) h0 h1 /\
freeable h1 s)
(** @type: true
*)
val init: #a:e_alg -> (
let a = Ghost.reveal a in
s: state a -> Stack unit
(requires invariant s)
(ensures fun h0 _ h1 ->
invariant s h1 /\
repr s h1 == Spec.Agile.Hash.init a /\
M.(modifies (footprint s h0) h0 h1) /\
footprint s h0 == footprint s h1 /\
preserves_freeable s h0 h1))
val update_multi_256: Hacl.Hash.Definitions.update_multi_st (|SHA2_256, ()|)
inline_for_extraction noextract
val update_multi_224: Hacl.Hash.Definitions.update_multi_st (|SHA2_224, ()|)
inline_for_extraction noextract | false | false | EverCrypt.Hash.fsti | {
"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 ev_of_uint64 (a: _) (prevlen: UInt64.t{UInt64.v prevlen % block_length a = 0})
: Spec.Hash.Definitions.extra_state a | [] | EverCrypt.Hash.ev_of_uint64 | {
"file_name": "providers/evercrypt/EverCrypt.Hash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Spec.Hash.Definitions.hash_alg ->
prevlen: FStar.UInt64.t{FStar.UInt64.v prevlen % Spec.Hash.Definitions.block_length a = 0}
-> Spec.Hash.Definitions.extra_state a | {
"end_col": 47,
"end_line": 237,
"start_col": 2,
"start_line": 237
} |
Prims.Tot | val bn_slow_precomp:BR.bn_mod_slow_precomp_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst | val bn_slow_precomp:BR.bn_mod_slow_precomp_st t_limbs n_limbs
let bn_slow_precomp:BR.bn_mod_slow_precomp_st t_limbs n_limbs = | false | null | false | BR.bn_mod_slow_precomp almost_mont_inst | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.ModReduction.bn_mod_slow_precomp",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.almost_mont_inst"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline] | false | true | Hacl.Bignum256.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 bn_slow_precomp:BR.bn_mod_slow_precomp_st t_limbs n_limbs | [] | Hacl.Bignum256.bn_slow_precomp | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.ModReduction.bn_mod_slow_precomp_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 41,
"end_line": 110,
"start_col": 2,
"start_line": 110
} |
Prims.Tot | val exp_vartime:BE.bn_mod_exp_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp | val exp_vartime:BE.bn_mod_exp_st t_limbs n_limbs
let exp_vartime:BE.bn_mod_exp_st t_limbs n_limbs = | false | null | false | BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Exponentiation.mk_bn_mod_exp",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum256.precompr2",
"Hacl.Bignum256.exp_vartime_precomp"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline] | false | true | Hacl.Bignum256.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 exp_vartime:BE.bn_mod_exp_st t_limbs n_limbs | [] | Hacl.Bignum256.exp_vartime | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Exponentiation.bn_mod_exp_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 56,
"end_line": 132,
"start_col": 2,
"start_line": 132
} |
Prims.Tot | val add: BN.bn_add_eq_len_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs | val add: BN.bn_add_eq_len_st t_limbs n_limbs
let add:BN.bn_add_eq_len_st t_limbs n_limbs = | false | null | false | BN.bn_add_eq_len n_limbs | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.bn_add_eq_len",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum.bn_add_eq_len_st"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0" | false | true | Hacl.Bignum256.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 add: BN.bn_add_eq_len_st t_limbs n_limbs | [] | Hacl.Bignum256.add | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.bn_add_eq_len_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 26,
"end_line": 15,
"start_col": 2,
"start_line": 15
} |
Prims.Tot | val amont_mul:AM.bn_almost_mont_mul_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction | val amont_mul:AM.bn_almost_mont_mul_st t_limbs n_limbs
let amont_mul:AM.bn_almost_mont_mul_st t_limbs n_limbs = | false | null | false | AM.bn_almost_mont_mul bn_inst areduction | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.AlmostMontgomery.bn_almost_mont_mul",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.bn_inst",
"Hacl.Bignum256.areduction"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline] | false | true | Hacl.Bignum256.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 amont_mul:AM.bn_almost_mont_mul_st t_limbs n_limbs | [] | Hacl.Bignum256.amont_mul | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.AlmostMontgomery.bn_almost_mont_mul_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 42,
"end_line": 90,
"start_col": 2,
"start_line": 90
} |
Prims.Tot | val from:BM.bn_from_mont_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction | val from:BM.bn_from_mont_st t_limbs n_limbs
let from:BM.bn_from_mont_st t_limbs n_limbs = | false | null | false | BM.bn_from_mont bn_inst reduction | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Montgomery.bn_from_mont",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.bn_inst",
"Hacl.Bignum256.reduction"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline] | false | true | Hacl.Bignum256.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 from:BM.bn_from_mont_st t_limbs n_limbs | [] | Hacl.Bignum256.from | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Montgomery.bn_from_mont_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 35,
"end_line": 62,
"start_col": 2,
"start_line": 62
} |
Prims.Tot | val to:BM.bn_to_mont_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction | val to:BM.bn_to_mont_st t_limbs n_limbs
let to:BM.bn_to_mont_st t_limbs n_limbs = | false | null | false | BM.bn_to_mont bn_inst reduction | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Montgomery.bn_to_mont",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.bn_inst",
"Hacl.Bignum256.reduction"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline] | false | true | Hacl.Bignum256.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 to:BM.bn_to_mont_st t_limbs n_limbs | [] | Hacl.Bignum256.to | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Montgomery.bn_to_mont_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 33,
"end_line": 58,
"start_col": 2,
"start_line": 58
} |
Prims.Tot | val mod_exp_consttime: BS.bn_mod_exp_safe_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime | val mod_exp_consttime: BS.bn_mod_exp_safe_st t_limbs n_limbs
let mod_exp_consttime = | false | null | false | BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.SafeAPI.mk_bn_mod_exp_safe",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum256.exp_check",
"Hacl.Bignum256.exp_consttime"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime | false | true | Hacl.Bignum256.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 mod_exp_consttime: BS.bn_mod_exp_safe_st t_limbs n_limbs | [] | Hacl.Bignum256.mod_exp_consttime | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.SafeAPI.bn_mod_exp_safe_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 77,
"end_line": 140,
"start_col": 24,
"start_line": 140
} |
Prims.Tot | val mod_exp_vartime: BS.bn_mod_exp_safe_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime | val mod_exp_vartime: BS.bn_mod_exp_safe_st t_limbs n_limbs
let mod_exp_vartime = | false | null | false | BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.SafeAPI.mk_bn_mod_exp_safe",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum256.exp_check",
"Hacl.Bignum256.exp_vartime"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp | false | true | Hacl.Bignum256.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 mod_exp_vartime: BS.bn_mod_exp_safe_st t_limbs n_limbs | [] | Hacl.Bignum256.mod_exp_vartime | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.SafeAPI.bn_mod_exp_safe_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 73,
"end_line": 138,
"start_col": 22,
"start_line": 138
} |
Prims.Tot | val precompr2:BM.bn_precomp_r2_mod_n_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst | val precompr2:BM.bn_precomp_r2_mod_n_st t_limbs n_limbs
let precompr2:BM.bn_precomp_r2_mod_n_st t_limbs n_limbs = | false | null | false | BM.bn_precomp_r2_mod_n bn_inst | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Montgomery.bn_precomp_r2_mod_n",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.bn_inst"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline] | false | true | Hacl.Bignum256.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 precompr2:BM.bn_precomp_r2_mod_n_st t_limbs n_limbs | [] | Hacl.Bignum256.precompr2 | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Montgomery.bn_precomp_r2_mod_n_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 32,
"end_line": 50,
"start_col": 2,
"start_line": 50
} |
Prims.Tot | val exp_consttime:BE.bn_mod_exp_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp | val exp_consttime:BE.bn_mod_exp_st t_limbs n_limbs
let exp_consttime:BE.bn_mod_exp_st t_limbs n_limbs = | false | null | false | BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Exponentiation.mk_bn_mod_exp",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum256.precompr2",
"Hacl.Bignum256.exp_consttime_precomp"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline] | false | true | Hacl.Bignum256.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 exp_consttime:BE.bn_mod_exp_st t_limbs n_limbs | [] | Hacl.Bignum256.exp_consttime | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Exponentiation.bn_mod_exp_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 58,
"end_line": 136,
"start_col": 2,
"start_line": 136
} |
Prims.Tot | val new_bn_from_bytes_be: BS.new_bn_from_bytes_be_st t_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let new_bn_from_bytes_be = BS.new_bn_from_bytes_be | val new_bn_from_bytes_be: BS.new_bn_from_bytes_be_st t_limbs
let new_bn_from_bytes_be = | false | null | false | BS.new_bn_from_bytes_be | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.SafeAPI.new_bn_from_bytes_be",
"Hacl.Bignum256.t_limbs"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res
let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res | false | true | Hacl.Bignum256.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 new_bn_from_bytes_be: BS.new_bn_from_bytes_be_st t_limbs | [] | Hacl.Bignum256.new_bn_from_bytes_be | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.SafeAPI.new_bn_from_bytes_be_st Hacl.Bignum256.t_limbs | {
"end_col": 50,
"end_line": 163,
"start_col": 27,
"start_line": 163
} |
Prims.Tot | val mont_check:BM.bn_check_modulus_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus | val mont_check:BM.bn_check_modulus_st t_limbs n_limbs
let mont_check:BM.bn_check_modulus_st t_limbs n_limbs = | false | null | false | BM.bn_check_modulus | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Montgomery.bn_check_modulus",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline] | false | true | Hacl.Bignum256.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 mont_check:BM.bn_check_modulus_st t_limbs n_limbs | [] | Hacl.Bignum256.mont_check | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Montgomery.bn_check_modulus_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 21,
"end_line": 46,
"start_col": 2,
"start_line": 46
} |
Prims.Tot | val mod_inv_prime_vartime_precomp: BS.bn_mod_inv_prime_ctx_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res | val mod_inv_prime_vartime_precomp: BS.bn_mod_inv_prime_ctx_st t_limbs n_limbs
let mod_inv_prime_vartime_precomp k a res = | false | null | false | BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp)
k
a
res | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum.SafeAPI.mk_bn_mod_inv_prime_ctx",
"FStar.Ghost.hide",
"Hacl.Bignum.meta_len",
"Hacl.Bignum.ModInv.mk_bn_mod_inv_prime_precomp",
"Hacl.Bignum256.exp_vartime_precomp",
"Prims.unit"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res | false | true | Hacl.Bignum256.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 mod_inv_prime_vartime_precomp: BS.bn_mod_inv_prime_ctx_st t_limbs n_limbs | [] | Hacl.Bignum256.mod_inv_prime_vartime_precomp | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.SafeAPI.bn_mod_inv_prime_ctx_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 72,
"end_line": 161,
"start_col": 2,
"start_line": 160
} |
Prims.Tot | val amont_sqr:AM.bn_almost_mont_sqr_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction | val amont_sqr:AM.bn_almost_mont_sqr_st t_limbs n_limbs
let amont_sqr:AM.bn_almost_mont_sqr_st t_limbs n_limbs = | false | null | false | AM.bn_almost_mont_sqr bn_inst areduction | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.AlmostMontgomery.bn_almost_mont_sqr",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.bn_inst",
"Hacl.Bignum256.areduction"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline] | false | true | Hacl.Bignum256.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 amont_sqr:AM.bn_almost_mont_sqr_st t_limbs n_limbs | [] | Hacl.Bignum256.amont_sqr | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.AlmostMontgomery.bn_almost_mont_sqr_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 42,
"end_line": 94,
"start_col": 2,
"start_line": 94
} |
Prims.Tot | val sub: BN.bn_sub_eq_len_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs | val sub: BN.bn_sub_eq_len_st t_limbs n_limbs
let sub:BN.bn_sub_eq_len_st t_limbs n_limbs = | false | null | false | BN.bn_sub_eq_len n_limbs | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.bn_sub_eq_len",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum.bn_sub_eq_len_st"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs | false | true | Hacl.Bignum256.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 sub: BN.bn_sub_eq_len_st t_limbs n_limbs | [] | Hacl.Bignum256.sub | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.bn_sub_eq_len_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 26,
"end_line": 18,
"start_col": 2,
"start_line": 18
} |
Prims.Tot | [@@ FStar.Tactics.Typeclasses.tcinstance]
val bn_inst:BN.bn t_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
} | [@@ FStar.Tactics.Typeclasses.tcinstance]
val bn_inst:BN.bn t_limbs
[@@ FStar.Tactics.Typeclasses.tcinstance]
let bn_inst:BN.bn t_limbs = | false | null | false | {
BN.len = n_limbs;
BN.add = add;
BN.sub = sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul = mul;
BN.sqr = sqr
} | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Mkbn",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum256.add",
"Hacl.Bignum256.sub",
"Hacl.Bignum256.add_mod",
"Hacl.Bignum256.sub_mod",
"Hacl.Bignum256.mul",
"Hacl.Bignum256.sqr"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract | false | true | Hacl.Bignum256.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 | [@@ FStar.Tactics.Typeclasses.tcinstance]
val bn_inst:BN.bn t_limbs | [] | Hacl.Bignum256.bn_inst | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.bn Hacl.Bignum256.t_limbs | {
"end_col": 8,
"end_line": 41,
"start_col": 2,
"start_line": 35
} |
Prims.Tot | val eq_mask: BN.bn_eq_mask_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let eq_mask = BN.bn_eq_mask n_limbs | val eq_mask: BN.bn_eq_mask_st t_limbs n_limbs
let eq_mask = | false | null | false | BN.bn_eq_mask n_limbs | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.bn_eq_mask",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res
let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res
let new_bn_from_bytes_be = BS.new_bn_from_bytes_be
let new_bn_from_bytes_le = BS.new_bn_from_bytes_le
let bn_to_bytes_be = Hacl.Bignum.Convert.mk_bn_to_bytes_be true n_bytes
let bn_to_bytes_le = Hacl.Bignum.Convert.mk_bn_to_bytes_le true n_bytes
let lt_mask = BN.bn_lt_mask n_limbs | false | true | Hacl.Bignum256.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 eq_mask: BN.bn_eq_mask_st t_limbs n_limbs | [] | Hacl.Bignum256.eq_mask | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.bn_eq_mask_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 35,
"end_line": 173,
"start_col": 14,
"start_line": 173
} |
Prims.Tot | val new_bn_from_bytes_le: BS.new_bn_from_bytes_le_st t_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let new_bn_from_bytes_le = BS.new_bn_from_bytes_le | val new_bn_from_bytes_le: BS.new_bn_from_bytes_le_st t_limbs
let new_bn_from_bytes_le = | false | null | false | BS.new_bn_from_bytes_le | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.SafeAPI.new_bn_from_bytes_le",
"Hacl.Bignum256.t_limbs"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res
let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res
let new_bn_from_bytes_be = BS.new_bn_from_bytes_be | false | true | Hacl.Bignum256.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 new_bn_from_bytes_le: BS.new_bn_from_bytes_le_st t_limbs | [] | Hacl.Bignum256.new_bn_from_bytes_le | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.SafeAPI.new_bn_from_bytes_le_st Hacl.Bignum256.t_limbs | {
"end_col": 50,
"end_line": 165,
"start_col": 27,
"start_line": 165
} |
Prims.Tot | val mont_ctx_init: MA.bn_field_init_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n | val mont_ctx_init: MA.bn_field_init_st t_limbs n_limbs
let mont_ctx_init r n = | false | null | false | MA.bn_field_init n_limbs precompr2 r n | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"FStar.Monotonic.HyperHeap.rid",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum.MontArithmetic.bn_field_init",
"Hacl.Bignum256.precompr2",
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime | false | true | Hacl.Bignum256.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 mont_ctx_init: MA.bn_field_init_st t_limbs n_limbs | [] | Hacl.Bignum256.mont_ctx_init | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.MontArithmetic.bn_field_init_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 40,
"end_line": 145,
"start_col": 2,
"start_line": 145
} |
Prims.Tot | val mont_ctx_free: MA.bn_field_free_st t_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mont_ctx_free k =
MA.bn_field_free k | val mont_ctx_free: MA.bn_field_free_st t_limbs
let mont_ctx_free k = | false | null | false | MA.bn_field_free k | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum.MontArithmetic.bn_field_free",
"Prims.unit"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n | false | true | Hacl.Bignum256.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 mont_ctx_free: MA.bn_field_free_st t_limbs | [] | Hacl.Bignum256.mont_ctx_free | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.MontArithmetic.bn_field_free_st Hacl.Bignum256.t_limbs | {
"end_col": 20,
"end_line": 148,
"start_col": 2,
"start_line": 148
} |
Prims.Tot | val lt_mask: BN.bn_lt_mask_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lt_mask = BN.bn_lt_mask n_limbs | val lt_mask: BN.bn_lt_mask_st t_limbs n_limbs
let lt_mask = | false | null | false | BN.bn_lt_mask n_limbs | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.bn_lt_mask",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res
let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res
let new_bn_from_bytes_be = BS.new_bn_from_bytes_be
let new_bn_from_bytes_le = BS.new_bn_from_bytes_le
let bn_to_bytes_be = Hacl.Bignum.Convert.mk_bn_to_bytes_be true n_bytes
let bn_to_bytes_le = Hacl.Bignum.Convert.mk_bn_to_bytes_le true n_bytes | false | true | Hacl.Bignum256.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 lt_mask: BN.bn_lt_mask_st t_limbs n_limbs | [] | Hacl.Bignum256.lt_mask | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.bn_lt_mask_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 35,
"end_line": 171,
"start_col": 14,
"start_line": 171
} |
Prims.Tot | val exp_check:BE.bn_check_mod_exp_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs | val exp_check:BE.bn_check_mod_exp_st t_limbs n_limbs
let exp_check:BE.bn_check_mod_exp_st t_limbs n_limbs = | false | null | false | BE.bn_check_mod_exp n_limbs | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Exponentiation.bn_check_mod_exp",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res | false | true | Hacl.Bignum256.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 exp_check:BE.bn_check_mod_exp_st t_limbs n_limbs | [] | Hacl.Bignum256.exp_check | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Exponentiation.bn_check_mod_exp_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 29,
"end_line": 116,
"start_col": 2,
"start_line": 116
} |
Prims.Tot | val mod_inv_prime_vartime: BS.bn_mod_inv_prime_safe_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime | val mod_inv_prime_vartime: BS.bn_mod_inv_prime_safe_st t_limbs n_limbs
let mod_inv_prime_vartime = | false | null | false | BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.SafeAPI.mk_bn_mod_inv_prime_safe",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum256.exp_vartime"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime | false | true | Hacl.Bignum256.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 mod_inv_prime_vartime: BS.bn_mod_inv_prime_safe_st t_limbs n_limbs | [] | Hacl.Bignum256.mod_inv_prime_vartime | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.SafeAPI.bn_mod_inv_prime_safe_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 75,
"end_line": 142,
"start_col": 28,
"start_line": 142
} |
Prims.Tot | [@@ FStar.Tactics.Typeclasses.tcinstance]
val almost_mont_inst:AM.almost_mont t_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
} | [@@ FStar.Tactics.Typeclasses.tcinstance]
val almost_mont_inst:AM.almost_mont t_limbs
[@@ FStar.Tactics.Typeclasses.tcinstance]
let almost_mont_inst:AM.almost_mont t_limbs = | false | null | false | {
AM.bn = bn_inst;
AM.mont_check = mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to = to;
AM.from = from;
AM.mul = amont_mul;
AM.sqr = amont_sqr
} | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.AlmostMontgomery.Mkalmost_mont",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.bn_inst",
"Hacl.Bignum256.mont_check",
"Hacl.Bignum256.precompr2",
"Hacl.Bignum256.areduction",
"Hacl.Bignum256.to",
"Hacl.Bignum256.from",
"Hacl.Bignum256.amont_mul",
"Hacl.Bignum256.amont_sqr"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract | false | true | Hacl.Bignum256.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 | [@@ FStar.Tactics.Typeclasses.tcinstance]
val almost_mont_inst:AM.almost_mont t_limbs | [] | Hacl.Bignum256.almost_mont_inst | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.AlmostMontgomery.almost_mont Hacl.Bignum256.t_limbs | {
"end_col": 21,
"end_line": 105,
"start_col": 2,
"start_line": 98
} |
Prims.Tot | val sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs | val sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs
let sub_mod:BN.bn_sub_mod_n_st t_limbs n_limbs = | false | null | false | BN.bn_sub_mod_n n_limbs | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.bn_sub_mod_n",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum.bn_sub_mod_n_st"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs | false | true | Hacl.Bignum256.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 sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs | [] | Hacl.Bignum256.sub_mod | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.bn_sub_mod_n_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 25,
"end_line": 24,
"start_col": 2,
"start_line": 24
} |
Prims.Tot | val add_mod: BN.bn_add_mod_n_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs | val add_mod: BN.bn_add_mod_n_st t_limbs n_limbs
let add_mod:BN.bn_add_mod_n_st t_limbs n_limbs = | false | null | false | BN.bn_add_mod_n n_limbs | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.bn_add_mod_n",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum.bn_add_mod_n_st"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs | false | true | Hacl.Bignum256.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 add_mod: BN.bn_add_mod_n_st t_limbs n_limbs | [] | Hacl.Bignum256.add_mod | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.bn_add_mod_n_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 25,
"end_line": 21,
"start_col": 2,
"start_line": 21
} |
Prims.Tot | val mod_precomp: BS.bn_mod_slow_ctx_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res | val mod_precomp: BS.bn_mod_slow_ctx_st t_limbs n_limbs
let mod_precomp k a res = | false | null | false | BS.bn_mod_ctx n_limbs bn_slow_precomp k a res | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum.SafeAPI.bn_mod_ctx",
"FStar.Ghost.hide",
"Hacl.Bignum.meta_len",
"Hacl.Bignum256.bn_slow_precomp",
"Prims.unit"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k | false | true | Hacl.Bignum256.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 mod_precomp: BS.bn_mod_slow_ctx_st t_limbs n_limbs | [] | Hacl.Bignum256.mod_precomp | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.SafeAPI.bn_mod_slow_ctx_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 47,
"end_line": 151,
"start_col": 2,
"start_line": 151
} |
Prims.Tot | val exp_vartime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul) | val exp_vartime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs
let exp_vartime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs = | false | null | false | BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul) | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Exponentiation.bn_mod_exp_vartime_precomp",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum.Exponentiation.bn_mod_exp_amm_bm_vartime_precomp",
"Hacl.Bignum256.almost_mont_inst",
"Hacl.Bignum.Exponentiation.bn_mod_exp_amm_fw_vartime_precomp",
"FStar.UInt32.__uint_to_t"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline] | false | true | Hacl.Bignum256.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 exp_vartime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs | [] | Hacl.Bignum256.exp_vartime_precomp | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Exponentiation.bn_mod_exp_precomp_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 63,
"end_line": 122,
"start_col": 2,
"start_line": 120
} |
Prims.Tot | val mod: BS.bn_mod_slow_safe_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res | val mod: BS.bn_mod_slow_safe_st t_limbs n_limbs
let mod n a res = | false | null | false | BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Bignum.SafeAPI.mk_bn_mod_slow_safe",
"Hacl.Bignum.ModReduction.mk_bn_mod_slow",
"Hacl.Bignum256.precompr2",
"Hacl.Bignum256.bn_slow_precomp",
"Prims.bool"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst | false | true | Hacl.Bignum256.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 mod: BS.bn_mod_slow_safe_st t_limbs n_limbs | [] | Hacl.Bignum256.mod | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.SafeAPI.bn_mod_slow_safe_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 94,
"end_line": 113,
"start_col": 2,
"start_line": 113
} |
Prims.Tot | val exp_consttime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul) | val exp_consttime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs
let exp_consttime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs = | false | null | false | BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul) | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Exponentiation.bn_mod_exp_consttime_precomp",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum.Exponentiation.bn_mod_exp_amm_bm_consttime_precomp",
"Hacl.Bignum256.almost_mont_inst",
"Hacl.Bignum.Exponentiation.bn_mod_exp_amm_fw_consttime_precomp",
"FStar.UInt32.__uint_to_t"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline] | false | true | Hacl.Bignum256.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 exp_consttime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs | [] | Hacl.Bignum256.exp_consttime_precomp | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Exponentiation.bn_mod_exp_precomp_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 65,
"end_line": 128,
"start_col": 2,
"start_line": 126
} |
Prims.Tot | val mod_exp_vartime_precomp: BS.bn_mod_exp_ctx_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res | val mod_exp_vartime_precomp: BS.bn_mod_exp_ctx_st t_limbs n_limbs
let mod_exp_vartime_precomp k a bBits b res = | false | null | false | BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum256.n_limbs",
"Lib.IntTypes.size_t",
"Hacl.Bignum.Definitions.blocks0",
"Lib.IntTypes.size",
"Lib.IntTypes.bits",
"Hacl.Bignum.SafeAPI.mk_bn_mod_exp_ctx",
"FStar.Ghost.hide",
"Hacl.Bignum.meta_len",
"Hacl.Bignum256.exp_vartime_precomp",
"Prims.unit"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res | false | true | Hacl.Bignum256.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 mod_exp_vartime_precomp: BS.bn_mod_exp_ctx_st t_limbs n_limbs | [] | Hacl.Bignum256.mod_exp_vartime_precomp | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.SafeAPI.bn_mod_exp_ctx_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 66,
"end_line": 154,
"start_col": 2,
"start_line": 154
} |
Prims.Tot | val mod_exp_consttime_precomp: BS.bn_mod_exp_ctx_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res | val mod_exp_consttime_precomp: BS.bn_mod_exp_ctx_st t_limbs n_limbs
let mod_exp_consttime_precomp k a bBits b res = | false | null | false | BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum256.n_limbs",
"Lib.IntTypes.size_t",
"Hacl.Bignum.Definitions.blocks0",
"Lib.IntTypes.size",
"Lib.IntTypes.bits",
"Hacl.Bignum.SafeAPI.mk_bn_mod_exp_ctx",
"FStar.Ghost.hide",
"Hacl.Bignum.meta_len",
"Hacl.Bignum256.exp_consttime_precomp",
"Prims.unit"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res | false | true | Hacl.Bignum256.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 mod_exp_consttime_precomp: BS.bn_mod_exp_ctx_st t_limbs n_limbs | [] | Hacl.Bignum256.mod_exp_consttime_precomp | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.SafeAPI.bn_mod_exp_ctx_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 68,
"end_line": 157,
"start_col": 2,
"start_line": 157
} |
Prims.Tot | val reduction:BM.bn_mont_reduction_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst | val reduction:BM.bn_mont_reduction_st t_limbs n_limbs
let reduction:BM.bn_mont_reduction_st t_limbs n_limbs = | false | null | false | BM.bn_mont_reduction bn_inst | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Montgomery.bn_mont_reduction",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.bn_inst"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline] | false | true | Hacl.Bignum256.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 reduction:BM.bn_mont_reduction_st t_limbs n_limbs | [] | Hacl.Bignum256.reduction | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Montgomery.bn_mont_reduction_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs | {
"end_col": 30,
"end_line": 54,
"start_col": 2,
"start_line": 54
} |
Prims.Tot | val areduction:AM.bn_almost_mont_reduction_st t_limbs n_limbs | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst | val areduction:AM.bn_almost_mont_reduction_st t_limbs n_limbs
let areduction:AM.bn_almost_mont_reduction_st t_limbs n_limbs = | false | null | false | AM.bn_almost_mont_reduction bn_inst | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.AlmostMontgomery.bn_almost_mont_reduction",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.bn_inst"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline] | false | true | Hacl.Bignum256.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 areduction:AM.bn_almost_mont_reduction_st t_limbs n_limbs | [] | Hacl.Bignum256.areduction | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.AlmostMontgomery.bn_almost_mont_reduction_st Hacl.Bignum256.t_limbs
Hacl.Bignum256.n_limbs | {
"end_col": 37,
"end_line": 86,
"start_col": 2,
"start_line": 86
} |
Prims.Tot | val sqr: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_sqr_st t_limbs n_limbs a | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a | val sqr: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_sqr_st t_limbs n_limbs a
let sqr (a: lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a = | false | null | false | BN.bn_sqr n_limbs a | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum256.lbignum",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum.bn_sqr",
"Hacl.Bignum.bn_karatsuba_sqr_st"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a | false | false | Hacl.Bignum256.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 sqr: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_sqr_st t_limbs n_limbs a | [] | Hacl.Bignum256.sqr | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Hacl.Bignum256.lbignum Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs
-> Hacl.Bignum.bn_karatsuba_sqr_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs a | {
"end_col": 21,
"end_line": 30,
"start_col": 2,
"start_line": 30
} |
Prims.Tot | val mul: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_mul_st t_limbs n_limbs a | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a | val mul: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_mul_st t_limbs n_limbs a
let mul (a: lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a = | false | null | false | BN.bn_mul n_limbs n_limbs a | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum256.lbignum",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_limbs",
"Hacl.Bignum.bn_mul",
"Hacl.Bignum.bn_karatsuba_mul_st"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs | false | false | Hacl.Bignum256.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 mul: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_mul_st t_limbs n_limbs a | [] | Hacl.Bignum256.mul | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Hacl.Bignum256.lbignum Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs
-> Hacl.Bignum.bn_karatsuba_mul_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_limbs a | {
"end_col": 29,
"end_line": 27,
"start_col": 2,
"start_line": 27
} |
Prims.Tot | val bn_to_bytes_be: Hacl.Bignum.Convert.bn_to_bytes_be_st t_limbs n_bytes | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_to_bytes_be = Hacl.Bignum.Convert.mk_bn_to_bytes_be true n_bytes | val bn_to_bytes_be: Hacl.Bignum.Convert.bn_to_bytes_be_st t_limbs n_bytes
let bn_to_bytes_be = | false | null | false | Hacl.Bignum.Convert.mk_bn_to_bytes_be true n_bytes | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Convert.mk_bn_to_bytes_be",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_bytes"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res
let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res
let new_bn_from_bytes_be = BS.new_bn_from_bytes_be
let new_bn_from_bytes_le = BS.new_bn_from_bytes_le | false | true | Hacl.Bignum256.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 bn_to_bytes_be: Hacl.Bignum.Convert.bn_to_bytes_be_st t_limbs n_bytes | [] | Hacl.Bignum256.bn_to_bytes_be | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Convert.bn_to_bytes_be_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_bytes | {
"end_col": 71,
"end_line": 167,
"start_col": 21,
"start_line": 167
} |
Prims.Tot | val bn_to_bytes_le: Hacl.Bignum.Convert.bn_to_bytes_le_st t_limbs n_bytes | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_to_bytes_le = Hacl.Bignum.Convert.mk_bn_to_bytes_le true n_bytes | val bn_to_bytes_le: Hacl.Bignum.Convert.bn_to_bytes_le_st t_limbs n_bytes
let bn_to_bytes_le = | false | null | false | Hacl.Bignum.Convert.mk_bn_to_bytes_le true n_bytes | {
"checked_file": "Hacl.Bignum256.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum256.fst"
} | [
"total"
] | [
"Hacl.Bignum.Convert.mk_bn_to_bytes_le",
"Hacl.Bignum256.t_limbs",
"Hacl.Bignum256.n_bytes"
] | [] | module Hacl.Bignum256
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res
let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res
let new_bn_from_bytes_be = BS.new_bn_from_bytes_be
let new_bn_from_bytes_le = BS.new_bn_from_bytes_le
let bn_to_bytes_be = Hacl.Bignum.Convert.mk_bn_to_bytes_be true n_bytes | false | true | Hacl.Bignum256.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 bn_to_bytes_le: Hacl.Bignum.Convert.bn_to_bytes_le_st t_limbs n_bytes | [] | Hacl.Bignum256.bn_to_bytes_le | {
"file_name": "code/bignum/Hacl.Bignum256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Convert.bn_to_bytes_le_st Hacl.Bignum256.t_limbs Hacl.Bignum256.n_bytes | {
"end_col": 71,
"end_line": 169,
"start_col": 21,
"start_line": 169
} |
Prims.Tot | val hash_word_len (a: md_alg) : n: U32.t{U32.v n = hash_word_length a} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.UInt128",
"short_module": "U128"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "Constants"
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast.Full",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": 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 hash_word_len (a: md_alg): n:U32.t { U32.v n = hash_word_length a } =
match a with
| MD5 -> 4ul
| SHA1 -> 5ul
| SHA2_224 -> 7ul
| SHA2_256 -> 8ul
| SHA2_384 -> 6ul
| SHA2_512 -> 8ul | val hash_word_len (a: md_alg) : n: U32.t{U32.v n = hash_word_length a}
let hash_word_len (a: md_alg) : n: U32.t{U32.v n = hash_word_length a} = | false | null | false | match a with
| MD5 -> 4ul
| SHA1 -> 5ul
| SHA2_224 -> 7ul
| SHA2_256 -> 8ul
| SHA2_384 -> 6ul
| SHA2_512 -> 8ul | {
"checked_file": "Hacl.Hash.PadFinish.fst.checked",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.MD.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Hacl.Impl.SHA3.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Hash.Lemmas.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt128.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.PadFinish.fst"
} | [
"total"
] | [
"Spec.Hash.Definitions.md_alg",
"FStar.UInt32.__uint_to_t",
"FStar.UInt32.t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"FStar.UInt.size",
"FStar.UInt32.n",
"Prims.op_GreaterThanOrEqual",
"FStar.UInt32.v",
"Spec.Hash.Definitions.hash_word_length"
] | [] | module Hacl.Hash.PadFinish
open Lib.IntTypes
module Cast = FStar.Int.Cast.Full
module Constants = Spec.SHA2.Constants
module Helpers = Spec.Hash.Definitions
module Math = FStar.Math.Lemmas
module Helpers = Spec.Hash.Definitions
module U32=FStar.UInt32
module U64=FStar.UInt64
module U128=FStar.UInt128
module M = LowStar.Modifies
module S = FStar.Seq
module B = LowStar.Buffer
module G = FStar.Ghost
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open Hacl.Hash.Definitions
open Hacl.Hash.Lemmas
open Spec.Hash.Definitions
open Spec.Hash.Lemmas
(** Padding *)
#set-options "--z3rlimit 50"
inline_for_extraction
val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len))))
inline_for_extraction
let store_len a len b =
match a with
| MD5 ->
Lib.ByteBuffer.uint_to_bytes_le b (secret #U64 len)
| SHA1 | SHA2_224 | SHA2_256 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U64 len)
| SHA2_384 | SHA2_512 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U128 len)
#set-options "--z3rlimit 20"
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100 --z3seed 1"
inline_for_extraction noextract
let len_mod_32 (a: md_alg) (len: len_t a):
Tot (n:U32.t { U32.v n = len_v a len % Helpers.block_length a })
=
assert (block_len a <> 0ul);
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | Blake2S ->
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
| _ ->
// this case is more difficult because we do: (len % pow2 64) % block_len
// and then we need to show it's equal to len % block_len
[@inline_let]
let len = Cast.uint128_to_uint64 len in
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
// JP: this proof works instantly in interactive mode, not in batch mode unless
// there's a high rlimit
#push-options "--z3rlimit 200"
inline_for_extraction
let pad0_len (a: hash_alg{is_md a}) (len: len_t a):
Tot (n:U32.t { U32.v n = pad0_length a (len_v a len) })
=
let open U32 in
(* 1. *)
Math.lemma_mod_mod (U32.v (len_mod_32 a len)) (len_v a len) (block_length a);
assert (U32.v (len_mod_32 a len) % U32.v (block_len a) =
len_v a len % U32.v (block_len a));
assert ((- U32.v (len_mod_32 a len)) % U32.v (block_len a) =
(- len_v a len) % (U32.v (block_len a)));
Math.modulo_add (U32.v (block_len a)) (- U32.v (len_len a) - 1)
(- U32.v (len_mod_32 a len)) (- len_v a len);
assert ((- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) % U32.v (block_len a) =
(- (U32.v (len_len a) + 1 + len_v a len)) % (U32.v (block_len a)));
(* 2. *)
Math.lemma_mod_plus (U32.v (block_len a)) 1 (U32.v (block_len a));
assert ((U32.v (block_len a) + U32.v (block_len a)) % U32.v (block_len a) =
(U32.v (block_len a)) % U32.v (block_len a));
(* Combine 1 and 2 *)
Math.modulo_add (U32.v (block_len a))
(U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(- (U32.v (len_len a) + 1 + len_v a len));
assert (
(U32.v (block_len a) - (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) %
U32.v (block_len a) =
(U32.v (block_len a) - (U32.v (len_len a) + 1 + len_v a len)) %
U32.v (block_len a));
Math.modulo_add (U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(U32.v (block_len a))
(U32.v (block_len a) + U32.v (block_len a));
[@inline_let]
let r = (block_len a +^ block_len a) -^ (len_len a +^ 1ul +^ len_mod_32 a len) in
r %^ block_len a
#pop-options
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 20"
inline_for_extraction
let pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = 1))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80))))
=
dst.(0ul) <- u8 0x80
inline_for_extraction
let pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = pad0_length a (len_v a len)))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0))))
=
let h0 = ST.get () in
let len_zero = pad0_len a len in
let inv h1 (i: nat) =
M.(modifies (loc_buffer dst) h0 h1) /\
i <= U32.v len_zero /\
S.equal (S.slice (B.as_seq h1 dst) 0 i) (S.slice (S.create (U32.v len_zero) (u8 0)) 0 i)
in
let f (i:U32.t { U32.(0 <= v i /\ v i < U32.v len_zero)}):
ST.Stack unit
(requires (fun h -> inv h (U32.v i)))
(ensures (fun h0 _ h1 -> inv h0 (U32.v i) /\ inv h1 U32.(v i + 1)))
=
dst.(i) <- u8 0;
(**) let h' = ST.get () in
(**) create_next (B.as_seq h' dst) (u8 0) (U32.v i)
in
C.Loops.for 0ul (pad0_len a len) inv f
inline_for_extraction
let pad_3 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
len_v a len `less_than_max_input_length` a /\
B.live h dst /\ B.length dst = len_length a))
(ensures (fun h0 _ h1 ->
Spec.Hash.MD.max_input_size_len a;
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst)
(match a with
| MD5 -> Lib.ByteSequence.uint_to_bytes_le (secret (nat_to_len a FStar.Mul.(len_v a len * 8)))
| _ -> Lib.ByteSequence.uint_to_bytes_be (secret (nat_to_len a FStar.Mul.(len_v a len * 8))))))
=
begin match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 ->
(**) FStar.UInt.shift_left_value_lemma #64 (U64.v len) 3;
(**) assert (len_v a len <= pow2 61 - 1);
(**) assert_norm FStar.Mul.((pow2 61 - 1) * 8 < pow2 64);
(**) assert_norm (pow2 3 = 8);
(**) assert FStar.Mul.(U64.v len * 8 < pow2 64);
(**) assert FStar.Mul.(FStar.UInt.shift_left #64 (len_v a len) 3 < pow2 64);
(**) assert FStar.Mul.(U64.(v (shift_left len 3ul)) = U64.v len * 8);
store_len a U64.(shift_left len 3ul) dst
| SHA2_384 | SHA2_512 ->
(**) FStar.UInt.shift_left_value_lemma #128 (U128.v len) 3;
(**) assert (len_v a len <= pow2 125 - 1);
(**) assert_norm FStar.Mul.((pow2 125 - 1) * 8 < pow2 128);
(**) assert_norm (pow2 3 = 8);
(**) assert FStar.Mul.(U128.v len * 8 < pow2 128);
(**) assert FStar.Mul.(FStar.UInt.shift_left #128 (len_v a len) 3 < pow2 128);
(**) assert FStar.Mul.(U128.(v (shift_left len 3ul)) = U128.v len * 8);
let len' = U128.(len <<^ 3ul) in
store_len a len' dst
end
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200"
noextract inline_for_extraction
let pad a len dst =
(* i) Append a single 1 bit. *)
let dst1 = B.sub dst 0ul 1ul in
pad_1 a dst1;
(* ii) Fill with zeroes *)
let dst2 = B.sub dst 1ul (pad0_len a len) in
pad_2 a len dst2;
(* iii) Encoded length *)
let dst3 = B.sub dst U32.(1ul +^ (pad0_len a len)) (len_len a) in
pad_3 a len dst3;
(**) let h2 = ST.get () in
(**) assert (
(**) let pad0_length = pad0_length a (len_v a len) in
(**) Spec.Hash.MD.max_input_size_len a;
(**) let s = B.as_seq h2 dst in
(**) let s1 = S.slice s 0 1 in
(**) let s2 = S.slice s 1 (1 + pad0_length) in
(**) let s3 = S.slice s (1 + pad0_length) (1 + pad0_length + len_length a) in
(**) S.equal s (S.append s1 (S.append s2 s3)) /\
(**) True)
inline_for_extraction noextract
let pad_len a len =
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | SHA2_384 | SHA2_512 ->
U32.(1ul +^ pad0_len a len +^ len_len a)
#set-options "--max_ifuel 1"
inline_for_extraction | false | false | Hacl.Hash.PadFinish.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 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": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val hash_word_len (a: md_alg) : n: U32.t{U32.v n = hash_word_length a} | [] | Hacl.Hash.PadFinish.hash_word_len | {
"file_name": "code/hash/Hacl.Hash.PadFinish.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.Hash.Definitions.md_alg
-> n: FStar.UInt32.t{FStar.UInt32.v n = Spec.Hash.Definitions.hash_word_length a} | {
"end_col": 19,
"end_line": 237,
"start_col": 2,
"start_line": 231
} |
FStar.HyperStack.ST.Stack | val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len)))) | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.UInt128",
"short_module": "U128"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "Constants"
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast.Full",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": 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 store_len a len b =
match a with
| MD5 ->
Lib.ByteBuffer.uint_to_bytes_le b (secret #U64 len)
| SHA1 | SHA2_224 | SHA2_256 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U64 len)
| SHA2_384 | SHA2_512 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U128 len) | val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len))))
let store_len a len b = | true | null | false | match a with
| MD5 -> Lib.ByteBuffer.uint_to_bytes_le b (secret #U64 len)
| SHA1 | SHA2_224 | SHA2_256 -> Lib.ByteBuffer.uint_to_bytes_be b (secret #U64 len)
| SHA2_384 | SHA2_512 -> Lib.ByteBuffer.uint_to_bytes_be b (secret #U128 len) | {
"checked_file": "Hacl.Hash.PadFinish.fst.checked",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.MD.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Hacl.Impl.SHA3.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Hash.Lemmas.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt128.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.PadFinish.fst"
} | [] | [
"Spec.Hash.Definitions.hash_alg",
"Prims.b2t",
"Spec.Hash.Definitions.is_md",
"Spec.Hash.Definitions.len_t",
"LowStar.Buffer.buffer",
"Lib.IntTypes.uint8",
"Lib.ByteBuffer.uint_to_bytes_le",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Lib.IntTypes.secret",
"Prims.unit",
"Lib.ByteBuffer.uint_to_bytes_be",
"Lib.IntTypes.U128"
] | [] | module Hacl.Hash.PadFinish
open Lib.IntTypes
module Cast = FStar.Int.Cast.Full
module Constants = Spec.SHA2.Constants
module Helpers = Spec.Hash.Definitions
module Math = FStar.Math.Lemmas
module Helpers = Spec.Hash.Definitions
module U32=FStar.UInt32
module U64=FStar.UInt64
module U128=FStar.UInt128
module M = LowStar.Modifies
module S = FStar.Seq
module B = LowStar.Buffer
module G = FStar.Ghost
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open Hacl.Hash.Definitions
open Hacl.Hash.Lemmas
open Spec.Hash.Definitions
open Spec.Hash.Lemmas
(** Padding *)
#set-options "--z3rlimit 50"
inline_for_extraction
val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len))))
inline_for_extraction | false | false | Hacl.Hash.PadFinish.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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len)))) | [] | Hacl.Hash.PadFinish.store_len | {
"file_name": "code/hash/Hacl.Hash.PadFinish.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Spec.Hash.Definitions.hash_alg{Spec.Hash.Definitions.is_md a} ->
len: Spec.Hash.Definitions.len_t a ->
b: LowStar.Buffer.buffer Lib.IntTypes.uint8
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 56,
"end_line": 52,
"start_col": 2,
"start_line": 46
} |
Prims.Tot | val len_mod_32 (a: md_alg) (len: len_t a)
: Tot (n: U32.t{U32.v n = len_v a len % Helpers.block_length a}) | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.UInt128",
"short_module": "U128"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "Constants"
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast.Full",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": 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 len_mod_32 (a: md_alg) (len: len_t a):
Tot (n:U32.t { U32.v n = len_v a len % Helpers.block_length a })
=
assert (block_len a <> 0ul);
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | Blake2S ->
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
| _ ->
// this case is more difficult because we do: (len % pow2 64) % block_len
// and then we need to show it's equal to len % block_len
[@inline_let]
let len = Cast.uint128_to_uint64 len in
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a))) | val len_mod_32 (a: md_alg) (len: len_t a)
: Tot (n: U32.t{U32.v n = len_v a len % Helpers.block_length a})
let len_mod_32 (a: md_alg) (len: len_t a)
: Tot (n: U32.t{U32.v n = len_v a len % Helpers.block_length a}) = | false | null | false | assert (block_len a <> 0ul);
match a with
| MD5
| SHA1
| SHA2_224
| SHA2_256
| Blake2S ->
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (let open U64 in len %^ Cast.uint32_to_uint64 (block_len a))
| _ ->
[@@ inline_let ]let len = Cast.uint128_to_uint64 len in
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (let open U64 in len %^ Cast.uint32_to_uint64 (block_len a)) | {
"checked_file": "Hacl.Hash.PadFinish.fst.checked",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.MD.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Hacl.Impl.SHA3.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Hash.Lemmas.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt128.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.PadFinish.fst"
} | [
"total"
] | [
"Spec.Hash.Definitions.md_alg",
"Spec.Hash.Definitions.len_t",
"FStar.Int.Cast.uint64_to_uint32",
"FStar.UInt64.op_Percent_Hat",
"FStar.Int.Cast.uint32_to_uint64",
"Hacl.Hash.Definitions.block_len",
"Prims.unit",
"FStar.Math.Lemmas.modulo_lemma",
"Prims.op_Modulus",
"FStar.UInt64.v",
"FStar.UInt32.v",
"Prims.pow2",
"FStar.Math.Lemmas.lemma_mod_lt",
"Spec.Hash.Definitions.hash_alg",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"FStar.UInt128.v",
"FStar.Int.Cast.Full.uint128_to_uint64",
"FStar.UInt32.t",
"Prims.b2t",
"Prims.op_Equality",
"Spec.Hash.Definitions.len_v",
"Spec.Hash.Definitions.block_length",
"Prims._assert",
"Prims.op_disEquality",
"FStar.UInt32.__uint_to_t"
] | [] | module Hacl.Hash.PadFinish
open Lib.IntTypes
module Cast = FStar.Int.Cast.Full
module Constants = Spec.SHA2.Constants
module Helpers = Spec.Hash.Definitions
module Math = FStar.Math.Lemmas
module Helpers = Spec.Hash.Definitions
module U32=FStar.UInt32
module U64=FStar.UInt64
module U128=FStar.UInt128
module M = LowStar.Modifies
module S = FStar.Seq
module B = LowStar.Buffer
module G = FStar.Ghost
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open Hacl.Hash.Definitions
open Hacl.Hash.Lemmas
open Spec.Hash.Definitions
open Spec.Hash.Lemmas
(** Padding *)
#set-options "--z3rlimit 50"
inline_for_extraction
val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len))))
inline_for_extraction
let store_len a len b =
match a with
| MD5 ->
Lib.ByteBuffer.uint_to_bytes_le b (secret #U64 len)
| SHA1 | SHA2_224 | SHA2_256 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U64 len)
| SHA2_384 | SHA2_512 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U128 len)
#set-options "--z3rlimit 20"
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100 --z3seed 1"
inline_for_extraction noextract
let len_mod_32 (a: md_alg) (len: len_t a):
Tot (n:U32.t { U32.v n = len_v a len % Helpers.block_length a }) | false | false | Hacl.Hash.PadFinish.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": 1,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val len_mod_32 (a: md_alg) (len: len_t a)
: Tot (n: U32.t{U32.v n = len_v a len % Helpers.block_length a}) | [] | Hacl.Hash.PadFinish.len_mod_32 | {
"file_name": "code/hash/Hacl.Hash.PadFinish.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.Hash.Definitions.md_alg -> len: Spec.Hash.Definitions.len_t a
-> n:
FStar.UInt32.t
{FStar.UInt32.v n = Spec.Hash.Definitions.len_v a len % Spec.Hash.Definitions.block_length a} | {
"end_col": 78,
"end_line": 75,
"start_col": 2,
"start_line": 62
} |
FStar.HyperStack.ST.Stack | val pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8)
: ST.Stack unit
(requires (fun h -> B.live h dst /\ B.length dst = 1))
(ensures
(fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\ S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80)))
) | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.UInt128",
"short_module": "U128"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "Constants"
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast.Full",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": 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 pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = 1))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80))))
=
dst.(0ul) <- u8 0x80 | val pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8)
: ST.Stack unit
(requires (fun h -> B.live h dst /\ B.length dst = 1))
(ensures
(fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\ S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80)))
)
let pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8)
: ST.Stack unit
(requires (fun h -> B.live h dst /\ B.length dst = 1))
(ensures
(fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\ S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80)))
) = | true | null | false | dst.(0ul) <- u8 0x80 | {
"checked_file": "Hacl.Hash.PadFinish.fst.checked",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.MD.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Hacl.Impl.SHA3.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Hash.Lemmas.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt128.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.PadFinish.fst"
} | [] | [
"Spec.Hash.Definitions.hash_alg",
"Prims.b2t",
"Spec.Hash.Definitions.is_md",
"LowStar.Buffer.buffer",
"Lib.IntTypes.uint8",
"LowStar.BufferOps.op_Array_Assignment",
"LowStar.Buffer.trivial_preorder",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.u8",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"LowStar.Monotonic.Buffer.live",
"Prims.op_Equality",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_buffer",
"FStar.Seq.Base.equal",
"LowStar.Monotonic.Buffer.as_seq",
"FStar.Seq.Base.create"
] | [] | module Hacl.Hash.PadFinish
open Lib.IntTypes
module Cast = FStar.Int.Cast.Full
module Constants = Spec.SHA2.Constants
module Helpers = Spec.Hash.Definitions
module Math = FStar.Math.Lemmas
module Helpers = Spec.Hash.Definitions
module U32=FStar.UInt32
module U64=FStar.UInt64
module U128=FStar.UInt128
module M = LowStar.Modifies
module S = FStar.Seq
module B = LowStar.Buffer
module G = FStar.Ghost
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open Hacl.Hash.Definitions
open Hacl.Hash.Lemmas
open Spec.Hash.Definitions
open Spec.Hash.Lemmas
(** Padding *)
#set-options "--z3rlimit 50"
inline_for_extraction
val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len))))
inline_for_extraction
let store_len a len b =
match a with
| MD5 ->
Lib.ByteBuffer.uint_to_bytes_le b (secret #U64 len)
| SHA1 | SHA2_224 | SHA2_256 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U64 len)
| SHA2_384 | SHA2_512 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U128 len)
#set-options "--z3rlimit 20"
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100 --z3seed 1"
inline_for_extraction noextract
let len_mod_32 (a: md_alg) (len: len_t a):
Tot (n:U32.t { U32.v n = len_v a len % Helpers.block_length a })
=
assert (block_len a <> 0ul);
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | Blake2S ->
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
| _ ->
// this case is more difficult because we do: (len % pow2 64) % block_len
// and then we need to show it's equal to len % block_len
[@inline_let]
let len = Cast.uint128_to_uint64 len in
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
// JP: this proof works instantly in interactive mode, not in batch mode unless
// there's a high rlimit
#push-options "--z3rlimit 200"
inline_for_extraction
let pad0_len (a: hash_alg{is_md a}) (len: len_t a):
Tot (n:U32.t { U32.v n = pad0_length a (len_v a len) })
=
let open U32 in
(* 1. *)
Math.lemma_mod_mod (U32.v (len_mod_32 a len)) (len_v a len) (block_length a);
assert (U32.v (len_mod_32 a len) % U32.v (block_len a) =
len_v a len % U32.v (block_len a));
assert ((- U32.v (len_mod_32 a len)) % U32.v (block_len a) =
(- len_v a len) % (U32.v (block_len a)));
Math.modulo_add (U32.v (block_len a)) (- U32.v (len_len a) - 1)
(- U32.v (len_mod_32 a len)) (- len_v a len);
assert ((- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) % U32.v (block_len a) =
(- (U32.v (len_len a) + 1 + len_v a len)) % (U32.v (block_len a)));
(* 2. *)
Math.lemma_mod_plus (U32.v (block_len a)) 1 (U32.v (block_len a));
assert ((U32.v (block_len a) + U32.v (block_len a)) % U32.v (block_len a) =
(U32.v (block_len a)) % U32.v (block_len a));
(* Combine 1 and 2 *)
Math.modulo_add (U32.v (block_len a))
(U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(- (U32.v (len_len a) + 1 + len_v a len));
assert (
(U32.v (block_len a) - (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) %
U32.v (block_len a) =
(U32.v (block_len a) - (U32.v (len_len a) + 1 + len_v a len)) %
U32.v (block_len a));
Math.modulo_add (U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(U32.v (block_len a))
(U32.v (block_len a) + U32.v (block_len a));
[@inline_let]
let r = (block_len a +^ block_len a) -^ (len_len a +^ 1ul +^ len_mod_32 a len) in
r %^ block_len a
#pop-options
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 20"
inline_for_extraction
let pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = 1))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80)))) | false | false | Hacl.Hash.PadFinish.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": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8)
: ST.Stack unit
(requires (fun h -> B.live h dst /\ B.length dst = 1))
(ensures
(fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\ S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80)))
) | [] | Hacl.Hash.PadFinish.pad_1 | {
"file_name": "code/hash/Hacl.Hash.PadFinish.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Spec.Hash.Definitions.hash_alg{Spec.Hash.Definitions.is_md a} ->
dst: LowStar.Buffer.buffer Lib.IntTypes.uint8
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 22,
"end_line": 129,
"start_col": 2,
"start_line": 129
} |
Prims.Tot | val pad0_len (a: hash_alg{is_md a}) (len: len_t a)
: Tot (n: U32.t{U32.v n = pad0_length a (len_v a len)}) | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.UInt128",
"short_module": "U128"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "Constants"
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast.Full",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": 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 pad0_len (a: hash_alg{is_md a}) (len: len_t a):
Tot (n:U32.t { U32.v n = pad0_length a (len_v a len) })
=
let open U32 in
(* 1. *)
Math.lemma_mod_mod (U32.v (len_mod_32 a len)) (len_v a len) (block_length a);
assert (U32.v (len_mod_32 a len) % U32.v (block_len a) =
len_v a len % U32.v (block_len a));
assert ((- U32.v (len_mod_32 a len)) % U32.v (block_len a) =
(- len_v a len) % (U32.v (block_len a)));
Math.modulo_add (U32.v (block_len a)) (- U32.v (len_len a) - 1)
(- U32.v (len_mod_32 a len)) (- len_v a len);
assert ((- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) % U32.v (block_len a) =
(- (U32.v (len_len a) + 1 + len_v a len)) % (U32.v (block_len a)));
(* 2. *)
Math.lemma_mod_plus (U32.v (block_len a)) 1 (U32.v (block_len a));
assert ((U32.v (block_len a) + U32.v (block_len a)) % U32.v (block_len a) =
(U32.v (block_len a)) % U32.v (block_len a));
(* Combine 1 and 2 *)
Math.modulo_add (U32.v (block_len a))
(U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(- (U32.v (len_len a) + 1 + len_v a len));
assert (
(U32.v (block_len a) - (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) %
U32.v (block_len a) =
(U32.v (block_len a) - (U32.v (len_len a) + 1 + len_v a len)) %
U32.v (block_len a));
Math.modulo_add (U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(U32.v (block_len a))
(U32.v (block_len a) + U32.v (block_len a));
[@inline_let]
let r = (block_len a +^ block_len a) -^ (len_len a +^ 1ul +^ len_mod_32 a len) in
r %^ block_len a | val pad0_len (a: hash_alg{is_md a}) (len: len_t a)
: Tot (n: U32.t{U32.v n = pad0_length a (len_v a len)})
let pad0_len (a: hash_alg{is_md a}) (len: len_t a)
: Tot (n: U32.t{U32.v n = pad0_length a (len_v a len)}) = | false | null | false | let open U32 in
Math.lemma_mod_mod (U32.v (len_mod_32 a len)) (len_v a len) (block_length a);
assert (U32.v (len_mod_32 a len) % U32.v (block_len a) = len_v a len % U32.v (block_len a));
assert ((- U32.v (len_mod_32 a len)) % U32.v (block_len a) = (- len_v a len) % (U32.v (block_len a))
);
Math.modulo_add (U32.v (block_len a))
(- U32.v (len_len a) - 1)
(- U32.v (len_mod_32 a len))
(- len_v a len);
assert ((- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) % U32.v (block_len a) =
(- (U32.v (len_len a) + 1 + len_v a len)) % (U32.v (block_len a)));
Math.lemma_mod_plus (U32.v (block_len a)) 1 (U32.v (block_len a));
assert ((U32.v (block_len a) + U32.v (block_len a)) % U32.v (block_len a) =
(U32.v (block_len a)) % U32.v (block_len a));
Math.modulo_add (U32.v (block_len a))
(U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(- (U32.v (len_len a) + 1 + len_v a len));
assert ((U32.v (block_len a) - (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) %
U32.v (block_len a) =
(U32.v (block_len a) - (U32.v (len_len a) + 1 + len_v a len)) % U32.v (block_len a));
Math.modulo_add (U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(U32.v (block_len a))
(U32.v (block_len a) + U32.v (block_len a));
[@@ inline_let ]let r = (block_len a +^ block_len a) -^ (len_len a +^ 1ul +^ len_mod_32 a len) in
r %^ block_len a | {
"checked_file": "Hacl.Hash.PadFinish.fst.checked",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.MD.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Hacl.Impl.SHA3.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Hash.Lemmas.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt128.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.PadFinish.fst"
} | [
"total"
] | [
"Spec.Hash.Definitions.hash_alg",
"Prims.b2t",
"Spec.Hash.Definitions.is_md",
"Spec.Hash.Definitions.len_t",
"FStar.UInt32.op_Percent_Hat",
"Hacl.Hash.Definitions.block_len",
"FStar.UInt32.t",
"FStar.UInt32.op_Subtraction_Hat",
"FStar.UInt32.op_Plus_Hat",
"Spec.Hash.Definitions.len_len",
"FStar.UInt32.__uint_to_t",
"Hacl.Hash.PadFinish.len_mod_32",
"Prims.unit",
"FStar.Math.Lemmas.modulo_add",
"FStar.UInt32.v",
"Prims.op_Minus",
"Prims.op_Addition",
"Prims._assert",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"Prims.op_Subtraction",
"Spec.Hash.Definitions.len_v",
"FStar.Math.Lemmas.lemma_mod_plus",
"FStar.Math.Lemmas.lemma_mod_mod",
"Spec.Hash.Definitions.block_length",
"Prims.l_or",
"FStar.UInt.size",
"FStar.UInt32.n",
"Prims.l_and",
"Prims.op_GreaterThanOrEqual",
"Spec.Hash.Definitions.len_length",
"Spec.Hash.Definitions.pad0_length"
] | [] | module Hacl.Hash.PadFinish
open Lib.IntTypes
module Cast = FStar.Int.Cast.Full
module Constants = Spec.SHA2.Constants
module Helpers = Spec.Hash.Definitions
module Math = FStar.Math.Lemmas
module Helpers = Spec.Hash.Definitions
module U32=FStar.UInt32
module U64=FStar.UInt64
module U128=FStar.UInt128
module M = LowStar.Modifies
module S = FStar.Seq
module B = LowStar.Buffer
module G = FStar.Ghost
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open Hacl.Hash.Definitions
open Hacl.Hash.Lemmas
open Spec.Hash.Definitions
open Spec.Hash.Lemmas
(** Padding *)
#set-options "--z3rlimit 50"
inline_for_extraction
val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len))))
inline_for_extraction
let store_len a len b =
match a with
| MD5 ->
Lib.ByteBuffer.uint_to_bytes_le b (secret #U64 len)
| SHA1 | SHA2_224 | SHA2_256 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U64 len)
| SHA2_384 | SHA2_512 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U128 len)
#set-options "--z3rlimit 20"
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100 --z3seed 1"
inline_for_extraction noextract
let len_mod_32 (a: md_alg) (len: len_t a):
Tot (n:U32.t { U32.v n = len_v a len % Helpers.block_length a })
=
assert (block_len a <> 0ul);
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | Blake2S ->
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
| _ ->
// this case is more difficult because we do: (len % pow2 64) % block_len
// and then we need to show it's equal to len % block_len
[@inline_let]
let len = Cast.uint128_to_uint64 len in
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
// JP: this proof works instantly in interactive mode, not in batch mode unless
// there's a high rlimit
#push-options "--z3rlimit 200"
inline_for_extraction
let pad0_len (a: hash_alg{is_md a}) (len: len_t a):
Tot (n:U32.t { U32.v n = pad0_length a (len_v a len) }) | false | false | Hacl.Hash.PadFinish.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": 200,
"z3rlimit_factor": 1,
"z3seed": 1,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pad0_len (a: hash_alg{is_md a}) (len: len_t a)
: Tot (n: U32.t{U32.v n = pad0_length a (len_v a len)}) | [] | Hacl.Hash.PadFinish.pad0_len | {
"file_name": "code/hash/Hacl.Hash.PadFinish.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Spec.Hash.Definitions.hash_alg{Spec.Hash.Definitions.is_md a} ->
len: Spec.Hash.Definitions.len_t a
-> n:
FStar.UInt32.t
{FStar.UInt32.v n = Spec.Hash.Definitions.pad0_length a (Spec.Hash.Definitions.len_v a len)} | {
"end_col": 18,
"end_line": 115,
"start_col": 2,
"start_line": 84
} |
Prims.Tot | val finish (i:fixed_len_impl) : finish_st i | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.UInt128",
"short_module": "U128"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "Constants"
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast.Full",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": 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 finish i s dst =
[@inline_let] let a = get_alg i in
[@inline_let] let m = get_spec i in
match a with
| MD5 -> Lib.ByteBuffer.uints_to_bytes_le #U32 #SEC (hash_word_len a) dst (B.sub s 0ul (hash_word_len a))
| Blake2S ->
Hacl.Impl.Blake2.Generic.blake2_finish #Spec.Blake2.Blake2S #m 32ul dst s
| Blake2B ->
Hacl.Impl.Blake2.Generic.blake2_finish #Spec.Blake2.Blake2B #m 64ul dst s
| SHA3_224 | SHA3_256 | SHA3_384 | SHA3_512 ->
finish_sha3 a s dst
| _ -> Lib.ByteBuffer.uints_to_bytes_be #(word_t a) #SEC (hash_word_len a) dst (B.sub s 0ul (hash_word_len a)) | val finish (i:fixed_len_impl) : finish_st i
let finish i s dst = | false | null | false | [@@ inline_let ]let a = get_alg i in
[@@ inline_let ]let m = get_spec i in
match a with
| MD5 ->
Lib.ByteBuffer.uints_to_bytes_le #U32 #SEC (hash_word_len a) dst (B.sub s 0ul (hash_word_len a))
| Blake2S -> Hacl.Impl.Blake2.Generic.blake2_finish #Spec.Blake2.Blake2S #m 32ul dst s
| Blake2B -> Hacl.Impl.Blake2.Generic.blake2_finish #Spec.Blake2.Blake2B #m 64ul dst s
| SHA3_224 | SHA3_256 | SHA3_384 | SHA3_512 -> finish_sha3 a s dst
| _ ->
Lib.ByteBuffer.uints_to_bytes_be #(word_t a)
#SEC
(hash_word_len a)
dst
(B.sub s 0ul (hash_word_len a)) | {
"checked_file": "Hacl.Hash.PadFinish.fst.checked",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.MD.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Hacl.Impl.SHA3.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Hash.Lemmas.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt128.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.PadFinish.fst"
} | [
"total"
] | [
"Hacl.Hash.Definitions.fixed_len_impl",
"Hacl.Hash.Definitions.state",
"Hacl.Hash.Definitions.hash_t",
"Hacl.Hash.Definitions.get_alg",
"Lib.ByteBuffer.uints_to_bytes_le",
"Lib.IntTypes.U32",
"Lib.IntTypes.SEC",
"Hacl.Hash.PadFinish.hash_word_len",
"Prims.unit",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"LowStar.Buffer.sub",
"Hacl.Hash.Definitions.impl_word",
"FStar.UInt32.__uint_to_t",
"FStar.Ghost.hide",
"FStar.UInt32.t",
"LowStar.Monotonic.Buffer.mbuffer",
"LowStar.Buffer.trivial_preorder",
"Hacl.Impl.Blake2.Generic.blake2_finish",
"Spec.Blake2.Blake2S",
"Spec.Blake2.Blake2B",
"Hacl.Hash.PadFinish.finish_sha3",
"Spec.Hash.Definitions.hash_alg",
"Lib.ByteBuffer.uints_to_bytes_be",
"Spec.Hash.Definitions.word_t",
"Hacl.Hash.Definitions.m_spec",
"Hacl.Hash.Definitions.get_spec"
] | [] | module Hacl.Hash.PadFinish
open Lib.IntTypes
module Cast = FStar.Int.Cast.Full
module Constants = Spec.SHA2.Constants
module Helpers = Spec.Hash.Definitions
module Math = FStar.Math.Lemmas
module Helpers = Spec.Hash.Definitions
module U32=FStar.UInt32
module U64=FStar.UInt64
module U128=FStar.UInt128
module M = LowStar.Modifies
module S = FStar.Seq
module B = LowStar.Buffer
module G = FStar.Ghost
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open Hacl.Hash.Definitions
open Hacl.Hash.Lemmas
open Spec.Hash.Definitions
open Spec.Hash.Lemmas
(** Padding *)
#set-options "--z3rlimit 50"
inline_for_extraction
val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len))))
inline_for_extraction
let store_len a len b =
match a with
| MD5 ->
Lib.ByteBuffer.uint_to_bytes_le b (secret #U64 len)
| SHA1 | SHA2_224 | SHA2_256 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U64 len)
| SHA2_384 | SHA2_512 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U128 len)
#set-options "--z3rlimit 20"
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100 --z3seed 1"
inline_for_extraction noextract
let len_mod_32 (a: md_alg) (len: len_t a):
Tot (n:U32.t { U32.v n = len_v a len % Helpers.block_length a })
=
assert (block_len a <> 0ul);
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | Blake2S ->
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
| _ ->
// this case is more difficult because we do: (len % pow2 64) % block_len
// and then we need to show it's equal to len % block_len
[@inline_let]
let len = Cast.uint128_to_uint64 len in
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
// JP: this proof works instantly in interactive mode, not in batch mode unless
// there's a high rlimit
#push-options "--z3rlimit 200"
inline_for_extraction
let pad0_len (a: hash_alg{is_md a}) (len: len_t a):
Tot (n:U32.t { U32.v n = pad0_length a (len_v a len) })
=
let open U32 in
(* 1. *)
Math.lemma_mod_mod (U32.v (len_mod_32 a len)) (len_v a len) (block_length a);
assert (U32.v (len_mod_32 a len) % U32.v (block_len a) =
len_v a len % U32.v (block_len a));
assert ((- U32.v (len_mod_32 a len)) % U32.v (block_len a) =
(- len_v a len) % (U32.v (block_len a)));
Math.modulo_add (U32.v (block_len a)) (- U32.v (len_len a) - 1)
(- U32.v (len_mod_32 a len)) (- len_v a len);
assert ((- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) % U32.v (block_len a) =
(- (U32.v (len_len a) + 1 + len_v a len)) % (U32.v (block_len a)));
(* 2. *)
Math.lemma_mod_plus (U32.v (block_len a)) 1 (U32.v (block_len a));
assert ((U32.v (block_len a) + U32.v (block_len a)) % U32.v (block_len a) =
(U32.v (block_len a)) % U32.v (block_len a));
(* Combine 1 and 2 *)
Math.modulo_add (U32.v (block_len a))
(U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(- (U32.v (len_len a) + 1 + len_v a len));
assert (
(U32.v (block_len a) - (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) %
U32.v (block_len a) =
(U32.v (block_len a) - (U32.v (len_len a) + 1 + len_v a len)) %
U32.v (block_len a));
Math.modulo_add (U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(U32.v (block_len a))
(U32.v (block_len a) + U32.v (block_len a));
[@inline_let]
let r = (block_len a +^ block_len a) -^ (len_len a +^ 1ul +^ len_mod_32 a len) in
r %^ block_len a
#pop-options
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 20"
inline_for_extraction
let pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = 1))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80))))
=
dst.(0ul) <- u8 0x80
inline_for_extraction
let pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = pad0_length a (len_v a len)))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0))))
=
let h0 = ST.get () in
let len_zero = pad0_len a len in
let inv h1 (i: nat) =
M.(modifies (loc_buffer dst) h0 h1) /\
i <= U32.v len_zero /\
S.equal (S.slice (B.as_seq h1 dst) 0 i) (S.slice (S.create (U32.v len_zero) (u8 0)) 0 i)
in
let f (i:U32.t { U32.(0 <= v i /\ v i < U32.v len_zero)}):
ST.Stack unit
(requires (fun h -> inv h (U32.v i)))
(ensures (fun h0 _ h1 -> inv h0 (U32.v i) /\ inv h1 U32.(v i + 1)))
=
dst.(i) <- u8 0;
(**) let h' = ST.get () in
(**) create_next (B.as_seq h' dst) (u8 0) (U32.v i)
in
C.Loops.for 0ul (pad0_len a len) inv f
inline_for_extraction
let pad_3 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
len_v a len `less_than_max_input_length` a /\
B.live h dst /\ B.length dst = len_length a))
(ensures (fun h0 _ h1 ->
Spec.Hash.MD.max_input_size_len a;
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst)
(match a with
| MD5 -> Lib.ByteSequence.uint_to_bytes_le (secret (nat_to_len a FStar.Mul.(len_v a len * 8)))
| _ -> Lib.ByteSequence.uint_to_bytes_be (secret (nat_to_len a FStar.Mul.(len_v a len * 8))))))
=
begin match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 ->
(**) FStar.UInt.shift_left_value_lemma #64 (U64.v len) 3;
(**) assert (len_v a len <= pow2 61 - 1);
(**) assert_norm FStar.Mul.((pow2 61 - 1) * 8 < pow2 64);
(**) assert_norm (pow2 3 = 8);
(**) assert FStar.Mul.(U64.v len * 8 < pow2 64);
(**) assert FStar.Mul.(FStar.UInt.shift_left #64 (len_v a len) 3 < pow2 64);
(**) assert FStar.Mul.(U64.(v (shift_left len 3ul)) = U64.v len * 8);
store_len a U64.(shift_left len 3ul) dst
| SHA2_384 | SHA2_512 ->
(**) FStar.UInt.shift_left_value_lemma #128 (U128.v len) 3;
(**) assert (len_v a len <= pow2 125 - 1);
(**) assert_norm FStar.Mul.((pow2 125 - 1) * 8 < pow2 128);
(**) assert_norm (pow2 3 = 8);
(**) assert FStar.Mul.(U128.v len * 8 < pow2 128);
(**) assert FStar.Mul.(FStar.UInt.shift_left #128 (len_v a len) 3 < pow2 128);
(**) assert FStar.Mul.(U128.(v (shift_left len 3ul)) = U128.v len * 8);
let len' = U128.(len <<^ 3ul) in
store_len a len' dst
end
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200"
noextract inline_for_extraction
let pad a len dst =
(* i) Append a single 1 bit. *)
let dst1 = B.sub dst 0ul 1ul in
pad_1 a dst1;
(* ii) Fill with zeroes *)
let dst2 = B.sub dst 1ul (pad0_len a len) in
pad_2 a len dst2;
(* iii) Encoded length *)
let dst3 = B.sub dst U32.(1ul +^ (pad0_len a len)) (len_len a) in
pad_3 a len dst3;
(**) let h2 = ST.get () in
(**) assert (
(**) let pad0_length = pad0_length a (len_v a len) in
(**) Spec.Hash.MD.max_input_size_len a;
(**) let s = B.as_seq h2 dst in
(**) let s1 = S.slice s 0 1 in
(**) let s2 = S.slice s 1 (1 + pad0_length) in
(**) let s3 = S.slice s (1 + pad0_length) (1 + pad0_length + len_length a) in
(**) S.equal s (S.append s1 (S.append s2 s3)) /\
(**) True)
inline_for_extraction noextract
let pad_len a len =
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | SHA2_384 | SHA2_512 ->
U32.(1ul +^ pad0_len a len +^ len_len a)
#set-options "--max_ifuel 1"
inline_for_extraction
let hash_word_len (a: md_alg): n:U32.t { U32.v n = hash_word_length a } =
match a with
| MD5 -> 4ul
| SHA1 -> 5ul
| SHA2_224 -> 7ul
| SHA2_256 -> 8ul
| SHA2_384 -> 6ul
| SHA2_512 -> 8ul
#set-options "--fuel 0 --ifuel 0 --z3rlimit 50"
friend Spec.Agile.Hash
noextract inline_for_extraction
let finish_sha3 (a: keccak_alg { not (is_shake a) }): finish_st (| a, () |) = fun s dst ->
Hacl.Impl.SHA3.squeeze s (block_len a) (hash_len a) dst
noextract inline_for_extraction | false | false | Hacl.Hash.PadFinish.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 finish (i:fixed_len_impl) : finish_st i | [] | Hacl.Hash.PadFinish.finish | {
"file_name": "code/hash/Hacl.Hash.PadFinish.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | i: Hacl.Hash.Definitions.fixed_len_impl -> Hacl.Hash.Definitions.finish_st i | {
"end_col": 112,
"end_line": 258,
"start_col": 2,
"start_line": 248
} |
Prims.Tot | val finish_sha3 (a: keccak_alg{not (is_shake a)}) : finish_st (| a, () |) | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.UInt128",
"short_module": "U128"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "Constants"
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast.Full",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": 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 finish_sha3 (a: keccak_alg { not (is_shake a) }): finish_st (| a, () |) = fun s dst ->
Hacl.Impl.SHA3.squeeze s (block_len a) (hash_len a) dst | val finish_sha3 (a: keccak_alg{not (is_shake a)}) : finish_st (| a, () |)
let finish_sha3 (a: keccak_alg{not (is_shake a)}) : finish_st (| a, () |) = | false | null | false | fun s dst -> Hacl.Impl.SHA3.squeeze s (block_len a) (hash_len a) dst | {
"checked_file": "Hacl.Hash.PadFinish.fst.checked",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.MD.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Hacl.Impl.SHA3.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Hash.Lemmas.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt128.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.PadFinish.fst"
} | [
"total"
] | [
"Spec.Hash.Definitions.keccak_alg",
"Prims.b2t",
"Prims.op_Negation",
"Spec.Hash.Definitions.is_shake",
"Hacl.Hash.Definitions.state",
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Hacl.Hash.Definitions.hash_t",
"Hacl.Hash.Definitions.get_alg",
"Hacl.Impl.SHA3.squeeze",
"Hacl.Hash.Definitions.block_len",
"Hacl.Hash.Definitions.hash_len",
"Prims.unit",
"Hacl.Hash.Definitions.finish_st"
] | [] | module Hacl.Hash.PadFinish
open Lib.IntTypes
module Cast = FStar.Int.Cast.Full
module Constants = Spec.SHA2.Constants
module Helpers = Spec.Hash.Definitions
module Math = FStar.Math.Lemmas
module Helpers = Spec.Hash.Definitions
module U32=FStar.UInt32
module U64=FStar.UInt64
module U128=FStar.UInt128
module M = LowStar.Modifies
module S = FStar.Seq
module B = LowStar.Buffer
module G = FStar.Ghost
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open Hacl.Hash.Definitions
open Hacl.Hash.Lemmas
open Spec.Hash.Definitions
open Spec.Hash.Lemmas
(** Padding *)
#set-options "--z3rlimit 50"
inline_for_extraction
val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len))))
inline_for_extraction
let store_len a len b =
match a with
| MD5 ->
Lib.ByteBuffer.uint_to_bytes_le b (secret #U64 len)
| SHA1 | SHA2_224 | SHA2_256 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U64 len)
| SHA2_384 | SHA2_512 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U128 len)
#set-options "--z3rlimit 20"
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100 --z3seed 1"
inline_for_extraction noextract
let len_mod_32 (a: md_alg) (len: len_t a):
Tot (n:U32.t { U32.v n = len_v a len % Helpers.block_length a })
=
assert (block_len a <> 0ul);
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | Blake2S ->
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
| _ ->
// this case is more difficult because we do: (len % pow2 64) % block_len
// and then we need to show it's equal to len % block_len
[@inline_let]
let len = Cast.uint128_to_uint64 len in
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
// JP: this proof works instantly in interactive mode, not in batch mode unless
// there's a high rlimit
#push-options "--z3rlimit 200"
inline_for_extraction
let pad0_len (a: hash_alg{is_md a}) (len: len_t a):
Tot (n:U32.t { U32.v n = pad0_length a (len_v a len) })
=
let open U32 in
(* 1. *)
Math.lemma_mod_mod (U32.v (len_mod_32 a len)) (len_v a len) (block_length a);
assert (U32.v (len_mod_32 a len) % U32.v (block_len a) =
len_v a len % U32.v (block_len a));
assert ((- U32.v (len_mod_32 a len)) % U32.v (block_len a) =
(- len_v a len) % (U32.v (block_len a)));
Math.modulo_add (U32.v (block_len a)) (- U32.v (len_len a) - 1)
(- U32.v (len_mod_32 a len)) (- len_v a len);
assert ((- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) % U32.v (block_len a) =
(- (U32.v (len_len a) + 1 + len_v a len)) % (U32.v (block_len a)));
(* 2. *)
Math.lemma_mod_plus (U32.v (block_len a)) 1 (U32.v (block_len a));
assert ((U32.v (block_len a) + U32.v (block_len a)) % U32.v (block_len a) =
(U32.v (block_len a)) % U32.v (block_len a));
(* Combine 1 and 2 *)
Math.modulo_add (U32.v (block_len a))
(U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(- (U32.v (len_len a) + 1 + len_v a len));
assert (
(U32.v (block_len a) - (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) %
U32.v (block_len a) =
(U32.v (block_len a) - (U32.v (len_len a) + 1 + len_v a len)) %
U32.v (block_len a));
Math.modulo_add (U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(U32.v (block_len a))
(U32.v (block_len a) + U32.v (block_len a));
[@inline_let]
let r = (block_len a +^ block_len a) -^ (len_len a +^ 1ul +^ len_mod_32 a len) in
r %^ block_len a
#pop-options
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 20"
inline_for_extraction
let pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = 1))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80))))
=
dst.(0ul) <- u8 0x80
inline_for_extraction
let pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = pad0_length a (len_v a len)))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0))))
=
let h0 = ST.get () in
let len_zero = pad0_len a len in
let inv h1 (i: nat) =
M.(modifies (loc_buffer dst) h0 h1) /\
i <= U32.v len_zero /\
S.equal (S.slice (B.as_seq h1 dst) 0 i) (S.slice (S.create (U32.v len_zero) (u8 0)) 0 i)
in
let f (i:U32.t { U32.(0 <= v i /\ v i < U32.v len_zero)}):
ST.Stack unit
(requires (fun h -> inv h (U32.v i)))
(ensures (fun h0 _ h1 -> inv h0 (U32.v i) /\ inv h1 U32.(v i + 1)))
=
dst.(i) <- u8 0;
(**) let h' = ST.get () in
(**) create_next (B.as_seq h' dst) (u8 0) (U32.v i)
in
C.Loops.for 0ul (pad0_len a len) inv f
inline_for_extraction
let pad_3 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
len_v a len `less_than_max_input_length` a /\
B.live h dst /\ B.length dst = len_length a))
(ensures (fun h0 _ h1 ->
Spec.Hash.MD.max_input_size_len a;
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst)
(match a with
| MD5 -> Lib.ByteSequence.uint_to_bytes_le (secret (nat_to_len a FStar.Mul.(len_v a len * 8)))
| _ -> Lib.ByteSequence.uint_to_bytes_be (secret (nat_to_len a FStar.Mul.(len_v a len * 8))))))
=
begin match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 ->
(**) FStar.UInt.shift_left_value_lemma #64 (U64.v len) 3;
(**) assert (len_v a len <= pow2 61 - 1);
(**) assert_norm FStar.Mul.((pow2 61 - 1) * 8 < pow2 64);
(**) assert_norm (pow2 3 = 8);
(**) assert FStar.Mul.(U64.v len * 8 < pow2 64);
(**) assert FStar.Mul.(FStar.UInt.shift_left #64 (len_v a len) 3 < pow2 64);
(**) assert FStar.Mul.(U64.(v (shift_left len 3ul)) = U64.v len * 8);
store_len a U64.(shift_left len 3ul) dst
| SHA2_384 | SHA2_512 ->
(**) FStar.UInt.shift_left_value_lemma #128 (U128.v len) 3;
(**) assert (len_v a len <= pow2 125 - 1);
(**) assert_norm FStar.Mul.((pow2 125 - 1) * 8 < pow2 128);
(**) assert_norm (pow2 3 = 8);
(**) assert FStar.Mul.(U128.v len * 8 < pow2 128);
(**) assert FStar.Mul.(FStar.UInt.shift_left #128 (len_v a len) 3 < pow2 128);
(**) assert FStar.Mul.(U128.(v (shift_left len 3ul)) = U128.v len * 8);
let len' = U128.(len <<^ 3ul) in
store_len a len' dst
end
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200"
noextract inline_for_extraction
let pad a len dst =
(* i) Append a single 1 bit. *)
let dst1 = B.sub dst 0ul 1ul in
pad_1 a dst1;
(* ii) Fill with zeroes *)
let dst2 = B.sub dst 1ul (pad0_len a len) in
pad_2 a len dst2;
(* iii) Encoded length *)
let dst3 = B.sub dst U32.(1ul +^ (pad0_len a len)) (len_len a) in
pad_3 a len dst3;
(**) let h2 = ST.get () in
(**) assert (
(**) let pad0_length = pad0_length a (len_v a len) in
(**) Spec.Hash.MD.max_input_size_len a;
(**) let s = B.as_seq h2 dst in
(**) let s1 = S.slice s 0 1 in
(**) let s2 = S.slice s 1 (1 + pad0_length) in
(**) let s3 = S.slice s (1 + pad0_length) (1 + pad0_length + len_length a) in
(**) S.equal s (S.append s1 (S.append s2 s3)) /\
(**) True)
inline_for_extraction noextract
let pad_len a len =
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | SHA2_384 | SHA2_512 ->
U32.(1ul +^ pad0_len a len +^ len_len a)
#set-options "--max_ifuel 1"
inline_for_extraction
let hash_word_len (a: md_alg): n:U32.t { U32.v n = hash_word_length a } =
match a with
| MD5 -> 4ul
| SHA1 -> 5ul
| SHA2_224 -> 7ul
| SHA2_256 -> 8ul
| SHA2_384 -> 6ul
| SHA2_512 -> 8ul
#set-options "--fuel 0 --ifuel 0 --z3rlimit 50"
friend Spec.Agile.Hash | false | false | Hacl.Hash.PadFinish.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 finish_sha3 (a: keccak_alg{not (is_shake a)}) : finish_st (| a, () |) | [] | Hacl.Hash.PadFinish.finish_sha3 | {
"file_name": "code/hash/Hacl.Hash.PadFinish.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.Hash.Definitions.keccak_alg{Prims.op_Negation (Spec.Hash.Definitions.is_shake a)}
-> Hacl.Hash.Definitions.finish_st (| a, () |) | {
"end_col": 57,
"end_line": 244,
"start_col": 78,
"start_line": 243
} |
FStar.HyperStack.ST.Stack | val pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8)
: ST.Stack unit
(requires (fun h -> B.live h dst /\ B.length dst = pad0_length a (len_v a len)))
(ensures
(fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0)))) | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.UInt128",
"short_module": "U128"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "Constants"
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast.Full",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": 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 pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = pad0_length a (len_v a len)))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0))))
=
let h0 = ST.get () in
let len_zero = pad0_len a len in
let inv h1 (i: nat) =
M.(modifies (loc_buffer dst) h0 h1) /\
i <= U32.v len_zero /\
S.equal (S.slice (B.as_seq h1 dst) 0 i) (S.slice (S.create (U32.v len_zero) (u8 0)) 0 i)
in
let f (i:U32.t { U32.(0 <= v i /\ v i < U32.v len_zero)}):
ST.Stack unit
(requires (fun h -> inv h (U32.v i)))
(ensures (fun h0 _ h1 -> inv h0 (U32.v i) /\ inv h1 U32.(v i + 1)))
=
dst.(i) <- u8 0;
(**) let h' = ST.get () in
(**) create_next (B.as_seq h' dst) (u8 0) (U32.v i)
in
C.Loops.for 0ul (pad0_len a len) inv f | val pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8)
: ST.Stack unit
(requires (fun h -> B.live h dst /\ B.length dst = pad0_length a (len_v a len)))
(ensures
(fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0))))
let pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8)
: ST.Stack unit
(requires (fun h -> B.live h dst /\ B.length dst = pad0_length a (len_v a len)))
(ensures
(fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0)))) = | true | null | false | let h0 = ST.get () in
let len_zero = pad0_len a len in
let inv h1 (i: nat) =
M.(modifies (loc_buffer dst) h0 h1) /\ i <= U32.v len_zero /\
S.equal (S.slice (B.as_seq h1 dst) 0 i) (S.slice (S.create (U32.v len_zero) (u8 0)) 0 i)
in
let f (i: U32.t{let open U32 in 0 <= v i /\ v i < U32.v len_zero})
: ST.Stack unit
(requires (fun h -> inv h (U32.v i)))
(ensures (fun h0 _ h1 -> inv h0 (U32.v i) /\ inv h1 U32.(v i + 1))) =
dst.(i) <- u8 0;
let h' = ST.get () in
create_next (B.as_seq h' dst) (u8 0) (U32.v i)
in
C.Loops.for 0ul (pad0_len a len) inv f | {
"checked_file": "Hacl.Hash.PadFinish.fst.checked",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.MD.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Hacl.Impl.SHA3.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Hash.Lemmas.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt128.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.PadFinish.fst"
} | [] | [
"Spec.Hash.Definitions.hash_alg",
"Prims.b2t",
"Spec.Hash.Definitions.is_md",
"Spec.Hash.Definitions.len_t",
"LowStar.Buffer.buffer",
"Lib.IntTypes.uint8",
"C.Loops.for",
"FStar.UInt32.__uint_to_t",
"Hacl.Hash.PadFinish.pad0_len",
"Prims.unit",
"FStar.UInt32.t",
"Prims.l_and",
"Prims.op_LessThanOrEqual",
"FStar.UInt32.v",
"Prims.op_LessThan",
"FStar.Monotonic.HyperStack.mem",
"Prims.op_Addition",
"Hacl.Hash.Lemmas.create_next",
"LowStar.Monotonic.Buffer.as_seq",
"LowStar.Buffer.trivial_preorder",
"Lib.IntTypes.u8",
"FStar.HyperStack.ST.get",
"LowStar.BufferOps.op_Array_Assignment",
"Prims.nat",
"Prims.logical",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_buffer",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.slice",
"FStar.Seq.Base.create",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"FStar.UInt.size",
"Prims.op_GreaterThanOrEqual",
"Prims.op_Modulus",
"Spec.Hash.Definitions.len_v",
"Spec.Hash.Definitions.len_length",
"Spec.Hash.Definitions.block_length",
"Spec.Hash.Definitions.pad0_length",
"LowStar.Monotonic.Buffer.live",
"LowStar.Monotonic.Buffer.length"
] | [] | module Hacl.Hash.PadFinish
open Lib.IntTypes
module Cast = FStar.Int.Cast.Full
module Constants = Spec.SHA2.Constants
module Helpers = Spec.Hash.Definitions
module Math = FStar.Math.Lemmas
module Helpers = Spec.Hash.Definitions
module U32=FStar.UInt32
module U64=FStar.UInt64
module U128=FStar.UInt128
module M = LowStar.Modifies
module S = FStar.Seq
module B = LowStar.Buffer
module G = FStar.Ghost
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open Hacl.Hash.Definitions
open Hacl.Hash.Lemmas
open Spec.Hash.Definitions
open Spec.Hash.Lemmas
(** Padding *)
#set-options "--z3rlimit 50"
inline_for_extraction
val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len))))
inline_for_extraction
let store_len a len b =
match a with
| MD5 ->
Lib.ByteBuffer.uint_to_bytes_le b (secret #U64 len)
| SHA1 | SHA2_224 | SHA2_256 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U64 len)
| SHA2_384 | SHA2_512 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U128 len)
#set-options "--z3rlimit 20"
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100 --z3seed 1"
inline_for_extraction noextract
let len_mod_32 (a: md_alg) (len: len_t a):
Tot (n:U32.t { U32.v n = len_v a len % Helpers.block_length a })
=
assert (block_len a <> 0ul);
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | Blake2S ->
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
| _ ->
// this case is more difficult because we do: (len % pow2 64) % block_len
// and then we need to show it's equal to len % block_len
[@inline_let]
let len = Cast.uint128_to_uint64 len in
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
// JP: this proof works instantly in interactive mode, not in batch mode unless
// there's a high rlimit
#push-options "--z3rlimit 200"
inline_for_extraction
let pad0_len (a: hash_alg{is_md a}) (len: len_t a):
Tot (n:U32.t { U32.v n = pad0_length a (len_v a len) })
=
let open U32 in
(* 1. *)
Math.lemma_mod_mod (U32.v (len_mod_32 a len)) (len_v a len) (block_length a);
assert (U32.v (len_mod_32 a len) % U32.v (block_len a) =
len_v a len % U32.v (block_len a));
assert ((- U32.v (len_mod_32 a len)) % U32.v (block_len a) =
(- len_v a len) % (U32.v (block_len a)));
Math.modulo_add (U32.v (block_len a)) (- U32.v (len_len a) - 1)
(- U32.v (len_mod_32 a len)) (- len_v a len);
assert ((- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) % U32.v (block_len a) =
(- (U32.v (len_len a) + 1 + len_v a len)) % (U32.v (block_len a)));
(* 2. *)
Math.lemma_mod_plus (U32.v (block_len a)) 1 (U32.v (block_len a));
assert ((U32.v (block_len a) + U32.v (block_len a)) % U32.v (block_len a) =
(U32.v (block_len a)) % U32.v (block_len a));
(* Combine 1 and 2 *)
Math.modulo_add (U32.v (block_len a))
(U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(- (U32.v (len_len a) + 1 + len_v a len));
assert (
(U32.v (block_len a) - (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) %
U32.v (block_len a) =
(U32.v (block_len a) - (U32.v (len_len a) + 1 + len_v a len)) %
U32.v (block_len a));
Math.modulo_add (U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(U32.v (block_len a))
(U32.v (block_len a) + U32.v (block_len a));
[@inline_let]
let r = (block_len a +^ block_len a) -^ (len_len a +^ 1ul +^ len_mod_32 a len) in
r %^ block_len a
#pop-options
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 20"
inline_for_extraction
let pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = 1))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80))))
=
dst.(0ul) <- u8 0x80
inline_for_extraction
let pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = pad0_length a (len_v a len)))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\ | false | false | Hacl.Hash.PadFinish.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": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8)
: ST.Stack unit
(requires (fun h -> B.live h dst /\ B.length dst = pad0_length a (len_v a len)))
(ensures
(fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0)))) | [] | Hacl.Hash.PadFinish.pad_2 | {
"file_name": "code/hash/Hacl.Hash.PadFinish.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Spec.Hash.Definitions.hash_alg{Spec.Hash.Definitions.is_md a} ->
len: Spec.Hash.Definitions.len_t a ->
dst: LowStar.Buffer.buffer Lib.IntTypes.uint8
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 40,
"end_line": 156,
"start_col": 1,
"start_line": 139
} |
FStar.HyperStack.ST.Stack | val pad_3 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8)
: ST.Stack unit
(requires
(fun h ->
(len_v a len) `less_than_max_input_length` a /\ B.live h dst /\
B.length dst = len_length a))
(ensures
(fun h0 _ h1 ->
Spec.Hash.MD.max_input_size_len a;
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst)
(match a with
| MD5 ->
Lib.ByteSequence.uint_to_bytes_le (secret (nat_to_len a
FStar.Mul.(len_v a len * 8)))
| _ ->
Lib.ByteSequence.uint_to_bytes_be (secret (nat_to_len a
FStar.Mul.(len_v a len * 8)))))) | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.UInt128",
"short_module": "U128"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "Constants"
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast.Full",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": 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 pad_3 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
len_v a len `less_than_max_input_length` a /\
B.live h dst /\ B.length dst = len_length a))
(ensures (fun h0 _ h1 ->
Spec.Hash.MD.max_input_size_len a;
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst)
(match a with
| MD5 -> Lib.ByteSequence.uint_to_bytes_le (secret (nat_to_len a FStar.Mul.(len_v a len * 8)))
| _ -> Lib.ByteSequence.uint_to_bytes_be (secret (nat_to_len a FStar.Mul.(len_v a len * 8))))))
=
begin match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 ->
(**) FStar.UInt.shift_left_value_lemma #64 (U64.v len) 3;
(**) assert (len_v a len <= pow2 61 - 1);
(**) assert_norm FStar.Mul.((pow2 61 - 1) * 8 < pow2 64);
(**) assert_norm (pow2 3 = 8);
(**) assert FStar.Mul.(U64.v len * 8 < pow2 64);
(**) assert FStar.Mul.(FStar.UInt.shift_left #64 (len_v a len) 3 < pow2 64);
(**) assert FStar.Mul.(U64.(v (shift_left len 3ul)) = U64.v len * 8);
store_len a U64.(shift_left len 3ul) dst
| SHA2_384 | SHA2_512 ->
(**) FStar.UInt.shift_left_value_lemma #128 (U128.v len) 3;
(**) assert (len_v a len <= pow2 125 - 1);
(**) assert_norm FStar.Mul.((pow2 125 - 1) * 8 < pow2 128);
(**) assert_norm (pow2 3 = 8);
(**) assert FStar.Mul.(U128.v len * 8 < pow2 128);
(**) assert FStar.Mul.(FStar.UInt.shift_left #128 (len_v a len) 3 < pow2 128);
(**) assert FStar.Mul.(U128.(v (shift_left len 3ul)) = U128.v len * 8);
let len' = U128.(len <<^ 3ul) in
store_len a len' dst
end | val pad_3 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8)
: ST.Stack unit
(requires
(fun h ->
(len_v a len) `less_than_max_input_length` a /\ B.live h dst /\
B.length dst = len_length a))
(ensures
(fun h0 _ h1 ->
Spec.Hash.MD.max_input_size_len a;
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst)
(match a with
| MD5 ->
Lib.ByteSequence.uint_to_bytes_le (secret (nat_to_len a
FStar.Mul.(len_v a len * 8)))
| _ ->
Lib.ByteSequence.uint_to_bytes_be (secret (nat_to_len a
FStar.Mul.(len_v a len * 8))))))
let pad_3 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8)
: ST.Stack unit
(requires
(fun h ->
(len_v a len) `less_than_max_input_length` a /\ B.live h dst /\
B.length dst = len_length a))
(ensures
(fun h0 _ h1 ->
Spec.Hash.MD.max_input_size_len a;
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst)
(match a with
| MD5 ->
Lib.ByteSequence.uint_to_bytes_le (secret (nat_to_len a
FStar.Mul.(len_v a len * 8)))
| _ ->
Lib.ByteSequence.uint_to_bytes_be (secret (nat_to_len a
FStar.Mul.(len_v a len * 8)))))) = | true | null | false | match a with
| MD5
| SHA1
| SHA2_224
| SHA2_256 ->
FStar.UInt.shift_left_value_lemma #64 (U64.v len) 3;
assert (len_v a len <= pow2 61 - 1);
assert_norm FStar.Mul.((pow2 61 - 1) * 8 < pow2 64);
assert_norm (pow2 3 = 8);
assert FStar.Mul.(U64.v len * 8 < pow2 64);
assert FStar.Mul.(FStar.UInt.shift_left #64 (len_v a len) 3 < pow2 64);
assert FStar.Mul.(U64.(v (shift_left len 3ul)) = U64.v len * 8);
store_len a U64.(shift_left len 3ul) dst
| SHA2_384
| SHA2_512 ->
FStar.UInt.shift_left_value_lemma #128 (U128.v len) 3;
assert (len_v a len <= pow2 125 - 1);
assert_norm FStar.Mul.((pow2 125 - 1) * 8 < pow2 128);
assert_norm (pow2 3 = 8);
assert FStar.Mul.(U128.v len * 8 < pow2 128);
assert FStar.Mul.(FStar.UInt.shift_left #128 (len_v a len) 3 < pow2 128);
assert FStar.Mul.(U128.(v (shift_left len 3ul)) = U128.v len * 8);
let len' = let open U128 in len <<^ 3ul in
store_len a len' dst | {
"checked_file": "Hacl.Hash.PadFinish.fst.checked",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.MD.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Hacl.Impl.SHA3.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Hash.Lemmas.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt128.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.PadFinish.fst"
} | [] | [
"Spec.Hash.Definitions.hash_alg",
"Prims.b2t",
"Spec.Hash.Definitions.is_md",
"Spec.Hash.Definitions.len_t",
"LowStar.Buffer.buffer",
"Lib.IntTypes.uint8",
"Hacl.Hash.PadFinish.store_len",
"FStar.UInt64.shift_left",
"FStar.UInt32.__uint_to_t",
"Prims.unit",
"Prims._assert",
"Prims.op_Equality",
"Prims.int",
"FStar.UInt64.v",
"FStar.Mul.op_Star",
"Prims.op_LessThan",
"FStar.UInt.shift_left",
"Spec.Hash.Definitions.len_v",
"Prims.pow2",
"FStar.Pervasives.assert_norm",
"Prims.op_Subtraction",
"Prims.op_LessThanOrEqual",
"FStar.UInt.shift_left_value_lemma",
"FStar.UInt128.t",
"FStar.UInt128.op_Less_Less_Hat",
"FStar.UInt128.v",
"FStar.UInt128.shift_left",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Spec.Hash.Definitions.less_than_max_input_length",
"LowStar.Monotonic.Buffer.live",
"LowStar.Buffer.trivial_preorder",
"Prims.nat",
"LowStar.Monotonic.Buffer.length",
"Spec.Hash.Definitions.len_length",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_buffer",
"FStar.Seq.Base.equal",
"LowStar.Monotonic.Buffer.as_seq",
"Lib.ByteSequence.uint_to_bytes_le",
"Spec.Hash.Definitions.len_int_type",
"Lib.IntTypes.SEC",
"Lib.IntTypes.secret",
"Spec.Hash.Definitions.nat_to_len",
"Lib.ByteSequence.uint_to_bytes_be",
"FStar.Seq.Base.seq",
"Spec.Hash.MD.max_input_size_len"
] | [] | module Hacl.Hash.PadFinish
open Lib.IntTypes
module Cast = FStar.Int.Cast.Full
module Constants = Spec.SHA2.Constants
module Helpers = Spec.Hash.Definitions
module Math = FStar.Math.Lemmas
module Helpers = Spec.Hash.Definitions
module U32=FStar.UInt32
module U64=FStar.UInt64
module U128=FStar.UInt128
module M = LowStar.Modifies
module S = FStar.Seq
module B = LowStar.Buffer
module G = FStar.Ghost
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open Hacl.Hash.Definitions
open Hacl.Hash.Lemmas
open Spec.Hash.Definitions
open Spec.Hash.Lemmas
(** Padding *)
#set-options "--z3rlimit 50"
inline_for_extraction
val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len))))
inline_for_extraction
let store_len a len b =
match a with
| MD5 ->
Lib.ByteBuffer.uint_to_bytes_le b (secret #U64 len)
| SHA1 | SHA2_224 | SHA2_256 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U64 len)
| SHA2_384 | SHA2_512 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U128 len)
#set-options "--z3rlimit 20"
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100 --z3seed 1"
inline_for_extraction noextract
let len_mod_32 (a: md_alg) (len: len_t a):
Tot (n:U32.t { U32.v n = len_v a len % Helpers.block_length a })
=
assert (block_len a <> 0ul);
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | Blake2S ->
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
| _ ->
// this case is more difficult because we do: (len % pow2 64) % block_len
// and then we need to show it's equal to len % block_len
[@inline_let]
let len = Cast.uint128_to_uint64 len in
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
// JP: this proof works instantly in interactive mode, not in batch mode unless
// there's a high rlimit
#push-options "--z3rlimit 200"
inline_for_extraction
let pad0_len (a: hash_alg{is_md a}) (len: len_t a):
Tot (n:U32.t { U32.v n = pad0_length a (len_v a len) })
=
let open U32 in
(* 1. *)
Math.lemma_mod_mod (U32.v (len_mod_32 a len)) (len_v a len) (block_length a);
assert (U32.v (len_mod_32 a len) % U32.v (block_len a) =
len_v a len % U32.v (block_len a));
assert ((- U32.v (len_mod_32 a len)) % U32.v (block_len a) =
(- len_v a len) % (U32.v (block_len a)));
Math.modulo_add (U32.v (block_len a)) (- U32.v (len_len a) - 1)
(- U32.v (len_mod_32 a len)) (- len_v a len);
assert ((- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) % U32.v (block_len a) =
(- (U32.v (len_len a) + 1 + len_v a len)) % (U32.v (block_len a)));
(* 2. *)
Math.lemma_mod_plus (U32.v (block_len a)) 1 (U32.v (block_len a));
assert ((U32.v (block_len a) + U32.v (block_len a)) % U32.v (block_len a) =
(U32.v (block_len a)) % U32.v (block_len a));
(* Combine 1 and 2 *)
Math.modulo_add (U32.v (block_len a))
(U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(- (U32.v (len_len a) + 1 + len_v a len));
assert (
(U32.v (block_len a) - (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) %
U32.v (block_len a) =
(U32.v (block_len a) - (U32.v (len_len a) + 1 + len_v a len)) %
U32.v (block_len a));
Math.modulo_add (U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(U32.v (block_len a))
(U32.v (block_len a) + U32.v (block_len a));
[@inline_let]
let r = (block_len a +^ block_len a) -^ (len_len a +^ 1ul +^ len_mod_32 a len) in
r %^ block_len a
#pop-options
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 20"
inline_for_extraction
let pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = 1))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80))))
=
dst.(0ul) <- u8 0x80
inline_for_extraction
let pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = pad0_length a (len_v a len)))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0))))
=
let h0 = ST.get () in
let len_zero = pad0_len a len in
let inv h1 (i: nat) =
M.(modifies (loc_buffer dst) h0 h1) /\
i <= U32.v len_zero /\
S.equal (S.slice (B.as_seq h1 dst) 0 i) (S.slice (S.create (U32.v len_zero) (u8 0)) 0 i)
in
let f (i:U32.t { U32.(0 <= v i /\ v i < U32.v len_zero)}):
ST.Stack unit
(requires (fun h -> inv h (U32.v i)))
(ensures (fun h0 _ h1 -> inv h0 (U32.v i) /\ inv h1 U32.(v i + 1)))
=
dst.(i) <- u8 0;
(**) let h' = ST.get () in
(**) create_next (B.as_seq h' dst) (u8 0) (U32.v i)
in
C.Loops.for 0ul (pad0_len a len) inv f
inline_for_extraction
let pad_3 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
len_v a len `less_than_max_input_length` a /\
B.live h dst /\ B.length dst = len_length a))
(ensures (fun h0 _ h1 ->
Spec.Hash.MD.max_input_size_len a;
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst)
(match a with
| MD5 -> Lib.ByteSequence.uint_to_bytes_le (secret (nat_to_len a FStar.Mul.(len_v a len * 8)))
| _ -> Lib.ByteSequence.uint_to_bytes_be (secret (nat_to_len a FStar.Mul.(len_v a len * 8)))))) | false | false | Hacl.Hash.PadFinish.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": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pad_3 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8)
: ST.Stack unit
(requires
(fun h ->
(len_v a len) `less_than_max_input_length` a /\ B.live h dst /\
B.length dst = len_length a))
(ensures
(fun h0 _ h1 ->
Spec.Hash.MD.max_input_size_len a;
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst)
(match a with
| MD5 ->
Lib.ByteSequence.uint_to_bytes_le (secret (nat_to_len a
FStar.Mul.(len_v a len * 8)))
| _ ->
Lib.ByteSequence.uint_to_bytes_be (secret (nat_to_len a
FStar.Mul.(len_v a len * 8)))))) | [] | Hacl.Hash.PadFinish.pad_3 | {
"file_name": "code/hash/Hacl.Hash.PadFinish.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Spec.Hash.Definitions.hash_alg{Spec.Hash.Definitions.is_md a} ->
len: Spec.Hash.Definitions.len_t a ->
dst: LowStar.Buffer.buffer Lib.IntTypes.uint8
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 26,
"end_line": 191,
"start_col": 8,
"start_line": 172
} |
Prims.Tot | val pad_len: a:md_alg -> len:len_t a ->
x:U32.t { U32.v x = pad_length a (len_v a len) } | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.UInt128",
"short_module": "U128"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "Constants"
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast.Full",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": 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 pad_len a len =
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | SHA2_384 | SHA2_512 ->
U32.(1ul +^ pad0_len a len +^ len_len a) | val pad_len: a:md_alg -> len:len_t a ->
x:U32.t { U32.v x = pad_length a (len_v a len) }
let pad_len a len = | false | null | false | match a with
| MD5
| SHA1
| SHA2_224
| SHA2_256
| SHA2_384
| SHA2_512 -> let open U32 in 1ul +^ pad0_len a len +^ len_len a | {
"checked_file": "Hacl.Hash.PadFinish.fst.checked",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.MD.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Hacl.Impl.SHA3.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Hash.Lemmas.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt128.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.PadFinish.fst"
} | [
"total"
] | [
"Spec.Hash.Definitions.md_alg",
"Spec.Hash.Definitions.len_t",
"FStar.UInt32.op_Plus_Hat",
"FStar.UInt32.__uint_to_t",
"Hacl.Hash.PadFinish.pad0_len",
"Spec.Hash.Definitions.len_len",
"FStar.UInt32.t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"FStar.UInt.size",
"FStar.UInt32.n",
"Prims.l_and",
"Prims.op_GreaterThanOrEqual",
"Prims.op_Modulus",
"Prims.op_Addition",
"Spec.Hash.Definitions.len_v",
"Spec.Hash.Definitions.block_length",
"FStar.UInt32.v",
"Spec.Hash.Definitions.pad_length"
] | [] | module Hacl.Hash.PadFinish
open Lib.IntTypes
module Cast = FStar.Int.Cast.Full
module Constants = Spec.SHA2.Constants
module Helpers = Spec.Hash.Definitions
module Math = FStar.Math.Lemmas
module Helpers = Spec.Hash.Definitions
module U32=FStar.UInt32
module U64=FStar.UInt64
module U128=FStar.UInt128
module M = LowStar.Modifies
module S = FStar.Seq
module B = LowStar.Buffer
module G = FStar.Ghost
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open Hacl.Hash.Definitions
open Hacl.Hash.Lemmas
open Spec.Hash.Definitions
open Spec.Hash.Lemmas
(** Padding *)
#set-options "--z3rlimit 50"
inline_for_extraction
val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len))))
inline_for_extraction
let store_len a len b =
match a with
| MD5 ->
Lib.ByteBuffer.uint_to_bytes_le b (secret #U64 len)
| SHA1 | SHA2_224 | SHA2_256 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U64 len)
| SHA2_384 | SHA2_512 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U128 len)
#set-options "--z3rlimit 20"
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100 --z3seed 1"
inline_for_extraction noextract
let len_mod_32 (a: md_alg) (len: len_t a):
Tot (n:U32.t { U32.v n = len_v a len % Helpers.block_length a })
=
assert (block_len a <> 0ul);
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | Blake2S ->
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
| _ ->
// this case is more difficult because we do: (len % pow2 64) % block_len
// and then we need to show it's equal to len % block_len
[@inline_let]
let len = Cast.uint128_to_uint64 len in
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
// JP: this proof works instantly in interactive mode, not in batch mode unless
// there's a high rlimit
#push-options "--z3rlimit 200"
inline_for_extraction
let pad0_len (a: hash_alg{is_md a}) (len: len_t a):
Tot (n:U32.t { U32.v n = pad0_length a (len_v a len) })
=
let open U32 in
(* 1. *)
Math.lemma_mod_mod (U32.v (len_mod_32 a len)) (len_v a len) (block_length a);
assert (U32.v (len_mod_32 a len) % U32.v (block_len a) =
len_v a len % U32.v (block_len a));
assert ((- U32.v (len_mod_32 a len)) % U32.v (block_len a) =
(- len_v a len) % (U32.v (block_len a)));
Math.modulo_add (U32.v (block_len a)) (- U32.v (len_len a) - 1)
(- U32.v (len_mod_32 a len)) (- len_v a len);
assert ((- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) % U32.v (block_len a) =
(- (U32.v (len_len a) + 1 + len_v a len)) % (U32.v (block_len a)));
(* 2. *)
Math.lemma_mod_plus (U32.v (block_len a)) 1 (U32.v (block_len a));
assert ((U32.v (block_len a) + U32.v (block_len a)) % U32.v (block_len a) =
(U32.v (block_len a)) % U32.v (block_len a));
(* Combine 1 and 2 *)
Math.modulo_add (U32.v (block_len a))
(U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(- (U32.v (len_len a) + 1 + len_v a len));
assert (
(U32.v (block_len a) - (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) %
U32.v (block_len a) =
(U32.v (block_len a) - (U32.v (len_len a) + 1 + len_v a len)) %
U32.v (block_len a));
Math.modulo_add (U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(U32.v (block_len a))
(U32.v (block_len a) + U32.v (block_len a));
[@inline_let]
let r = (block_len a +^ block_len a) -^ (len_len a +^ 1ul +^ len_mod_32 a len) in
r %^ block_len a
#pop-options
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 20"
inline_for_extraction
let pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = 1))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80))))
=
dst.(0ul) <- u8 0x80
inline_for_extraction
let pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = pad0_length a (len_v a len)))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0))))
=
let h0 = ST.get () in
let len_zero = pad0_len a len in
let inv h1 (i: nat) =
M.(modifies (loc_buffer dst) h0 h1) /\
i <= U32.v len_zero /\
S.equal (S.slice (B.as_seq h1 dst) 0 i) (S.slice (S.create (U32.v len_zero) (u8 0)) 0 i)
in
let f (i:U32.t { U32.(0 <= v i /\ v i < U32.v len_zero)}):
ST.Stack unit
(requires (fun h -> inv h (U32.v i)))
(ensures (fun h0 _ h1 -> inv h0 (U32.v i) /\ inv h1 U32.(v i + 1)))
=
dst.(i) <- u8 0;
(**) let h' = ST.get () in
(**) create_next (B.as_seq h' dst) (u8 0) (U32.v i)
in
C.Loops.for 0ul (pad0_len a len) inv f
inline_for_extraction
let pad_3 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
len_v a len `less_than_max_input_length` a /\
B.live h dst /\ B.length dst = len_length a))
(ensures (fun h0 _ h1 ->
Spec.Hash.MD.max_input_size_len a;
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst)
(match a with
| MD5 -> Lib.ByteSequence.uint_to_bytes_le (secret (nat_to_len a FStar.Mul.(len_v a len * 8)))
| _ -> Lib.ByteSequence.uint_to_bytes_be (secret (nat_to_len a FStar.Mul.(len_v a len * 8))))))
=
begin match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 ->
(**) FStar.UInt.shift_left_value_lemma #64 (U64.v len) 3;
(**) assert (len_v a len <= pow2 61 - 1);
(**) assert_norm FStar.Mul.((pow2 61 - 1) * 8 < pow2 64);
(**) assert_norm (pow2 3 = 8);
(**) assert FStar.Mul.(U64.v len * 8 < pow2 64);
(**) assert FStar.Mul.(FStar.UInt.shift_left #64 (len_v a len) 3 < pow2 64);
(**) assert FStar.Mul.(U64.(v (shift_left len 3ul)) = U64.v len * 8);
store_len a U64.(shift_left len 3ul) dst
| SHA2_384 | SHA2_512 ->
(**) FStar.UInt.shift_left_value_lemma #128 (U128.v len) 3;
(**) assert (len_v a len <= pow2 125 - 1);
(**) assert_norm FStar.Mul.((pow2 125 - 1) * 8 < pow2 128);
(**) assert_norm (pow2 3 = 8);
(**) assert FStar.Mul.(U128.v len * 8 < pow2 128);
(**) assert FStar.Mul.(FStar.UInt.shift_left #128 (len_v a len) 3 < pow2 128);
(**) assert FStar.Mul.(U128.(v (shift_left len 3ul)) = U128.v len * 8);
let len' = U128.(len <<^ 3ul) in
store_len a len' dst
end
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200"
noextract inline_for_extraction
let pad a len dst =
(* i) Append a single 1 bit. *)
let dst1 = B.sub dst 0ul 1ul in
pad_1 a dst1;
(* ii) Fill with zeroes *)
let dst2 = B.sub dst 1ul (pad0_len a len) in
pad_2 a len dst2;
(* iii) Encoded length *)
let dst3 = B.sub dst U32.(1ul +^ (pad0_len a len)) (len_len a) in
pad_3 a len dst3;
(**) let h2 = ST.get () in
(**) assert (
(**) let pad0_length = pad0_length a (len_v a len) in
(**) Spec.Hash.MD.max_input_size_len a;
(**) let s = B.as_seq h2 dst in
(**) let s1 = S.slice s 0 1 in
(**) let s2 = S.slice s 1 (1 + pad0_length) in
(**) let s3 = S.slice s (1 + pad0_length) (1 + pad0_length + len_length a) in
(**) S.equal s (S.append s1 (S.append s2 s3)) /\
(**) True)
inline_for_extraction noextract | false | false | Hacl.Hash.PadFinish.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 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": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pad_len: a:md_alg -> len:len_t a ->
x:U32.t { U32.v x = pad_length a (len_v a len) } | [] | Hacl.Hash.PadFinish.pad_len | {
"file_name": "code/hash/Hacl.Hash.PadFinish.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.Hash.Definitions.md_alg -> len: Spec.Hash.Definitions.len_t a
-> x:
FStar.UInt32.t
{FStar.UInt32.v x = Spec.Hash.Definitions.pad_length a (Spec.Hash.Definitions.len_v a len)} | {
"end_col": 46,
"end_line": 226,
"start_col": 2,
"start_line": 224
} |
Prims.Tot | val pad: a:md_alg -> pad_st a | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.UInt128",
"short_module": "U128"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "Helpers"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "Constants"
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast.Full",
"short_module": "Cast"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": 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 pad a len dst =
(* i) Append a single 1 bit. *)
let dst1 = B.sub dst 0ul 1ul in
pad_1 a dst1;
(* ii) Fill with zeroes *)
let dst2 = B.sub dst 1ul (pad0_len a len) in
pad_2 a len dst2;
(* iii) Encoded length *)
let dst3 = B.sub dst U32.(1ul +^ (pad0_len a len)) (len_len a) in
pad_3 a len dst3;
(**) let h2 = ST.get () in
(**) assert (
(**) let pad0_length = pad0_length a (len_v a len) in
(**) Spec.Hash.MD.max_input_size_len a;
(**) let s = B.as_seq h2 dst in
(**) let s1 = S.slice s 0 1 in
(**) let s2 = S.slice s 1 (1 + pad0_length) in
(**) let s3 = S.slice s (1 + pad0_length) (1 + pad0_length + len_length a) in
(**) S.equal s (S.append s1 (S.append s2 s3)) /\
(**) True) | val pad: a:md_alg -> pad_st a
let pad a len dst = | false | null | false | let dst1 = B.sub dst 0ul 1ul in
pad_1 a dst1;
let dst2 = B.sub dst 1ul (pad0_len a len) in
pad_2 a len dst2;
let dst3 = B.sub dst U32.(1ul +^ (pad0_len a len)) (len_len a) in
pad_3 a len dst3;
let h2 = ST.get () in
assert (let pad0_length = pad0_length a (len_v a len) in
Spec.Hash.MD.max_input_size_len a;
let s = B.as_seq h2 dst in
let s1 = S.slice s 0 1 in
let s2 = S.slice s 1 (1 + pad0_length) in
let s3 = S.slice s (1 + pad0_length) (1 + pad0_length + len_length a) in
S.equal s (S.append s1 (S.append s2 s3)) /\ True) | {
"checked_file": "Hacl.Hash.PadFinish.fst.checked",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.Hash.MD.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Blake2.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Hacl.Impl.SHA3.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Hash.Lemmas.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt128.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"C.Loops.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.PadFinish.fst"
} | [
"total"
] | [
"Spec.Hash.Definitions.md_alg",
"Spec.Hash.Definitions.len_t",
"LowStar.Buffer.buffer",
"Lib.IntTypes.uint8",
"Prims._assert",
"Prims.l_and",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.append",
"Prims.l_True",
"FStar.Seq.Base.seq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.Seq.Base.slice",
"Prims.op_Addition",
"Spec.Hash.Definitions.len_length",
"LowStar.Monotonic.Buffer.as_seq",
"LowStar.Buffer.trivial_preorder",
"Prims.unit",
"Spec.Hash.MD.max_input_size_len",
"Prims.nat",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"Spec.Hash.Definitions.len_v",
"Spec.Hash.Definitions.block_length",
"Spec.Hash.Definitions.pad0_length",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Hash.PadFinish.pad_3",
"LowStar.Monotonic.Buffer.mbuffer",
"LowStar.Buffer.sub",
"FStar.UInt32.op_Plus_Hat",
"FStar.UInt32.__uint_to_t",
"Hacl.Hash.PadFinish.pad0_len",
"FStar.Ghost.hide",
"FStar.UInt32.t",
"Spec.Hash.Definitions.len_len",
"Hacl.Hash.PadFinish.pad_2",
"Hacl.Hash.PadFinish.pad_1"
] | [] | module Hacl.Hash.PadFinish
open Lib.IntTypes
module Cast = FStar.Int.Cast.Full
module Constants = Spec.SHA2.Constants
module Helpers = Spec.Hash.Definitions
module Math = FStar.Math.Lemmas
module Helpers = Spec.Hash.Definitions
module U32=FStar.UInt32
module U64=FStar.UInt64
module U128=FStar.UInt128
module M = LowStar.Modifies
module S = FStar.Seq
module B = LowStar.Buffer
module G = FStar.Ghost
module HS = FStar.HyperStack
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open Hacl.Hash.Definitions
open Hacl.Hash.Lemmas
open Spec.Hash.Definitions
open Spec.Hash.Lemmas
(** Padding *)
#set-options "--z3rlimit 50"
inline_for_extraction
val store_len: a:hash_alg{is_md a} -> len:len_t a -> b:B.buffer uint8 ->
ST.Stack unit
(requires (fun h ->
B.live h b /\
B.length b = Helpers.len_length a))
(ensures (fun h0 _ h1 ->
M.(modifies (loc_buffer b) h0 h1) /\ (
match a with
| MD5 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_le #U64 (secret len)
| SHA1 | SHA2_224 | SHA2_256 -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U64 (secret len)
| _ -> B.as_seq h1 b == Lib.ByteSequence.uint_to_bytes_be #U128 (secret len))))
inline_for_extraction
let store_len a len b =
match a with
| MD5 ->
Lib.ByteBuffer.uint_to_bytes_le b (secret #U64 len)
| SHA1 | SHA2_224 | SHA2_256 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U64 len)
| SHA2_384 | SHA2_512 ->
Lib.ByteBuffer.uint_to_bytes_be b (secret #U128 len)
#set-options "--z3rlimit 20"
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100 --z3seed 1"
inline_for_extraction noextract
let len_mod_32 (a: md_alg) (len: len_t a):
Tot (n:U32.t { U32.v n = len_v a len % Helpers.block_length a })
=
assert (block_len a <> 0ul);
match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 | Blake2S ->
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
| _ ->
// this case is more difficult because we do: (len % pow2 64) % block_len
// and then we need to show it's equal to len % block_len
[@inline_let]
let len = Cast.uint128_to_uint64 len in
Math.lemma_mod_lt (U64.v len) (U32.v (block_len a));
Math.modulo_lemma (U64.v len % U32.v (block_len a)) (pow2 32);
Cast.uint64_to_uint32 (U64.(len %^ Cast.uint32_to_uint64 (block_len a)))
// JP: this proof works instantly in interactive mode, not in batch mode unless
// there's a high rlimit
#push-options "--z3rlimit 200"
inline_for_extraction
let pad0_len (a: hash_alg{is_md a}) (len: len_t a):
Tot (n:U32.t { U32.v n = pad0_length a (len_v a len) })
=
let open U32 in
(* 1. *)
Math.lemma_mod_mod (U32.v (len_mod_32 a len)) (len_v a len) (block_length a);
assert (U32.v (len_mod_32 a len) % U32.v (block_len a) =
len_v a len % U32.v (block_len a));
assert ((- U32.v (len_mod_32 a len)) % U32.v (block_len a) =
(- len_v a len) % (U32.v (block_len a)));
Math.modulo_add (U32.v (block_len a)) (- U32.v (len_len a) - 1)
(- U32.v (len_mod_32 a len)) (- len_v a len);
assert ((- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) % U32.v (block_len a) =
(- (U32.v (len_len a) + 1 + len_v a len)) % (U32.v (block_len a)));
(* 2. *)
Math.lemma_mod_plus (U32.v (block_len a)) 1 (U32.v (block_len a));
assert ((U32.v (block_len a) + U32.v (block_len a)) % U32.v (block_len a) =
(U32.v (block_len a)) % U32.v (block_len a));
(* Combine 1 and 2 *)
Math.modulo_add (U32.v (block_len a))
(U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(- (U32.v (len_len a) + 1 + len_v a len));
assert (
(U32.v (block_len a) - (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len))) %
U32.v (block_len a) =
(U32.v (block_len a) - (U32.v (len_len a) + 1 + len_v a len)) %
U32.v (block_len a));
Math.modulo_add (U32.v (block_len a))
(- (U32.v (len_len a) + 1 + U32.v (len_mod_32 a len)))
(U32.v (block_len a))
(U32.v (block_len a) + U32.v (block_len a));
[@inline_let]
let r = (block_len a +^ block_len a) -^ (len_len a +^ 1ul +^ len_mod_32 a len) in
r %^ block_len a
#pop-options
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 20"
inline_for_extraction
let pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = 1))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80))))
=
dst.(0ul) <- u8 0x80
inline_for_extraction
let pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
B.live h dst /\ B.length dst = pad0_length a (len_v a len)))
(ensures (fun h0 _ h1 ->
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0))))
=
let h0 = ST.get () in
let len_zero = pad0_len a len in
let inv h1 (i: nat) =
M.(modifies (loc_buffer dst) h0 h1) /\
i <= U32.v len_zero /\
S.equal (S.slice (B.as_seq h1 dst) 0 i) (S.slice (S.create (U32.v len_zero) (u8 0)) 0 i)
in
let f (i:U32.t { U32.(0 <= v i /\ v i < U32.v len_zero)}):
ST.Stack unit
(requires (fun h -> inv h (U32.v i)))
(ensures (fun h0 _ h1 -> inv h0 (U32.v i) /\ inv h1 U32.(v i + 1)))
=
dst.(i) <- u8 0;
(**) let h' = ST.get () in
(**) create_next (B.as_seq h' dst) (u8 0) (U32.v i)
in
C.Loops.for 0ul (pad0_len a len) inv f
inline_for_extraction
let pad_3 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):
ST.Stack unit
(requires (fun h ->
len_v a len `less_than_max_input_length` a /\
B.live h dst /\ B.length dst = len_length a))
(ensures (fun h0 _ h1 ->
Spec.Hash.MD.max_input_size_len a;
B.(modifies (loc_buffer dst) h0 h1) /\
S.equal (B.as_seq h1 dst)
(match a with
| MD5 -> Lib.ByteSequence.uint_to_bytes_le (secret (nat_to_len a FStar.Mul.(len_v a len * 8)))
| _ -> Lib.ByteSequence.uint_to_bytes_be (secret (nat_to_len a FStar.Mul.(len_v a len * 8))))))
=
begin match a with
| MD5 | SHA1 | SHA2_224 | SHA2_256 ->
(**) FStar.UInt.shift_left_value_lemma #64 (U64.v len) 3;
(**) assert (len_v a len <= pow2 61 - 1);
(**) assert_norm FStar.Mul.((pow2 61 - 1) * 8 < pow2 64);
(**) assert_norm (pow2 3 = 8);
(**) assert FStar.Mul.(U64.v len * 8 < pow2 64);
(**) assert FStar.Mul.(FStar.UInt.shift_left #64 (len_v a len) 3 < pow2 64);
(**) assert FStar.Mul.(U64.(v (shift_left len 3ul)) = U64.v len * 8);
store_len a U64.(shift_left len 3ul) dst
| SHA2_384 | SHA2_512 ->
(**) FStar.UInt.shift_left_value_lemma #128 (U128.v len) 3;
(**) assert (len_v a len <= pow2 125 - 1);
(**) assert_norm FStar.Mul.((pow2 125 - 1) * 8 < pow2 128);
(**) assert_norm (pow2 3 = 8);
(**) assert FStar.Mul.(U128.v len * 8 < pow2 128);
(**) assert FStar.Mul.(FStar.UInt.shift_left #128 (len_v a len) 3 < pow2 128);
(**) assert FStar.Mul.(U128.(v (shift_left len 3ul)) = U128.v len * 8);
let len' = U128.(len <<^ 3ul) in
store_len a len' dst
end
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200" | false | false | Hacl.Hash.PadFinish.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 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": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pad: a:md_alg -> pad_st a | [] | Hacl.Hash.PadFinish.pad | {
"file_name": "code/hash/Hacl.Hash.PadFinish.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.Hash.Definitions.md_alg -> Hacl.Hash.Definitions.pad_st a | {
"end_col": 14,
"end_line": 219,
"start_col": 19,
"start_line": 197
} |
Prims.Tot | val aes_reqs
(alg: algorithm)
(key: seq nat32)
(round_keys: seq quad32)
(keys_b: buffer128)
(key_ptr: nat64)
(heap0: vale_heap)
(layout: vale_heap_layout)
: prop0 | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"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 aes_reqs
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:nat64) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
key_ptr == buffer_addr keys_b heap0 /\
validSrcAddrs128 heap0 key_ptr keys_b (nr alg + 1) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys | val aes_reqs
(alg: algorithm)
(key: seq nat32)
(round_keys: seq quad32)
(keys_b: buffer128)
(key_ptr: nat64)
(heap0: vale_heap)
(layout: vale_heap_layout)
: prop0
let aes_reqs
(alg: algorithm)
(key: seq nat32)
(round_keys: seq quad32)
(keys_b: buffer128)
(key_ptr: nat64)
(heap0: vale_heap)
(layout: vale_heap_layout)
: prop0 = | false | null | false | aesni_enabled /\ avx_enabled /\ (alg = AES_128 || alg = AES_256) /\ is_aes_key_LE alg key /\
length (round_keys) == nr (alg) + 1 /\ round_keys == key_to_round_keys_LE alg key /\
key_ptr == buffer_addr keys_b heap0 /\
validSrcAddrs128 heap0 key_ptr keys_b (nr alg + 1) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys | {
"checked_file": "Vale.AES.X64.AESCTR.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.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.GHash.fsti.checked",
"Vale.AES.GHash.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.AESCTR.fsti"
} | [
"total"
] | [
"Vale.AES.AES_common_s.algorithm",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Vale.X64.Memory.buffer128",
"Vale.X64.Memory.nat64",
"Vale.X64.InsBasic.vale_heap",
"Vale.Arch.HeapImpl.vale_heap_layout",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.CPU_Features_s.aesni_enabled",
"Vale.X64.CPU_Features_s.avx_enabled",
"Prims.op_BarBar",
"Prims.op_Equality",
"Vale.AES.AES_common_s.AES_128",
"Vale.AES.AES_common_s.AES_256",
"Vale.AES.AES_s.is_aes_key_LE",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.op_Addition",
"Vale.AES.AES_common_s.nr",
"Vale.Def.Types_s.quad32",
"Vale.AES.AES_s.key_to_round_keys_LE",
"Vale.X64.Memory.buffer_addr",
"Vale.X64.Memory.vuint128",
"Vale.X64.Decls.validSrcAddrs128",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Decls.buffer128_as_seq",
"Vale.Def.Prop_s.prop0"
] | [] | module Vale.AES.X64.AESCTR
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.AES.X64.GHash
open Vale.AES.GHash
open Vale.X64.CPU_Features_s
let aes_reqs
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:nat64) (heap0:vale_heap) (layout:vale_heap_layout) : prop0 | false | true | Vale.AES.X64.AESCTR.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aes_reqs
(alg: algorithm)
(key: seq nat32)
(round_keys: seq quad32)
(keys_b: buffer128)
(key_ptr: nat64)
(heap0: vale_heap)
(layout: vale_heap_layout)
: prop0 | [] | Vale.AES.X64.AESCTR.aes_reqs | {
"file_name": "obj/Vale.AES.X64.AESCTR.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
alg: Vale.AES.AES_common_s.algorithm ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
key_ptr: Vale.X64.Memory.nat64 ->
heap0: Vale.X64.InsBasic.vale_heap ->
layout: Vale.Arch.HeapImpl.vale_heap_layout
-> Vale.Def.Prop_s.prop0 | {
"end_col": 45,
"end_line": 40,
"start_col": 2,
"start_line": 33
} |
Prims.Tot | val va_quick_Aes_ctr_encrypt
(alg: algorithm)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(in1 in2 in3 in4: quad32)
: (va_quickCode unit (va_code_Aes_ctr_encrypt alg)) | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"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.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"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_Aes_ctr_encrypt (alg:algorithm) (key:(seq nat32)) (round_keys:(seq quad32))
(keys_b:buffer128) (in1:quad32) (in2:quad32) (in3:quad32) (in4:quad32) : (va_quickCode unit
(va_code_Aes_ctr_encrypt alg)) =
(va_QProc (va_code_Aes_ctr_encrypt alg) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm
12; va_Mod_xmm 2; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 6])
(va_wp_Aes_ctr_encrypt alg key round_keys keys_b in1 in2 in3 in4) (va_wpProof_Aes_ctr_encrypt
alg key round_keys keys_b in1 in2 in3 in4)) | val va_quick_Aes_ctr_encrypt
(alg: algorithm)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(in1 in2 in3 in4: quad32)
: (va_quickCode unit (va_code_Aes_ctr_encrypt alg))
let va_quick_Aes_ctr_encrypt
(alg: algorithm)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(in1 in2 in3 in4: quad32)
: (va_quickCode unit (va_code_Aes_ctr_encrypt alg)) = | false | null | false | (va_QProc (va_code_Aes_ctr_encrypt alg)
([
va_Mod_flags;
va_Mod_xmm 14;
va_Mod_xmm 13;
va_Mod_xmm 12;
va_Mod_xmm 2;
va_Mod_xmm 5;
va_Mod_xmm 4;
va_Mod_xmm 3;
va_Mod_xmm 6
])
(va_wp_Aes_ctr_encrypt alg key round_keys keys_b in1 in2 in3 in4)
(va_wpProof_Aes_ctr_encrypt alg key round_keys keys_b in1 in2 in3 in4)) | {
"checked_file": "Vale.AES.X64.AESCTR.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.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.GHash.fsti.checked",
"Vale.AES.GHash.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.AESCTR.fsti"
} | [
"total"
] | [
"Vale.AES.AES_common_s.algorithm",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Vale.X64.Memory.buffer128",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.AESCTR.va_code_Aes_ctr_encrypt",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_xmm",
"Prims.Nil",
"Vale.AES.X64.AESCTR.va_wp_Aes_ctr_encrypt",
"Vale.AES.X64.AESCTR.va_wpProof_Aes_ctr_encrypt",
"Vale.X64.QuickCode.va_quickCode"
] | [] | module Vale.AES.X64.AESCTR
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.AES.X64.GHash
open Vale.AES.GHash
open Vale.X64.CPU_Features_s
let aes_reqs
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:nat64) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
key_ptr == buffer_addr keys_b heap0 /\
validSrcAddrs128 heap0 key_ptr keys_b (nr alg + 1) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
//-- Aes_ctr_encrypt
val va_code_Aes_ctr_encrypt : alg:algorithm -> Tot va_code
val va_codegen_success_Aes_ctr_encrypt : alg:algorithm -> Tot va_pbool
val va_lemma_Aes_ctr_encrypt : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> key:(seq nat32)
-> round_keys:(seq quad32) -> keys_b:buffer128 -> in1:quad32 -> in2:quad32 -> in3:quad32 ->
in4:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Aes_ctr_encrypt alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet
0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 == Vale.Def.Types_s.quad32_xor in1
(va_get_xmm 3 va_s0) /\ va_get_xmm 12 va_s0 == Vale.Def.Types_s.quad32_xor in2 (va_get_xmm 3
va_s0) /\ va_get_xmm 13 va_s0 == Vale.Def.Types_s.quad32_xor in3 (va_get_xmm 3 va_s0) /\
va_get_xmm 14 va_s0 == Vale.Def.Types_s.quad32_xor in4 (va_get_xmm 3 va_s0) /\ va_get_xmm 3
va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 4 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 1 /\ va_get_xmm 5 va_s0 == FStar.Seq.Base.index #quad32
round_keys 2 /\ va_get_xmm 6 va_s0 == FStar.Seq.Base.index #quad32 round_keys 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_sM) (va_get_mem_heaplet 0 va_sM)
(va_get_mem_layout va_sM) /\ va_get_xmm 2 va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in1 /\
va_get_xmm 12 va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in2 /\ va_get_xmm 13 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in3 /\ va_get_xmm 14 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in4) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 6 va_sM
(va_update_ok va_sM va_s0))))))))))))
[@ va_qattr]
let va_wp_Aes_ctr_encrypt (alg:algorithm) (key:(seq nat32)) (round_keys:(seq quad32))
(keys_b:buffer128) (in1:quad32) (in2:quad32) (in3:quad32) (in4:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 ==
Vale.Def.Types_s.quad32_xor in1 (va_get_xmm 3 va_s0) /\ va_get_xmm 12 va_s0 ==
Vale.Def.Types_s.quad32_xor in2 (va_get_xmm 3 va_s0) /\ va_get_xmm 13 va_s0 ==
Vale.Def.Types_s.quad32_xor in3 (va_get_xmm 3 va_s0) /\ va_get_xmm 14 va_s0 ==
Vale.Def.Types_s.quad32_xor in4 (va_get_xmm 3 va_s0) /\ va_get_xmm 3 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 4 va_s0 == FStar.Seq.Base.index #quad32
round_keys 1 /\ va_get_xmm 5 va_s0 == FStar.Seq.Base.index #quad32 round_keys 2 /\ va_get_xmm 6
va_s0 == FStar.Seq.Base.index #quad32 round_keys 3) /\ (forall (va_x_xmm6:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm2:quad32) (va_x_xmm12:quad32)
(va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags
va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 6 va_x_xmm6 va_s0)))))))) in va_get_ok va_sM /\ (aes_reqs alg key round_keys keys_b
(va_get_reg64 rR8 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_xmm 2
va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in1 /\ va_get_xmm 12 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in2 /\ va_get_xmm 13 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in3 /\ va_get_xmm 14 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in4) ==> va_k va_sM (())))
val va_wpProof_Aes_ctr_encrypt : alg:algorithm -> key:(seq nat32) -> round_keys:(seq quad32) ->
keys_b:buffer128 -> in1:quad32 -> in2:quad32 -> in3:quad32 -> in4: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_Aes_ctr_encrypt alg key round_keys keys_b in1 in2 in3 in4
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Aes_ctr_encrypt alg) ([va_Mod_flags;
va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 2; va_Mod_xmm 5; va_Mod_xmm 4;
va_Mod_xmm 3; va_Mod_xmm 6]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Aes_ctr_encrypt (alg:algorithm) (key:(seq nat32)) (round_keys:(seq quad32))
(keys_b:buffer128) (in1:quad32) (in2:quad32) (in3:quad32) (in4:quad32) : (va_quickCode unit | false | false | Vale.AES.X64.AESCTR.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_Aes_ctr_encrypt
(alg: algorithm)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(in1 in2 in3 in4: quad32)
: (va_quickCode unit (va_code_Aes_ctr_encrypt alg)) | [] | Vale.AES.X64.AESCTR.va_quick_Aes_ctr_encrypt | {
"file_name": "obj/Vale.AES.X64.AESCTR.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
alg: Vale.AES.AES_common_s.algorithm ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
in1: Vale.X64.Decls.quad32 ->
in2: Vale.X64.Decls.quad32 ->
in3: Vale.X64.Decls.quad32 ->
in4: Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.AESCTR.va_code_Aes_ctr_encrypt alg) | {
"end_col": 47,
"end_line": 109,
"start_col": 2,
"start_line": 106
} |
Prims.Tot | val va_wp_Aes_ctr_encrypt
(alg: algorithm)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(in1 in2 in3 in4: 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.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"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.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"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_Aes_ctr_encrypt (alg:algorithm) (key:(seq nat32)) (round_keys:(seq quad32))
(keys_b:buffer128) (in1:quad32) (in2:quad32) (in3:quad32) (in4:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 ==
Vale.Def.Types_s.quad32_xor in1 (va_get_xmm 3 va_s0) /\ va_get_xmm 12 va_s0 ==
Vale.Def.Types_s.quad32_xor in2 (va_get_xmm 3 va_s0) /\ va_get_xmm 13 va_s0 ==
Vale.Def.Types_s.quad32_xor in3 (va_get_xmm 3 va_s0) /\ va_get_xmm 14 va_s0 ==
Vale.Def.Types_s.quad32_xor in4 (va_get_xmm 3 va_s0) /\ va_get_xmm 3 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 4 va_s0 == FStar.Seq.Base.index #quad32
round_keys 1 /\ va_get_xmm 5 va_s0 == FStar.Seq.Base.index #quad32 round_keys 2 /\ va_get_xmm 6
va_s0 == FStar.Seq.Base.index #quad32 round_keys 3) /\ (forall (va_x_xmm6:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm2:quad32) (va_x_xmm12:quad32)
(va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags
va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 6 va_x_xmm6 va_s0)))))))) in va_get_ok va_sM /\ (aes_reqs alg key round_keys keys_b
(va_get_reg64 rR8 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_xmm 2
va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in1 /\ va_get_xmm 12 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in2 /\ va_get_xmm 13 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in3 /\ va_get_xmm 14 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in4) ==> va_k va_sM (()))) | val va_wp_Aes_ctr_encrypt
(alg: algorithm)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(in1 in2 in3 in4: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_Aes_ctr_encrypt
(alg: algorithm)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(in1 in2 in3 in4: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
(sse_enabled /\
aes_reqs alg
key
round_keys
keys_b
(va_get_reg64 rR8 va_s0)
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) /\
va_get_xmm 2 va_s0 == Vale.Def.Types_s.quad32_xor in1 (va_get_xmm 3 va_s0) /\
va_get_xmm 12 va_s0 == Vale.Def.Types_s.quad32_xor in2 (va_get_xmm 3 va_s0) /\
va_get_xmm 13 va_s0 == Vale.Def.Types_s.quad32_xor in3 (va_get_xmm 3 va_s0) /\
va_get_xmm 14 va_s0 == Vale.Def.Types_s.quad32_xor in4 (va_get_xmm 3 va_s0) /\
va_get_xmm 3 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\
va_get_xmm 4 va_s0 == FStar.Seq.Base.index #quad32 round_keys 1 /\
va_get_xmm 5 va_s0 == FStar.Seq.Base.index #quad32 round_keys 2 /\
va_get_xmm 6 va_s0 == FStar.Seq.Base.index #quad32 round_keys 3) /\
(forall (va_x_xmm6: quad32)
(va_x_xmm3: quad32)
(va_x_xmm4: quad32)
(va_x_xmm5: quad32)
(va_x_xmm2: quad32)
(va_x_xmm12: quad32)
(va_x_xmm13: quad32)
(va_x_xmm14: quad32)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_xmm 14
va_x_xmm14
(va_upd_xmm 13
va_x_xmm13
(va_upd_xmm 12
va_x_xmm12
(va_upd_xmm 2
va_x_xmm2
(va_upd_xmm 5
va_x_xmm5
(va_upd_xmm 4
va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 6 va_x_xmm6 va_s0))))))))
in
va_get_ok va_sM /\
(aes_reqs alg
key
round_keys
keys_b
(va_get_reg64 rR8 va_sM)
(va_get_mem_heaplet 0 va_sM)
(va_get_mem_layout va_sM) /\
va_get_xmm 2 va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in1 /\
va_get_xmm 12 va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in2 /\
va_get_xmm 13 va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in3 /\
va_get_xmm 14 va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in4) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.AES.X64.AESCTR.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.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.GHash.fsti.checked",
"Vale.AES.GHash.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.AESCTR.fsti"
} | [
"total"
] | [
"Vale.AES.AES_common_s.algorithm",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.sse_enabled",
"Vale.AES.X64.AESCTR.aes_reqs",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rR8",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_mem_layout",
"Prims.eq2",
"Vale.Def.Types_s.quad32",
"Vale.X64.Decls.va_get_xmm",
"Vale.Def.Types_s.quad32_xor",
"FStar.Seq.Base.index",
"Prims.l_Forall",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Vale.AES.AES_s.aes_encrypt_LE",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_xmm"
] | [] | module Vale.AES.X64.AESCTR
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.AES.X64.GHash
open Vale.AES.GHash
open Vale.X64.CPU_Features_s
let aes_reqs
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:nat64) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
key_ptr == buffer_addr keys_b heap0 /\
validSrcAddrs128 heap0 key_ptr keys_b (nr alg + 1) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
//-- Aes_ctr_encrypt
val va_code_Aes_ctr_encrypt : alg:algorithm -> Tot va_code
val va_codegen_success_Aes_ctr_encrypt : alg:algorithm -> Tot va_pbool
val va_lemma_Aes_ctr_encrypt : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> key:(seq nat32)
-> round_keys:(seq quad32) -> keys_b:buffer128 -> in1:quad32 -> in2:quad32 -> in3:quad32 ->
in4:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Aes_ctr_encrypt alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet
0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 == Vale.Def.Types_s.quad32_xor in1
(va_get_xmm 3 va_s0) /\ va_get_xmm 12 va_s0 == Vale.Def.Types_s.quad32_xor in2 (va_get_xmm 3
va_s0) /\ va_get_xmm 13 va_s0 == Vale.Def.Types_s.quad32_xor in3 (va_get_xmm 3 va_s0) /\
va_get_xmm 14 va_s0 == Vale.Def.Types_s.quad32_xor in4 (va_get_xmm 3 va_s0) /\ va_get_xmm 3
va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 4 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 1 /\ va_get_xmm 5 va_s0 == FStar.Seq.Base.index #quad32
round_keys 2 /\ va_get_xmm 6 va_s0 == FStar.Seq.Base.index #quad32 round_keys 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_sM) (va_get_mem_heaplet 0 va_sM)
(va_get_mem_layout va_sM) /\ va_get_xmm 2 va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in1 /\
va_get_xmm 12 va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in2 /\ va_get_xmm 13 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in3 /\ va_get_xmm 14 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in4) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 6 va_sM
(va_update_ok va_sM va_s0))))))))))))
[@ va_qattr]
let va_wp_Aes_ctr_encrypt (alg:algorithm) (key:(seq nat32)) (round_keys:(seq quad32))
(keys_b:buffer128) (in1:quad32) (in2:quad32) (in3:quad32) (in4:quad32) (va_s0:va_state) | false | true | Vale.AES.X64.AESCTR.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_Aes_ctr_encrypt
(alg: algorithm)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(in1 in2 in3 in4: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.X64.AESCTR.va_wp_Aes_ctr_encrypt | {
"file_name": "obj/Vale.AES.X64.AESCTR.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
alg: Vale.AES.AES_common_s.algorithm ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
in1: Vale.X64.Decls.quad32 ->
in2: Vale.X64.Decls.quad32 ->
in3: Vale.X64.Decls.quad32 ->
in4: 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": 91,
"start_col": 2,
"start_line": 73
} |
Prims.Tot | val va_quick_Aes_counter_loop
(alg: algorithm)
(plain_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
: (va_quickCode unit (va_code_Aes_counter_loop alg)) | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"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.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"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_Aes_counter_loop (alg:algorithm) (plain_b:buffer128) (out_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit
(va_code_Aes_counter_loop alg)) =
(va_QProc (va_code_Aes_counter_loop alg) ([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_reg64 rRdi; va_Mod_reg64 rR10; va_Mod_reg64 rRdx; va_Mod_reg64 rR9;
va_Mod_reg64 rRax; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 2; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 6; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm
15; va_Mod_xmm 0; va_Mod_mem]) (va_wp_Aes_counter_loop alg plain_b out_b key round_keys keys_b)
(va_wpProof_Aes_counter_loop alg plain_b out_b key round_keys keys_b)) | val va_quick_Aes_counter_loop
(alg: algorithm)
(plain_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
: (va_quickCode unit (va_code_Aes_counter_loop alg))
let va_quick_Aes_counter_loop
(alg: algorithm)
(plain_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
: (va_quickCode unit (va_code_Aes_counter_loop alg)) = | false | null | false | (va_QProc (va_code_Aes_counter_loop alg)
([
va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_reg64 rRdi;
va_Mod_reg64 rR10; va_Mod_reg64 rRdx; va_Mod_reg64 rR9; va_Mod_reg64 rRax; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 2; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 6; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 15; va_Mod_xmm 0;
va_Mod_mem
])
(va_wp_Aes_counter_loop alg plain_b out_b key round_keys keys_b)
(va_wpProof_Aes_counter_loop alg plain_b out_b key round_keys keys_b)) | {
"checked_file": "Vale.AES.X64.AESCTR.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.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.GHash.fsti.checked",
"Vale.AES.GHash.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.AESCTR.fsti"
} | [
"total"
] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.AESCTR.va_code_Aes_counter_loop",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Machine_s.rR10",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.AES.X64.AESCTR.va_wp_Aes_counter_loop",
"Vale.AES.X64.AESCTR.va_wpProof_Aes_counter_loop",
"Vale.X64.QuickCode.va_quickCode"
] | [] | module Vale.AES.X64.AESCTR
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.AES.X64.GHash
open Vale.AES.GHash
open Vale.X64.CPU_Features_s
let aes_reqs
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:nat64) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
key_ptr == buffer_addr keys_b heap0 /\
validSrcAddrs128 heap0 key_ptr keys_b (nr alg + 1) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
//-- Aes_ctr_encrypt
val va_code_Aes_ctr_encrypt : alg:algorithm -> Tot va_code
val va_codegen_success_Aes_ctr_encrypt : alg:algorithm -> Tot va_pbool
val va_lemma_Aes_ctr_encrypt : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> key:(seq nat32)
-> round_keys:(seq quad32) -> keys_b:buffer128 -> in1:quad32 -> in2:quad32 -> in3:quad32 ->
in4:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Aes_ctr_encrypt alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet
0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 == Vale.Def.Types_s.quad32_xor in1
(va_get_xmm 3 va_s0) /\ va_get_xmm 12 va_s0 == Vale.Def.Types_s.quad32_xor in2 (va_get_xmm 3
va_s0) /\ va_get_xmm 13 va_s0 == Vale.Def.Types_s.quad32_xor in3 (va_get_xmm 3 va_s0) /\
va_get_xmm 14 va_s0 == Vale.Def.Types_s.quad32_xor in4 (va_get_xmm 3 va_s0) /\ va_get_xmm 3
va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 4 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 1 /\ va_get_xmm 5 va_s0 == FStar.Seq.Base.index #quad32
round_keys 2 /\ va_get_xmm 6 va_s0 == FStar.Seq.Base.index #quad32 round_keys 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_sM) (va_get_mem_heaplet 0 va_sM)
(va_get_mem_layout va_sM) /\ va_get_xmm 2 va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in1 /\
va_get_xmm 12 va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in2 /\ va_get_xmm 13 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in3 /\ va_get_xmm 14 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in4) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 6 va_sM
(va_update_ok va_sM va_s0))))))))))))
[@ va_qattr]
let va_wp_Aes_ctr_encrypt (alg:algorithm) (key:(seq nat32)) (round_keys:(seq quad32))
(keys_b:buffer128) (in1:quad32) (in2:quad32) (in3:quad32) (in4:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 ==
Vale.Def.Types_s.quad32_xor in1 (va_get_xmm 3 va_s0) /\ va_get_xmm 12 va_s0 ==
Vale.Def.Types_s.quad32_xor in2 (va_get_xmm 3 va_s0) /\ va_get_xmm 13 va_s0 ==
Vale.Def.Types_s.quad32_xor in3 (va_get_xmm 3 va_s0) /\ va_get_xmm 14 va_s0 ==
Vale.Def.Types_s.quad32_xor in4 (va_get_xmm 3 va_s0) /\ va_get_xmm 3 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 4 va_s0 == FStar.Seq.Base.index #quad32
round_keys 1 /\ va_get_xmm 5 va_s0 == FStar.Seq.Base.index #quad32 round_keys 2 /\ va_get_xmm 6
va_s0 == FStar.Seq.Base.index #quad32 round_keys 3) /\ (forall (va_x_xmm6:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm2:quad32) (va_x_xmm12:quad32)
(va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags
va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 6 va_x_xmm6 va_s0)))))))) in va_get_ok va_sM /\ (aes_reqs alg key round_keys keys_b
(va_get_reg64 rR8 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_xmm 2
va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in1 /\ va_get_xmm 12 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in2 /\ va_get_xmm 13 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in3 /\ va_get_xmm 14 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in4) ==> va_k va_sM (())))
val va_wpProof_Aes_ctr_encrypt : alg:algorithm -> key:(seq nat32) -> round_keys:(seq quad32) ->
keys_b:buffer128 -> in1:quad32 -> in2:quad32 -> in3:quad32 -> in4: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_Aes_ctr_encrypt alg key round_keys keys_b in1 in2 in3 in4
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Aes_ctr_encrypt alg) ([va_Mod_flags;
va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 2; va_Mod_xmm 5; va_Mod_xmm 4;
va_Mod_xmm 3; va_Mod_xmm 6]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Aes_ctr_encrypt (alg:algorithm) (key:(seq nat32)) (round_keys:(seq quad32))
(keys_b:buffer128) (in1:quad32) (in2:quad32) (in3:quad32) (in4:quad32) : (va_quickCode unit
(va_code_Aes_ctr_encrypt alg)) =
(va_QProc (va_code_Aes_ctr_encrypt alg) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm
12; va_Mod_xmm 2; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 6])
(va_wp_Aes_ctr_encrypt alg key round_keys keys_b in1 in2 in3 in4) (va_wpProof_Aes_ctr_encrypt
alg key round_keys keys_b in1 in2 in3 in4))
//--
//-- Aes_counter_loop
val va_code_Aes_counter_loop : alg:algorithm -> Tot va_code
val va_codegen_success_Aes_counter_loop : alg:algorithm -> Tot va_pbool
val va_lemma_Aes_counter_loop : va_b0:va_code -> va_s0:va_state -> alg:algorithm ->
plain_b:buffer128 -> out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) ->
keys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Aes_counter_loop alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ (0 < va_get_reg64 rRdx va_s0 /\ 4 `op_Multiply` va_get_reg64 rRdx va_s0 <
pow2_32 - 4) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rR9
va_s0) plain_b (va_get_reg64 rRdx va_s0 `op_Multiply` 4) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rR10 va_s0) out_b
(va_get_reg64 rRdx va_s0 `op_Multiply` 4) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rR9
va_s0 + va_get_reg64 rRdx va_s0 `op_Multiply` 64 < pow2_64 /\ va_get_reg64 rR10 va_s0 +
va_get_reg64 rRdx va_s0 `op_Multiply` 64 < pow2_64 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 plain_b <= Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
out_b /\ Vale.X64.Decls.buffers_disjoint128 plain_b out_b /\ aes_reqs alg key round_keys keys_b
(va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ va_get_xmm 8 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 /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rR10
va_s0) out_b (va_get_reg64 rRdx va_s0 `op_Multiply` 4) (va_get_mem_layout va_sM) Secret /\
va_get_reg64 rR9 va_sM == va_get_reg64 rR9 va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0 /\
va_get_reg64 rR10 va_sM == va_get_reg64 rR10 va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0
/\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123
67438087 66051 /\ Vale.AES.GCTR.gctr_partial_def alg (4 `op_Multiply` va_get_reg64 rRdx va_s0)
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_s0) plain_b)
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_sM) out_b) key (va_get_xmm 7 va_s0)
/\ va_get_xmm 7 va_sM == Vale.AES.GCTR_s.inc32 (va_get_xmm 7 va_s0) (4 `op_Multiply`
va_get_reg64 rRdx va_s0) /\ l_and (FStar.Seq.Base.length #Vale.X64.Decls.quad32
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 1 va_sM) out_b) 0 (4 `op_Multiply` va_get_reg64 rRdx va_s0)) > 0)
(va_get_xmm 1 va_sM == Vale.AES.GHash.ghash_incremental (Vale.Def.Types_s.reverse_bytes_quad32
(va_get_xmm 11 va_sM)) (va_get_xmm 1 va_s0) (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_sM) out_b) 0 (4 `op_Multiply`
va_get_reg64 rRdx va_s0)))) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM
(va_update_flags va_sM (va_update_xmm 1 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdi
va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rRax va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12
va_sM (va_update_xmm 2 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3
va_sM (va_update_xmm 6 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7
va_sM (va_update_xmm 15 va_sM (va_update_xmm 0 va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Aes_counter_loop (alg:algorithm) (plain_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ (0 < va_get_reg64 rRdx va_s0 /\ 4 `op_Multiply` va_get_reg64
rRdx va_s0 < pow2_32 - 4) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rR9 va_s0) plain_b (va_get_reg64 rRdx va_s0 `op_Multiply` 4) (va_get_mem_layout
va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64
rR10 va_s0) out_b (va_get_reg64 rRdx va_s0 `op_Multiply` 4) (va_get_mem_layout va_s0) Secret /\
va_get_reg64 rR9 va_s0 + va_get_reg64 rRdx va_s0 `op_Multiply` 64 < pow2_64 /\ va_get_reg64
rR10 va_s0 + va_get_reg64 rRdx va_s0 `op_Multiply` 64 < pow2_64 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 plain_b <= Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
out_b /\ Vale.X64.Decls.buffers_disjoint128 plain_b out_b /\ aes_reqs alg key round_keys keys_b
(va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ va_get_xmm 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
202182159 134810123 67438087 66051) /\ (forall (va_x_mem:vale_heap) (va_x_xmm0:quad32)
(va_x_xmm15:quad32) (va_x_xmm7:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm6:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm2:quad32)
(va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_rax:nat64) (va_x_r9:nat64)
(va_x_rdx:nat64) (va_x_r10:nat64) (va_x_rdi:nat64) (va_x_r12:nat64) (va_x_xmm1:quad32)
(va_x_efl:Vale.X64.Flags.t) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1
va_x_heap1 (va_upd_flags va_x_efl (va_upd_xmm 1 va_x_xmm1 (va_upd_reg64 rR12 va_x_r12
(va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rRdx va_x_rdx
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRax va_x_rax (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13
va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 10
va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 15 va_x_xmm15
(va_upd_xmm 0 va_x_xmm0 (va_upd_mem va_x_mem va_s0)))))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rR10
va_s0) out_b (va_get_reg64 rRdx va_s0 `op_Multiply` 4) (va_get_mem_layout va_sM) Secret /\
va_get_reg64 rR9 va_sM == va_get_reg64 rR9 va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0 /\
va_get_reg64 rR10 va_sM == va_get_reg64 rR10 va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0
/\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123
67438087 66051 /\ Vale.AES.GCTR.gctr_partial_def alg (4 `op_Multiply` va_get_reg64 rRdx va_s0)
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_s0) plain_b)
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_sM) out_b) key (va_get_xmm 7 va_s0)
/\ va_get_xmm 7 va_sM == Vale.AES.GCTR_s.inc32 (va_get_xmm 7 va_s0) (4 `op_Multiply`
va_get_reg64 rRdx va_s0) /\ l_and (FStar.Seq.Base.length #Vale.X64.Decls.quad32
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 1 va_sM) out_b) 0 (4 `op_Multiply` va_get_reg64 rRdx va_s0)) > 0)
(va_get_xmm 1 va_sM == Vale.AES.GHash.ghash_incremental (Vale.Def.Types_s.reverse_bytes_quad32
(va_get_xmm 11 va_sM)) (va_get_xmm 1 va_s0) (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_sM) out_b) 0 (4 `op_Multiply`
va_get_reg64 rRdx va_s0)))) ==> va_k va_sM (())))
val va_wpProof_Aes_counter_loop : alg:algorithm -> plain_b:buffer128 -> out_b:buffer128 -> key:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit
-> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Aes_counter_loop alg plain_b out_b key round_keys keys_b
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Aes_counter_loop alg)
([va_Mod_mem_heaplet 1; va_Mod_flags; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_reg64 rRdi;
va_Mod_reg64 rR10; va_Mod_reg64 rRdx; va_Mod_reg64 rR9; va_Mod_reg64 rRax; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 2; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 6; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 15; va_Mod_xmm 0;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Aes_counter_loop (alg:algorithm) (plain_b:buffer128) (out_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit | false | false | Vale.AES.X64.AESCTR.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_Aes_counter_loop
(alg: algorithm)
(plain_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
: (va_quickCode unit (va_code_Aes_counter_loop alg)) | [] | Vale.AES.X64.AESCTR.va_quick_Aes_counter_loop | {
"file_name": "obj/Vale.AES.X64.AESCTR.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
alg: Vale.AES.AES_common_s.algorithm ->
plain_b: Vale.X64.Memory.buffer128 ->
out_b: Vale.X64.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.AESCTR.va_code_Aes_counter_loop alg) | {
"end_col": 74,
"end_line": 226,
"start_col": 2,
"start_line": 221
} |
Prims.Tot | val va_wp_Aes_counter_loop
(alg: algorithm)
(plain_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(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.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"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.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"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_Aes_counter_loop (alg:algorithm) (plain_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ (0 < va_get_reg64 rRdx va_s0 /\ 4 `op_Multiply` va_get_reg64
rRdx va_s0 < pow2_32 - 4) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rR9 va_s0) plain_b (va_get_reg64 rRdx va_s0 `op_Multiply` 4) (va_get_mem_layout
va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64
rR10 va_s0) out_b (va_get_reg64 rRdx va_s0 `op_Multiply` 4) (va_get_mem_layout va_s0) Secret /\
va_get_reg64 rR9 va_s0 + va_get_reg64 rRdx va_s0 `op_Multiply` 64 < pow2_64 /\ va_get_reg64
rR10 va_s0 + va_get_reg64 rRdx va_s0 `op_Multiply` 64 < pow2_64 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 plain_b <= Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
out_b /\ Vale.X64.Decls.buffers_disjoint128 plain_b out_b /\ aes_reqs alg key round_keys keys_b
(va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ va_get_xmm 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
202182159 134810123 67438087 66051) /\ (forall (va_x_mem:vale_heap) (va_x_xmm0:quad32)
(va_x_xmm15:quad32) (va_x_xmm7:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm6:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm2:quad32)
(va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_rax:nat64) (va_x_r9:nat64)
(va_x_rdx:nat64) (va_x_r10:nat64) (va_x_rdi:nat64) (va_x_r12:nat64) (va_x_xmm1:quad32)
(va_x_efl:Vale.X64.Flags.t) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1
va_x_heap1 (va_upd_flags va_x_efl (va_upd_xmm 1 va_x_xmm1 (va_upd_reg64 rR12 va_x_r12
(va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rRdx va_x_rdx
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRax va_x_rax (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13
va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 10
va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 15 va_x_xmm15
(va_upd_xmm 0 va_x_xmm0 (va_upd_mem va_x_mem va_s0)))))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rR10
va_s0) out_b (va_get_reg64 rRdx va_s0 `op_Multiply` 4) (va_get_mem_layout va_sM) Secret /\
va_get_reg64 rR9 va_sM == va_get_reg64 rR9 va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0 /\
va_get_reg64 rR10 va_sM == va_get_reg64 rR10 va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0
/\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123
67438087 66051 /\ Vale.AES.GCTR.gctr_partial_def alg (4 `op_Multiply` va_get_reg64 rRdx va_s0)
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_s0) plain_b)
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_sM) out_b) key (va_get_xmm 7 va_s0)
/\ va_get_xmm 7 va_sM == Vale.AES.GCTR_s.inc32 (va_get_xmm 7 va_s0) (4 `op_Multiply`
va_get_reg64 rRdx va_s0) /\ l_and (FStar.Seq.Base.length #Vale.X64.Decls.quad32
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 1 va_sM) out_b) 0 (4 `op_Multiply` va_get_reg64 rRdx va_s0)) > 0)
(va_get_xmm 1 va_sM == Vale.AES.GHash.ghash_incremental (Vale.Def.Types_s.reverse_bytes_quad32
(va_get_xmm 11 va_sM)) (va_get_xmm 1 va_s0) (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_sM) out_b) 0 (4 `op_Multiply`
va_get_reg64 rRdx va_s0)))) ==> va_k va_sM (()))) | val va_wp_Aes_counter_loop
(alg: algorithm)
(plain_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_Aes_counter_loop
(alg: algorithm)
(plain_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
(sse_enabled /\
(0 < va_get_reg64 rRdx va_s0 /\ 4 `op_Multiply` (va_get_reg64 rRdx va_s0) < pow2_32 - 4) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rR9 va_s0)
plain_b
((va_get_reg64 rRdx va_s0) `op_Multiply` 4)
(va_get_mem_layout va_s0)
Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rR10 va_s0)
out_b
((va_get_reg64 rRdx va_s0) `op_Multiply` 4)
(va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rR9 va_s0 + (va_get_reg64 rRdx va_s0) `op_Multiply` 64 < pow2_64 /\
va_get_reg64 rR10 va_s0 + (va_get_reg64 rRdx va_s0) `op_Multiply` 64 < pow2_64 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 plain_b <=
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b /\
Vale.X64.Decls.buffers_disjoint128 plain_b out_b /\
aes_reqs alg
key
round_keys
keys_b
(va_get_reg64 rR8 va_s0)
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
va_get_xmm 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051) /\
(forall (va_x_mem: vale_heap) (va_x_xmm0: quad32) (va_x_xmm15: quad32) (va_x_xmm7: quad32)
(va_x_xmm9: quad32) (va_x_xmm10: quad32) (va_x_xmm6: quad32) (va_x_xmm3: quad32)
(va_x_xmm4: quad32) (va_x_xmm5: quad32) (va_x_xmm2: quad32) (va_x_xmm12: quad32)
(va_x_xmm13: quad32) (va_x_xmm14: quad32) (va_x_rax: nat64) (va_x_r9: nat64) (va_x_rdx: nat64)
(va_x_r10: nat64) (va_x_rdi: nat64) (va_x_r12: nat64) (va_x_xmm1: quad32)
(va_x_efl: Vale.X64.Flags.t) (va_x_heap1: vale_heap).
let va_sM =
va_upd_mem_heaplet 1
va_x_heap1
(va_upd_flags va_x_efl
(va_upd_xmm 1
va_x_xmm1
(va_upd_reg64 rR12
va_x_r12
(va_upd_reg64 rRdi
va_x_rdi
(va_upd_reg64 rR10
va_x_r10
(va_upd_reg64 rRdx
va_x_rdx
(va_upd_reg64 rR9
va_x_r9
(va_upd_reg64 rRax
va_x_rax
(va_upd_xmm 14
va_x_xmm14
(va_upd_xmm 13
va_x_xmm13
(va_upd_xmm 12
va_x_xmm12
(va_upd_xmm 2
va_x_xmm2
(va_upd_xmm 5
va_x_xmm5
(va_upd_xmm 4
va_x_xmm4
(va_upd_xmm 3
va_x_xmm3
(va_upd_xmm 6
va_x_xmm6
(va_upd_xmm 10
va_x_xmm10
(va_upd_xmm 9
va_x_xmm9
(va_upd_xmm 7
va_x_xmm7
(va_upd_xmm 15
va_x_xmm15
(va_upd_xmm
0
va_x_xmm0
(va_upd_mem
va_x_mem
va_s0
))))
))))))))))))))))))
in
va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b
(va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_sM)
(va_get_reg64 rR10 va_s0)
out_b
((va_get_reg64 rRdx va_s0) `op_Multiply` 4)
(va_get_mem_layout va_sM)
Secret /\
va_get_reg64 rR9 va_sM ==
va_get_reg64 rR9 va_s0 + 64 `op_Multiply` (va_get_reg64 rRdx va_s0) /\
va_get_reg64 rR10 va_sM ==
va_get_reg64 rR10 va_s0 + 64 `op_Multiply` (va_get_reg64 rRdx va_s0) /\
va_get_xmm 8 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
Vale.AES.GCTR.gctr_partial_def alg
(4 `op_Multiply` (va_get_reg64 rRdx va_s0))
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_s0) plain_b)
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_sM) out_b)
key
(va_get_xmm 7 va_s0) /\
va_get_xmm 7 va_sM ==
Vale.AES.GCTR_s.inc32 (va_get_xmm 7 va_s0) (4 `op_Multiply` (va_get_reg64 rRdx va_s0)) /\
l_and (FStar.Seq.Base.length #Vale.X64.Decls.quad32
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_sM) out_b)
0
(4 `op_Multiply` (va_get_reg64 rRdx va_s0))) >
0)
(va_get_xmm 1 va_sM ==
Vale.AES.GHash.ghash_incremental (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11
va_sM))
(va_get_xmm 1 va_s0)
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_sM) out_b)
0
(4 `op_Multiply` (va_get_reg64 rRdx va_s0))))) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.AES.X64.AESCTR.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.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.GHash.fsti.checked",
"Vale.AES.GHash.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.AESCTR.fsti"
} | [
"total"
] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"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.sse_enabled",
"Prims.op_LessThan",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRdx",
"Prims.op_Multiply",
"Prims.op_Subtraction",
"Vale.X64.Machine_s.pow2_32",
"Vale.X64.Decls.validSrcAddrs128",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Decls.validDstAddrs128",
"Vale.X64.Machine_s.rR10",
"Prims.op_Addition",
"Vale.X64.Machine_s.pow2_64",
"Prims.op_LessThanOrEqual",
"Vale.X64.Decls.buffer_length",
"Vale.X64.Memory.vuint128",
"Vale.X64.Decls.buffers_disjoint128",
"Vale.AES.X64.AESCTR.aes_reqs",
"Vale.X64.Machine_s.rR8",
"Vale.X64.CPU_Features_s.pclmulqdq_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.l_Forall",
"Vale.X64.InsBasic.vale_heap",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Vale.X64.Decls.modifies_buffer128",
"Prims.int",
"Vale.AES.GCTR.gctr_partial_def",
"Vale.X64.Decls.buffer128_as_seq",
"Vale.Def.Types_s.quad32",
"Vale.AES.GCTR_s.inc32",
"Prims.op_GreaterThan",
"FStar.Seq.Base.length",
"FStar.Seq.Base.slice",
"Vale.AES.GHash.ghash_incremental",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_mem_heaplet",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Decls.va_upd_mem"
] | [] | module Vale.AES.X64.AESCTR
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.AES.X64.GHash
open Vale.AES.GHash
open Vale.X64.CPU_Features_s
let aes_reqs
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:nat64) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
key_ptr == buffer_addr keys_b heap0 /\
validSrcAddrs128 heap0 key_ptr keys_b (nr alg + 1) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
//-- Aes_ctr_encrypt
val va_code_Aes_ctr_encrypt : alg:algorithm -> Tot va_code
val va_codegen_success_Aes_ctr_encrypt : alg:algorithm -> Tot va_pbool
val va_lemma_Aes_ctr_encrypt : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> key:(seq nat32)
-> round_keys:(seq quad32) -> keys_b:buffer128 -> in1:quad32 -> in2:quad32 -> in3:quad32 ->
in4:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Aes_ctr_encrypt alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet
0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 == Vale.Def.Types_s.quad32_xor in1
(va_get_xmm 3 va_s0) /\ va_get_xmm 12 va_s0 == Vale.Def.Types_s.quad32_xor in2 (va_get_xmm 3
va_s0) /\ va_get_xmm 13 va_s0 == Vale.Def.Types_s.quad32_xor in3 (va_get_xmm 3 va_s0) /\
va_get_xmm 14 va_s0 == Vale.Def.Types_s.quad32_xor in4 (va_get_xmm 3 va_s0) /\ va_get_xmm 3
va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 4 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 1 /\ va_get_xmm 5 va_s0 == FStar.Seq.Base.index #quad32
round_keys 2 /\ va_get_xmm 6 va_s0 == FStar.Seq.Base.index #quad32 round_keys 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_sM) (va_get_mem_heaplet 0 va_sM)
(va_get_mem_layout va_sM) /\ va_get_xmm 2 va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in1 /\
va_get_xmm 12 va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in2 /\ va_get_xmm 13 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in3 /\ va_get_xmm 14 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in4) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 6 va_sM
(va_update_ok va_sM va_s0))))))))))))
[@ va_qattr]
let va_wp_Aes_ctr_encrypt (alg:algorithm) (key:(seq nat32)) (round_keys:(seq quad32))
(keys_b:buffer128) (in1:quad32) (in2:quad32) (in3:quad32) (in4:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 ==
Vale.Def.Types_s.quad32_xor in1 (va_get_xmm 3 va_s0) /\ va_get_xmm 12 va_s0 ==
Vale.Def.Types_s.quad32_xor in2 (va_get_xmm 3 va_s0) /\ va_get_xmm 13 va_s0 ==
Vale.Def.Types_s.quad32_xor in3 (va_get_xmm 3 va_s0) /\ va_get_xmm 14 va_s0 ==
Vale.Def.Types_s.quad32_xor in4 (va_get_xmm 3 va_s0) /\ va_get_xmm 3 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 4 va_s0 == FStar.Seq.Base.index #quad32
round_keys 1 /\ va_get_xmm 5 va_s0 == FStar.Seq.Base.index #quad32 round_keys 2 /\ va_get_xmm 6
va_s0 == FStar.Seq.Base.index #quad32 round_keys 3) /\ (forall (va_x_xmm6:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm2:quad32) (va_x_xmm12:quad32)
(va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags
va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 6 va_x_xmm6 va_s0)))))))) in va_get_ok va_sM /\ (aes_reqs alg key round_keys keys_b
(va_get_reg64 rR8 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_xmm 2
va_sM == Vale.AES.AES_s.aes_encrypt_LE alg key in1 /\ va_get_xmm 12 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in2 /\ va_get_xmm 13 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in3 /\ va_get_xmm 14 va_sM ==
Vale.AES.AES_s.aes_encrypt_LE alg key in4) ==> va_k va_sM (())))
val va_wpProof_Aes_ctr_encrypt : alg:algorithm -> key:(seq nat32) -> round_keys:(seq quad32) ->
keys_b:buffer128 -> in1:quad32 -> in2:quad32 -> in3:quad32 -> in4: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_Aes_ctr_encrypt alg key round_keys keys_b in1 in2 in3 in4
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Aes_ctr_encrypt alg) ([va_Mod_flags;
va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 2; va_Mod_xmm 5; va_Mod_xmm 4;
va_Mod_xmm 3; va_Mod_xmm 6]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Aes_ctr_encrypt (alg:algorithm) (key:(seq nat32)) (round_keys:(seq quad32))
(keys_b:buffer128) (in1:quad32) (in2:quad32) (in3:quad32) (in4:quad32) : (va_quickCode unit
(va_code_Aes_ctr_encrypt alg)) =
(va_QProc (va_code_Aes_ctr_encrypt alg) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm
12; va_Mod_xmm 2; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 6])
(va_wp_Aes_ctr_encrypt alg key round_keys keys_b in1 in2 in3 in4) (va_wpProof_Aes_ctr_encrypt
alg key round_keys keys_b in1 in2 in3 in4))
//--
//-- Aes_counter_loop
val va_code_Aes_counter_loop : alg:algorithm -> Tot va_code
val va_codegen_success_Aes_counter_loop : alg:algorithm -> Tot va_pbool
val va_lemma_Aes_counter_loop : va_b0:va_code -> va_s0:va_state -> alg:algorithm ->
plain_b:buffer128 -> out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) ->
keys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Aes_counter_loop alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ (0 < va_get_reg64 rRdx va_s0 /\ 4 `op_Multiply` va_get_reg64 rRdx va_s0 <
pow2_32 - 4) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rR9
va_s0) plain_b (va_get_reg64 rRdx va_s0 `op_Multiply` 4) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rR10 va_s0) out_b
(va_get_reg64 rRdx va_s0 `op_Multiply` 4) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rR9
va_s0 + va_get_reg64 rRdx va_s0 `op_Multiply` 64 < pow2_64 /\ va_get_reg64 rR10 va_s0 +
va_get_reg64 rRdx va_s0 `op_Multiply` 64 < pow2_64 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 plain_b <= Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
out_b /\ Vale.X64.Decls.buffers_disjoint128 plain_b out_b /\ aes_reqs alg key round_keys keys_b
(va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ va_get_xmm 8 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 /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg64 rR10
va_s0) out_b (va_get_reg64 rRdx va_s0 `op_Multiply` 4) (va_get_mem_layout va_sM) Secret /\
va_get_reg64 rR9 va_sM == va_get_reg64 rR9 va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0 /\
va_get_reg64 rR10 va_sM == va_get_reg64 rR10 va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0
/\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123
67438087 66051 /\ Vale.AES.GCTR.gctr_partial_def alg (4 `op_Multiply` va_get_reg64 rRdx va_s0)
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_s0) plain_b)
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_sM) out_b) key (va_get_xmm 7 va_s0)
/\ va_get_xmm 7 va_sM == Vale.AES.GCTR_s.inc32 (va_get_xmm 7 va_s0) (4 `op_Multiply`
va_get_reg64 rRdx va_s0) /\ l_and (FStar.Seq.Base.length #Vale.X64.Decls.quad32
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 1 va_sM) out_b) 0 (4 `op_Multiply` va_get_reg64 rRdx va_s0)) > 0)
(va_get_xmm 1 va_sM == Vale.AES.GHash.ghash_incremental (Vale.Def.Types_s.reverse_bytes_quad32
(va_get_xmm 11 va_sM)) (va_get_xmm 1 va_s0) (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 1 va_sM) out_b) 0 (4 `op_Multiply`
va_get_reg64 rRdx va_s0)))) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM
(va_update_flags va_sM (va_update_xmm 1 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdi
va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rRax va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12
va_sM (va_update_xmm 2 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3
va_sM (va_update_xmm 6 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7
va_sM (va_update_xmm 15 va_sM (va_update_xmm 0 va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Aes_counter_loop (alg:algorithm) (plain_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) | false | true | Vale.AES.X64.AESCTR.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_Aes_counter_loop
(alg: algorithm)
(plain_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.X64.AESCTR.va_wp_Aes_counter_loop | {
"file_name": "obj/Vale.AES.X64.AESCTR.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
alg: Vale.AES.AES_common_s.algorithm ->
plain_b: Vale.X64.Memory.buffer128 ->
out_b: Vale.X64.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | {
"end_col": 53,
"end_line": 203,
"start_col": 2,
"start_line": 163
} |
Prims.Tot | val va_codegen_success_Preamble : va_dummy:unit -> Tot va_pbool | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": 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_codegen_success_Preamble () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_pbool_and (va_codegen_success_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27)
(va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (va_ttrue ())))))))))) | val va_codegen_success_Preamble : va_dummy:unit -> Tot va_pbool
let va_codegen_success_Preamble () = | false | null | false | (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi)
0
Secret)
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 2)
(va_op_reg_opr64_reg64 rRdi)
16
Secret)
(va_pbool_and (va_codegen_success_InitPshufbStableMask (va_op_xmm_xmm 7)
(va_op_reg_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27)
(va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177)
(va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)
)
(va_pbool_and (va_codegen_success_Palignr8 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 2))
(va_pbool_and (va_codegen_success_Shufpd (va_op_xmm_xmm 2)
(va_op_xmm_xmm 0)
0)
(va_ttrue ())))))))))) | {
"checked_file": "Vale.SHA.X64.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.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.InsStack.fsti.checked",
"Vale.X64.InsSha.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.SHA.SHA_helpers.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.X64.fst"
} | [
"total"
] | [
"Prims.unit",
"Vale.X64.Decls.va_pbool_and",
"Vale.X64.InsVector.va_codegen_success_Load128_buffer",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRdi",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.InsVector.va_codegen_success_InitPshufbStableMask",
"Vale.X64.Machine_s.rRax",
"Vale.X64.InsVector.va_codegen_success_Pshufd",
"Vale.X64.InsVector.va_codegen_success_Mov128",
"Vale.X64.InsVector.va_codegen_success_Palignr8",
"Vale.X64.InsVector.va_codegen_success_Shufpd",
"Vale.X64.Decls.va_ttrue",
"Vale.X64.Decls.va_pbool"
] | [] | module Vale.SHA.X64
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsStack
open Vale.X64.InsVector
open Vale.X64.InsSha
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.SHA.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
#reset-options "--z3rlimit 40"
//-- Preamble
val va_code_Preamble : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Preamble () =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_CCons (va_code_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax))
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 2)
(va_op_xmm_xmm 2) 27) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_CCons
(va_code_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Shufpd (va_op_xmm_xmm
2) (va_op_xmm_xmm 0) 0) (va_CNil ())))))))))))
val va_codegen_success_Preamble : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr] | false | true | Vale.SHA.X64.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_codegen_success_Preamble : va_dummy:unit -> Tot va_pbool | [] | Vale.SHA.X64.va_codegen_success_Preamble | {
"file_name": "obj/Vale.SHA.X64.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | va_dummy: Prims.unit -> Vale.X64.Decls.va_pbool | {
"end_col": 92,
"end_line": 56,
"start_col": 2,
"start_line": 47
} |
Prims.Tot | val va_wp_Preamble (ctx_b: buffer128) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": 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_Preamble (ctx_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRdi va_s0) ctx_b 2 (va_get_mem_layout va_s0) Secret) /\ (forall (va_x_rax:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (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_s0)))))) in va_get_ok va_sM /\ (va_get_xmm 7 va_sM == va_get_xmm
8 va_sM /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087
134810123 202182159 /\ (let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_sM) in let efgh = Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in
l_and (l_and (va_get_xmm 1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) ==> va_k va_sM (()))) | val va_wp_Preamble (ctx_b: buffer128) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
let va_wp_Preamble (ctx_b: buffer128) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 = | false | null | false | (va_get_ok va_s0 /\
(sse_enabled /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRdi va_s0)
ctx_b
2
(va_get_mem_layout va_s0)
Secret) /\
(forall (va_x_rax: nat64)
(va_x_xmm0: quad32)
(va_x_xmm1: quad32)
(va_x_xmm2: quad32)
(va_x_xmm7: quad32)
(va_x_xmm8: quad32)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_xmm 8
va_x_xmm8
(va_upd_xmm 7
va_x_xmm7
(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_s0))))))
in
va_get_ok va_sM /\
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM /\
va_get_xmm 8 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\
(let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in
let efgh = Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in
l_and (l_and (va_get_xmm 1 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd))
(va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__hi2 abcd)))
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.SHA.X64.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.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.InsStack.fsti.checked",
"Vale.X64.InsSha.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.SHA.SHA_helpers.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.X64.fst"
} | [
"total"
] | [
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.sse_enabled",
"Vale.X64.Decls.validSrcAddrs128",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.l_Forall",
"Vale.X64.Memory.nat64",
"Vale.X64.Decls.quad32",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.eq2",
"Vale.X64.Decls.va_get_xmm",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.Mkfour",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.SHA.SHA_helpers.hash256",
"Vale.SHA.SHA_helpers.make_hash",
"Vale.SHA.SHA_helpers.make_ordered_hash",
"Vale.Def.Types_s.quad32",
"Vale.X64.Decls.buffer128_read",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rRax"
] | [] | module Vale.SHA.X64
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsStack
open Vale.X64.InsVector
open Vale.X64.InsSha
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.SHA.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
#reset-options "--z3rlimit 40"
//-- Preamble
val va_code_Preamble : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Preamble () =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_CCons (va_code_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax))
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 2)
(va_op_xmm_xmm 2) 27) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_CCons
(va_code_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Shufpd (va_op_xmm_xmm
2) (va_op_xmm_xmm 0) 0) (va_CNil ())))))))))))
val va_codegen_success_Preamble : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Preamble () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_pbool_and (va_codegen_success_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27)
(va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (va_ttrue ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Preamble (va_mods:va_mods_t) (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abcd:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_s) in let (efgh:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 1
(va_get_mem_heaplet 0 va_s) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRdi) 0 Secret ctx_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64
rRdi) 16 Secret ctx_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 89 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 91 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 93 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 96 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 98 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (fun (va_s:va_state) _ -> va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 99 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(FStar.Seq.Base.equal #Vale.SHA.SHA_helpers.word (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s) (va_get_xmm 2 va_s)) (Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)) (va_QEmpty
(())))))))))))))
val va_lemma_Preamble : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Preamble ()) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled
/\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdi va_s0) ctx_b
2 (va_get_mem_layout va_s0) Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ (let abcd =
Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm
1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 8 va_sM (va_update_xmm 7 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_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_Preamble va_b0 va_s0 ctx_b =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok] in
let va_qc = va_qcode_Preamble va_mods ctx_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Preamble ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 57 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 74 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 75 column 72 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 80 column 63 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm
1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr] | false | true | Vale.SHA.X64.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_Preamble (ctx_b: buffer128) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | [] | Vale.SHA.X64.va_wp_Preamble | {
"file_name": "obj/Vale.SHA.X64.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ctx_b: Vale.X64.Memory.buffer128 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | {
"end_col": 77,
"end_line": 164,
"start_col": 2,
"start_line": 147
} |
Prims.Tot | val va_codegen_success_Loop_rounds_16_51_body : i:nat -> Tot va_pbool | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": 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_codegen_success_Loop_rounds_16_51_body i =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` i) Secret) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_msg2 (va_op_xmm_xmm 4) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 6) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_ttrue ()))))))))))) | val va_codegen_success_Loop_rounds_16_51_body : i:nat -> Tot va_pbool
let va_codegen_success_Loop_rounds_16_51_body i = | false | null | false | (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx)
(16 `op_Multiply` i)
Secret)
(va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3))
(va_pbool_and (va_codegen_success_SHA256_msg2 (va_op_xmm_xmm 4) (va_op_xmm_xmm 3))
(va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1))
(va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_Palignr4 (va_op_xmm_xmm 7)
(va_op_xmm_xmm 3))
(va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm 5)
(va_op_xmm_xmm 7))
(va_pbool_and (va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 6)
(va_op_xmm_xmm 3))
(va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 2))
(va_ttrue ()))))))))))) | {
"checked_file": "Vale.SHA.X64.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.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.InsStack.fsti.checked",
"Vale.X64.InsSha.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.SHA.SHA_helpers.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.X64.fst"
} | [
"total"
] | [
"Prims.nat",
"Vale.X64.Decls.va_pbool_and",
"Vale.X64.InsVector.va_codegen_success_Load128_buffer",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRcx",
"Prims.op_Multiply",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.InsVector.va_codegen_success_Paddd",
"Vale.X64.InsSha.va_codegen_success_SHA256_msg2",
"Vale.X64.InsSha.va_codegen_success_SHA256_rnds2",
"Vale.X64.InsVector.va_codegen_success_Pshufd",
"Vale.X64.InsVector.va_codegen_success_Mov128",
"Vale.X64.InsVector.va_codegen_success_Palignr4",
"Vale.X64.InsSha.va_codegen_success_SHA256_msg1",
"Vale.X64.Decls.va_ttrue",
"Vale.X64.Decls.va_pbool"
] | [] | module Vale.SHA.X64
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsStack
open Vale.X64.InsVector
open Vale.X64.InsSha
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.SHA.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
#reset-options "--z3rlimit 40"
//-- Preamble
val va_code_Preamble : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Preamble () =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_CCons (va_code_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax))
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 2)
(va_op_xmm_xmm 2) 27) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_CCons
(va_code_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Shufpd (va_op_xmm_xmm
2) (va_op_xmm_xmm 0) 0) (va_CNil ())))))))))))
val va_codegen_success_Preamble : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Preamble () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_pbool_and (va_codegen_success_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27)
(va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (va_ttrue ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Preamble (va_mods:va_mods_t) (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abcd:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_s) in let (efgh:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 1
(va_get_mem_heaplet 0 va_s) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRdi) 0 Secret ctx_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64
rRdi) 16 Secret ctx_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 89 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 91 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 93 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 96 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 98 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (fun (va_s:va_state) _ -> va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 99 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(FStar.Seq.Base.equal #Vale.SHA.SHA_helpers.word (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s) (va_get_xmm 2 va_s)) (Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)) (va_QEmpty
(())))))))))))))
val va_lemma_Preamble : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Preamble ()) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled
/\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdi va_s0) ctx_b
2 (va_get_mem_layout va_s0) Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ (let abcd =
Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm
1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 8 va_sM (va_update_xmm 7 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_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_Preamble va_b0 va_s0 ctx_b =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok] in
let va_qc = va_qcode_Preamble va_mods ctx_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Preamble ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 57 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 74 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 75 column 72 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 80 column 63 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm
1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Preamble (ctx_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRdi va_s0) ctx_b 2 (va_get_mem_layout va_s0) Secret) /\ (forall (va_x_rax:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (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_s0)))))) in va_get_ok va_sM /\ (va_get_xmm 7 va_sM == va_get_xmm
8 va_sM /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087
134810123 202182159 /\ (let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_sM) in let efgh = Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in
l_and (l_and (va_get_xmm 1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) ==> va_k va_sM (())))
val va_wpProof_Preamble : ctx_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Preamble ctx_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Preamble ()) ([va_Mod_flags;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Preamble ctx_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Preamble (va_code_Preamble ()) va_s0 ctx_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 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_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Preamble (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble ())) =
(va_QProc (va_code_Preamble ()) ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax]) (va_wp_Preamble ctx_b) (va_wpProof_Preamble
ctx_b))
//--
//-- Loop_rounds_0_15
val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rRsi) 0 Secret)
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4)
(va_op_reg_opr64_reg64 rRsi) 16 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 5) (va_op_reg_opr64_reg64 rRsi) 32 Secret)
(va_CCons (va_code_PshufbStable (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6)
(va_op_reg_opr64_reg64 rRsi) 48 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRcx) 0 Secret)
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3))
(va_CCons (va_code_PshufbStable (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 9)
(va_op_xmm_xmm 1)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 16 Secret) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_CCons (va_code_PshufbStable
(va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rRsi)
(va_const_opr64 64)) (va_CCons (va_code_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0)
(va_op_xmm_xmm 5)) (va_CCons (va_code_PshufbStable (va_op_xmm_xmm 6) (va_op_xmm_xmm 7))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm
7) (va_op_xmm_xmm 5)) (va_CCons (va_code_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_CCons
(va_code_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_CCons (va_code_SHA256_rnds2
(va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRcx) 48 Secret)
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 6))
(va_CCons (va_code_SHA256_msg2 (va_op_xmm_xmm 3) (va_op_xmm_xmm 6)) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 7)
(va_op_xmm_xmm 3)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_CCons (va_code_SHA256_msg1
(va_op_xmm_xmm 5) (va_op_xmm_xmm 6)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 2)) (va_CNil ()))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_codegen_success_Loop_rounds_0_15 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3)
(va_op_reg_opr64_reg64 rRsi) 0 Secret) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64 rRsi) 16 Secret)
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
5) (va_op_reg_opr64_reg64 rRsi) 32 Secret) (va_pbool_and (va_codegen_success_PshufbStable
(va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6) (va_op_reg_opr64_reg64 rRsi) 48 Secret)
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
0) (va_op_reg_opr64_reg64 rRcx) 0 Secret) (va_pbool_and (va_codegen_success_Paddd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_PshufbStable
(va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0)
14) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 16 Secret) (va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm
0) (va_op_xmm_xmm 4)) (va_pbool_and (va_codegen_success_PshufbStable (va_op_xmm_xmm 5)
(va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0)
14) (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rRsi) (va_const_opr64 64))
(va_pbool_and (va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
0) (va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Paddd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PshufbStable
(va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_SHA256_rnds2
(va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0)
(va_op_xmm_xmm 0) 14) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm
6)) (va_pbool_and (va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 48 Secret) (va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm
0) (va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_SHA256_msg2 (va_op_xmm_xmm 3)
(va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0)
14) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_ttrue
()))))))))))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (k_b:buffer128) (offset:nat) :
(va_quickCode unit (va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 146 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_1582 (s_1583:(FStar.Seq.Base.seq a_1582)) (i_1584:Prims.nat) (j_1585:Prims.nat) -> let
(j_1545:Prims.nat) = j_1585 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1584
j_1545) (Prims.op_LessThanOrEqual j_1545 (FStar.Seq.Base.length #a_1582 s_1583))))
Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s) in_b) offset
(offset + 4)) (fun _ -> let (input_LE:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) =
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) in_b) offset (offset + 4) in let (input_BE:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let
(block:block_w) = Vale.SHA.SHA_helpers.quads_to_block input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 149 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_quads_to_block input_BE) (let
(hash_orig:Vale.SHA.SHA_helpers.hash256) = Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s)
(va_get_xmm 2 va_s) in let (va_arg79:Vale.SHA.SHA_helpers.block_w) = block in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 153 column 30 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_repeat_range_0_vale va_arg79 hash_orig) (let
(ks:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) k_b in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 158 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64
rRsi) 0 Secret in_b (offset + 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 159 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64
rRsi) 16 Secret in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 160 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 5) (va_op_reg_opr64_reg64
rRsi) 32 Secret in_b (offset + 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 161 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 162 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 162 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 3 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 0) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 163 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6) (va_op_reg_opr64_reg64
rRsi) 48 Secret in_b (offset + 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 165 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 0 Secret k_b 0) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 166 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 166 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 167 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 169 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 170 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 170 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 4 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 1) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 171 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 174 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 0 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 175 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 176 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 177 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 2 block hash_orig) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 180 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 16 Secret k_b 1) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 181 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 181 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 182 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 183 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 184 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 184 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 5 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 2) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 185 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 4 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 186 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 187 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rRsi) (va_const_opr64 64)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4) 16 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 189 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 6 block hash_orig) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 192 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 32 Secret k_b 2) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 193 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 193 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 195 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 196 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 196 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 6 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 3) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 197 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 8 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 200 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5) 20 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 203 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 10 block hash_orig) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 206 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 48 Secret k_b 3) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 207 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 207 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 209 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg2 (va_op_xmm_xmm 3) (va_op_xmm_xmm 6) 16 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 210 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 12 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 211 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 212 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 213 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 214 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) 24 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 216 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 14 block hash_orig) (va_QEmpty
(())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Loop_rounds_0_15 : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> k_b:buffer128
-> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_15 ()) va_s0 /\ va_get_ok va_s0 /\
(sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0
va_s0) (va_get_reg64 rRsi va_s0) in_b offset 4 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRsi va_s0 + 64 < pow2_64 /\ va_get_xmm 7
va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\
Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0)
k_b))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64 /\ (let input_LE =
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) in_b) offset (offset + 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let (block:block_w) =
Vale.SHA.SHA_helpers.quads_to_block input_BE in l_and (l_and (l_and (l_and
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale 16 block (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0))) (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 16 block))
(va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 20
block) (Vale.SHA.SHA_helpers.ws_quad32 13 block))) (va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial 24 block)) (va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 12 block)) /\ va_get_xmm 9 va_sM == va_get_xmm 1 va_s0 /\
va_get_xmm 10 va_sM == va_get_xmm 2 va_s0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 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 rRsi va_sM (va_update_ok va_sM
va_s0)))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b k_b offset =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b k_b offset in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 128 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 138 column 37 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) in_b) offset (offset + 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let (block:block_w) =
Vale.SHA.SHA_helpers.quads_to_block input_BE in l_and (l_and (l_and (l_and
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale 16 block (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0))) (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 16 block))
(va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 20
block) (Vale.SHA.SHA_helpers.ws_quad32 13 block))) (va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial 24 block)) (va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 12 block)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 141 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 9 va_sM == va_get_xmm 1 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 142 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 10 va_sM == va_get_xmm 2 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_0_15 (in_b:buffer128) (k_b:buffer128) (offset:nat) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_s0) in_b offset 4 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx
va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRsi va_s0 + 64 < pow2_64 /\
va_get_xmm 7 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159 /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_s0) k_b)) /\ (forall (va_x_rsi: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_xmm9:quad32) (va_x_xmm10:quad32) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (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
rRsi va_x_rsi va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg64 rRsi va_sM == va_get_reg64
rRsi va_s0 + 64 /\ (let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) in_b) offset (offset + 4) in let
input_BE = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let (block:block_w) =
Vale.SHA.SHA_helpers.quads_to_block input_BE in l_and (l_and (l_and (l_and
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale 16 block (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0))) (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 16 block))
(va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 20
block) (Vale.SHA.SHA_helpers.ws_quad32 13 block))) (va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial 24 block)) (va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 12 block)) /\ va_get_xmm 9 va_sM == va_get_xmm 1 va_s0 /\
va_get_xmm 10 va_sM == va_get_xmm 2 va_s0) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_0_15 : in_b:buffer128 -> k_b:buffer128 -> offset:nat -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_15 in_b k_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_15 ()) ([va_Mod_flags;
va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b k_b offset va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b k_b
offset in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 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 rRsi va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_15 (in_b:buffer128) (k_b:buffer128) (offset:nat) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(va_QProc (va_code_Loop_rounds_0_15 ()) ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi]) (va_wp_Loop_rounds_0_15 in_b k_b offset)
(va_wpProof_Loop_rounds_0_15 in_b k_b offset))
//--
//-- Loop_rounds_16_51_body
val va_code_Loop_rounds_16_51_body : i:nat -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_51_body i =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` i) Secret) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_msg2
(va_op_xmm_xmm 4) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm
7) (va_op_xmm_xmm 3)) (va_CCons (va_code_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_CCons
(va_code_SHA256_msg1 (va_op_xmm_xmm 6) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_rnds2
(va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CNil ())))))))))))))
val va_codegen_success_Loop_rounds_16_51_body : i:nat -> Tot va_pbool
[@ "opaque_to_smt" va_qattr] | false | true | Vale.SHA.X64.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_codegen_success_Loop_rounds_16_51_body : i:nat -> Tot va_pbool | [] | Vale.SHA.X64.va_codegen_success_Loop_rounds_16_51_body | {
"file_name": "obj/Vale.SHA.X64.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | i: Prims.nat -> Vale.X64.Decls.va_pbool | {
"end_col": 97,
"end_line": 618,
"start_col": 2,
"start_line": 608
} |
Prims.Tot | val va_qcode_Preamble (va_mods: va_mods_t) (ctx_b: buffer128)
: (va_quickCode unit (va_code_Preamble ())) | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": 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_qcode_Preamble (va_mods:va_mods_t) (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abcd:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_s) in let (efgh:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 1
(va_get_mem_heaplet 0 va_s) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRdi) 0 Secret ctx_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64
rRdi) 16 Secret ctx_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 89 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 91 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 93 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 96 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 98 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (fun (va_s:va_state) _ -> va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 99 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(FStar.Seq.Base.equal #Vale.SHA.SHA_helpers.word (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s) (va_get_xmm 2 va_s)) (Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)) (va_QEmpty
(()))))))))))))) | val va_qcode_Preamble (va_mods: va_mods_t) (ctx_b: buffer128)
: (va_quickCode unit (va_code_Preamble ()))
let va_qcode_Preamble (va_mods: va_mods_t) (ctx_b: buffer128)
: (va_quickCode unit (va_code_Preamble ())) = | false | null | false | (qblock va_mods
(fun (va_s: va_state) ->
let va_old_s:va_state = va_s in
let abcd:Vale.X64.Decls.quad32 =
Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_s)
in
let efgh:Vale.X64.Decls.quad32 =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_s)
in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi)
0
Secret
ctx_b
0)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 2)
(va_op_reg_opr64_reg64 rRdi)
16
Secret
ctx_b
1)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 89 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 91 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 93 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 96 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 98 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0)
(fun (va_s: va_state) _ ->
va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 99 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(FStar.Seq.Base.equal #Vale.SHA.SHA_helpers.word
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s)
(va_get_xmm 2 va_s))
(Vale.SHA.SHA_helpers.make_ordered_hash abcd
efgh))
(va_QEmpty (()))))))))))))) | {
"checked_file": "Vale.SHA.X64.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.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.InsStack.fsti.checked",
"Vale.X64.InsSha.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.SHA.SHA_helpers.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.X64.fst"
} | [
"total"
] | [
"Vale.X64.QuickCode.va_mods_t",
"Vale.X64.Memory.buffer128",
"Vale.X64.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.X64.Decls.va_code",
"Vale.X64.InsVector.va_code_Load128_buffer",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRdi",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.InsVector.va_code_InitPshufbStableMask",
"Vale.X64.Machine_s.rRax",
"Vale.X64.InsVector.va_code_Pshufd",
"Vale.X64.InsVector.va_code_Mov128",
"Vale.X64.InsVector.va_code_Palignr8",
"Vale.X64.InsVector.va_code_Shufpd",
"Prims.Nil",
"Vale.X64.Machine_s.precode",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.va_QSeq",
"Vale.X64.QuickCodes.va_range1",
"Vale.X64.InsVector.va_quick_Load128_buffer",
"Vale.X64.InsVector.va_quick_InitPshufbStableMask",
"Vale.X64.InsVector.va_quick_Pshufd",
"Vale.X64.InsVector.va_quick_Mov128",
"Vale.X64.InsVector.va_quick_Palignr8",
"Vale.X64.QuickCodes.va_QBind",
"Vale.X64.InsVector.va_quick_Shufpd",
"Vale.X64.QuickCodes.va_qAssert",
"FStar.Seq.Base.equal",
"Vale.SHA.SHA_helpers.word",
"Vale.SHA.SHA_helpers.make_hash",
"Vale.X64.Decls.va_get_xmm",
"Vale.SHA.SHA_helpers.make_ordered_hash",
"Vale.X64.QuickCodes.va_QEmpty",
"Vale.X64.QuickCodes.quickCodes",
"Vale.Def.Types_s.quad32",
"Vale.X64.Decls.buffer128_read",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCode.va_quickCode",
"Vale.SHA.X64.va_code_Preamble"
] | [] | module Vale.SHA.X64
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsStack
open Vale.X64.InsVector
open Vale.X64.InsSha
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.SHA.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
#reset-options "--z3rlimit 40"
//-- Preamble
val va_code_Preamble : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Preamble () =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_CCons (va_code_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax))
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 2)
(va_op_xmm_xmm 2) 27) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_CCons
(va_code_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Shufpd (va_op_xmm_xmm
2) (va_op_xmm_xmm 0) 0) (va_CNil ())))))))))))
val va_codegen_success_Preamble : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Preamble () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_pbool_and (va_codegen_success_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27)
(va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (va_ttrue ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Preamble (va_mods:va_mods_t) (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble | false | false | Vale.SHA.X64.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_qcode_Preamble (va_mods: va_mods_t) (ctx_b: buffer128)
: (va_quickCode unit (va_code_Preamble ())) | [] | Vale.SHA.X64.va_qcode_Preamble | {
"file_name": "obj/Vale.SHA.X64.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | va_mods: Vale.X64.QuickCode.va_mods_t -> ctx_b: Vale.X64.Memory.buffer128
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.SHA.X64.va_code_Preamble ()) | {
"end_col": 20,
"end_line": 90,
"start_col": 2,
"start_line": 61
} |
Prims.Tot | val va_code_Loop_rounds_16_51 : va_dummy:unit -> Tot va_code | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": 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_code_Loop_rounds_16_51 () =
(va_Block (va_CCons (va_code_Loop_rounds_16_51_recursive 12) (va_CNil ()))) | val va_code_Loop_rounds_16_51 : va_dummy:unit -> Tot va_code
let va_code_Loop_rounds_16_51 () = | false | null | false | (va_Block (va_CCons (va_code_Loop_rounds_16_51_recursive 12) (va_CNil ()))) | {
"checked_file": "Vale.SHA.X64.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.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.InsStack.fsti.checked",
"Vale.X64.InsSha.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.SHA.SHA_helpers.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.X64.fst"
} | [
"total"
] | [
"Prims.unit",
"Vale.X64.Decls.va_Block",
"Vale.X64.Decls.va_CCons",
"Vale.SHA.X64.va_code_Loop_rounds_16_51_recursive",
"Vale.X64.Decls.va_CNil",
"Vale.X64.Decls.va_code"
] | [] | module Vale.SHA.X64
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsStack
open Vale.X64.InsVector
open Vale.X64.InsSha
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.SHA.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
#reset-options "--z3rlimit 40"
//-- Preamble
val va_code_Preamble : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Preamble () =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_CCons (va_code_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax))
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 2)
(va_op_xmm_xmm 2) 27) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_CCons
(va_code_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Shufpd (va_op_xmm_xmm
2) (va_op_xmm_xmm 0) 0) (va_CNil ())))))))))))
val va_codegen_success_Preamble : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Preamble () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_pbool_and (va_codegen_success_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27)
(va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (va_ttrue ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Preamble (va_mods:va_mods_t) (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abcd:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_s) in let (efgh:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 1
(va_get_mem_heaplet 0 va_s) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRdi) 0 Secret ctx_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64
rRdi) 16 Secret ctx_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 89 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 91 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 93 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 96 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 98 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (fun (va_s:va_state) _ -> va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 99 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(FStar.Seq.Base.equal #Vale.SHA.SHA_helpers.word (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s) (va_get_xmm 2 va_s)) (Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)) (va_QEmpty
(())))))))))))))
val va_lemma_Preamble : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Preamble ()) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled
/\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdi va_s0) ctx_b
2 (va_get_mem_layout va_s0) Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ (let abcd =
Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm
1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 8 va_sM (va_update_xmm 7 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_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_Preamble va_b0 va_s0 ctx_b =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok] in
let va_qc = va_qcode_Preamble va_mods ctx_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Preamble ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 57 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 74 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 75 column 72 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 80 column 63 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm
1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Preamble (ctx_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRdi va_s0) ctx_b 2 (va_get_mem_layout va_s0) Secret) /\ (forall (va_x_rax:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (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_s0)))))) in va_get_ok va_sM /\ (va_get_xmm 7 va_sM == va_get_xmm
8 va_sM /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087
134810123 202182159 /\ (let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_sM) in let efgh = Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in
l_and (l_and (va_get_xmm 1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) ==> va_k va_sM (())))
val va_wpProof_Preamble : ctx_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Preamble ctx_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Preamble ()) ([va_Mod_flags;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Preamble ctx_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Preamble (va_code_Preamble ()) va_s0 ctx_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 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_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Preamble (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble ())) =
(va_QProc (va_code_Preamble ()) ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax]) (va_wp_Preamble ctx_b) (va_wpProof_Preamble
ctx_b))
//--
//-- Loop_rounds_0_15
val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rRsi) 0 Secret)
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4)
(va_op_reg_opr64_reg64 rRsi) 16 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 5) (va_op_reg_opr64_reg64 rRsi) 32 Secret)
(va_CCons (va_code_PshufbStable (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6)
(va_op_reg_opr64_reg64 rRsi) 48 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRcx) 0 Secret)
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3))
(va_CCons (va_code_PshufbStable (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 9)
(va_op_xmm_xmm 1)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 16 Secret) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_CCons (va_code_PshufbStable
(va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rRsi)
(va_const_opr64 64)) (va_CCons (va_code_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0)
(va_op_xmm_xmm 5)) (va_CCons (va_code_PshufbStable (va_op_xmm_xmm 6) (va_op_xmm_xmm 7))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm
7) (va_op_xmm_xmm 5)) (va_CCons (va_code_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_CCons
(va_code_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_CCons (va_code_SHA256_rnds2
(va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRcx) 48 Secret)
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 6))
(va_CCons (va_code_SHA256_msg2 (va_op_xmm_xmm 3) (va_op_xmm_xmm 6)) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 7)
(va_op_xmm_xmm 3)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_CCons (va_code_SHA256_msg1
(va_op_xmm_xmm 5) (va_op_xmm_xmm 6)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 2)) (va_CNil ()))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_codegen_success_Loop_rounds_0_15 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3)
(va_op_reg_opr64_reg64 rRsi) 0 Secret) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64 rRsi) 16 Secret)
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
5) (va_op_reg_opr64_reg64 rRsi) 32 Secret) (va_pbool_and (va_codegen_success_PshufbStable
(va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6) (va_op_reg_opr64_reg64 rRsi) 48 Secret)
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
0) (va_op_reg_opr64_reg64 rRcx) 0 Secret) (va_pbool_and (va_codegen_success_Paddd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_PshufbStable
(va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0)
14) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 16 Secret) (va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm
0) (va_op_xmm_xmm 4)) (va_pbool_and (va_codegen_success_PshufbStable (va_op_xmm_xmm 5)
(va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0)
14) (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rRsi) (va_const_opr64 64))
(va_pbool_and (va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
0) (va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Paddd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PshufbStable
(va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_SHA256_rnds2
(va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0)
(va_op_xmm_xmm 0) 14) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm
6)) (va_pbool_and (va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 48 Secret) (va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm
0) (va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_SHA256_msg2 (va_op_xmm_xmm 3)
(va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0)
14) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_ttrue
()))))))))))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (k_b:buffer128) (offset:nat) :
(va_quickCode unit (va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 146 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_1582 (s_1583:(FStar.Seq.Base.seq a_1582)) (i_1584:Prims.nat) (j_1585:Prims.nat) -> let
(j_1545:Prims.nat) = j_1585 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1584
j_1545) (Prims.op_LessThanOrEqual j_1545 (FStar.Seq.Base.length #a_1582 s_1583))))
Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s) in_b) offset
(offset + 4)) (fun _ -> let (input_LE:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) =
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) in_b) offset (offset + 4) in let (input_BE:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let
(block:block_w) = Vale.SHA.SHA_helpers.quads_to_block input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 149 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_quads_to_block input_BE) (let
(hash_orig:Vale.SHA.SHA_helpers.hash256) = Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s)
(va_get_xmm 2 va_s) in let (va_arg79:Vale.SHA.SHA_helpers.block_w) = block in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 153 column 30 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_repeat_range_0_vale va_arg79 hash_orig) (let
(ks:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) k_b in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 158 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64
rRsi) 0 Secret in_b (offset + 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 159 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64
rRsi) 16 Secret in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 160 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 5) (va_op_reg_opr64_reg64
rRsi) 32 Secret in_b (offset + 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 161 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 162 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 162 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 3 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 0) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 163 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6) (va_op_reg_opr64_reg64
rRsi) 48 Secret in_b (offset + 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 165 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 0 Secret k_b 0) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 166 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 166 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 167 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 169 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 170 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 170 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 4 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 1) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 171 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 174 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 0 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 175 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 176 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 177 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 2 block hash_orig) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 180 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 16 Secret k_b 1) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 181 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 181 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 182 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 183 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 184 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 184 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 5 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 2) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 185 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 4 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 186 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 187 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rRsi) (va_const_opr64 64)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4) 16 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 189 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 6 block hash_orig) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 192 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 32 Secret k_b 2) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 193 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 193 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 195 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 196 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 196 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 6 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 3) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 197 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 8 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 200 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5) 20 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 203 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 10 block hash_orig) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 206 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 48 Secret k_b 3) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 207 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 207 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 209 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg2 (va_op_xmm_xmm 3) (va_op_xmm_xmm 6) 16 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 210 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 12 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 211 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 212 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 213 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 214 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) 24 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 216 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 14 block hash_orig) (va_QEmpty
(())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Loop_rounds_0_15 : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> k_b:buffer128
-> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_15 ()) va_s0 /\ va_get_ok va_s0 /\
(sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0
va_s0) (va_get_reg64 rRsi va_s0) in_b offset 4 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRsi va_s0 + 64 < pow2_64 /\ va_get_xmm 7
va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\
Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0)
k_b))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64 /\ (let input_LE =
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) in_b) offset (offset + 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let (block:block_w) =
Vale.SHA.SHA_helpers.quads_to_block input_BE in l_and (l_and (l_and (l_and
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale 16 block (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0))) (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 16 block))
(va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 20
block) (Vale.SHA.SHA_helpers.ws_quad32 13 block))) (va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial 24 block)) (va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 12 block)) /\ va_get_xmm 9 va_sM == va_get_xmm 1 va_s0 /\
va_get_xmm 10 va_sM == va_get_xmm 2 va_s0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 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 rRsi va_sM (va_update_ok va_sM
va_s0)))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b k_b offset =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b k_b offset in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 128 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 138 column 37 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) in_b) offset (offset + 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let (block:block_w) =
Vale.SHA.SHA_helpers.quads_to_block input_BE in l_and (l_and (l_and (l_and
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale 16 block (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0))) (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 16 block))
(va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 20
block) (Vale.SHA.SHA_helpers.ws_quad32 13 block))) (va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial 24 block)) (va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 12 block)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 141 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 9 va_sM == va_get_xmm 1 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 142 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 10 va_sM == va_get_xmm 2 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_0_15 (in_b:buffer128) (k_b:buffer128) (offset:nat) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_s0) in_b offset 4 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx
va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRsi va_s0 + 64 < pow2_64 /\
va_get_xmm 7 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159 /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_s0) k_b)) /\ (forall (va_x_rsi: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_xmm9:quad32) (va_x_xmm10:quad32) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (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
rRsi va_x_rsi va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg64 rRsi va_sM == va_get_reg64
rRsi va_s0 + 64 /\ (let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) in_b) offset (offset + 4) in let
input_BE = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let (block:block_w) =
Vale.SHA.SHA_helpers.quads_to_block input_BE in l_and (l_and (l_and (l_and
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale 16 block (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0))) (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 16 block))
(va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 20
block) (Vale.SHA.SHA_helpers.ws_quad32 13 block))) (va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial 24 block)) (va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 12 block)) /\ va_get_xmm 9 va_sM == va_get_xmm 1 va_s0 /\
va_get_xmm 10 va_sM == va_get_xmm 2 va_s0) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_0_15 : in_b:buffer128 -> k_b:buffer128 -> offset:nat -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_15 in_b k_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_15 ()) ([va_Mod_flags;
va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b k_b offset va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b k_b
offset in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 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 rRsi va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_15 (in_b:buffer128) (k_b:buffer128) (offset:nat) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(va_QProc (va_code_Loop_rounds_0_15 ()) ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi]) (va_wp_Loop_rounds_0_15 in_b k_b offset)
(va_wpProof_Loop_rounds_0_15 in_b k_b offset))
//--
//-- Loop_rounds_16_51_body
val va_code_Loop_rounds_16_51_body : i:nat -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_51_body i =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` i) Secret) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_msg2
(va_op_xmm_xmm 4) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm
7) (va_op_xmm_xmm 3)) (va_CCons (va_code_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_CCons
(va_code_SHA256_msg1 (va_op_xmm_xmm 6) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_rnds2
(va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CNil ())))))))))))))
val va_codegen_success_Loop_rounds_16_51_body : i:nat -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_51_body i =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` i) Secret) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_msg2 (va_op_xmm_xmm 4) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 6) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_51_body (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_16_51_body i)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(ks:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) k_b in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 259 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) (16 `op_Multiply` i) Secret k_b i) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 260 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks i) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 260 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks i) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 262 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 263 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg2 (va_op_xmm_xmm 4) (va_op_xmm_xmm 3) (4 `op_Multiply` (i + 1)) block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 264 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (4 `op_Multiply` i) block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 265 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 266 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 267 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 268 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 269 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 6) (va_op_xmm_xmm 3) (4 `op_Multiply` (i + 3)) block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (4 `op_Multiply` i + 2) block
hash_orig) (va_QEmpty (())))))))))))))))
val va_lemma_Loop_rounds_16_51_body : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_51_body i) va_s0 /\ va_get_ok va_s0 /\
(sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ l_and (4 <= i) (i < 13) /\
Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b)
/\ Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` i) block hash_orig /\ l_and (l_and
(l_and (va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block)
(va_get_xmm 4 va_s0 == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4
`op_Multiply` (i + 1)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1) + 1)
block))) (va_get_xmm 5 va_s0 == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2))
block)) (va_get_xmm 6 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1))
block))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block hash_orig /\ va_get_xmm
4 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1)) block /\ va_get_xmm 5 va_sM
== Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2))
block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block) /\ va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block /\ va_get_xmm 3 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block) /\ va_state_eq va_sM (va_update_flags
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_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_51_body va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_flags; 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_ok] in
let va_qc = va_qcode_Loop_rounds_16_51_body va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_51_body i) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 219 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 251 column 78 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block hash_orig) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 253 column 42 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 4 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1)) block) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 254 column 87 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 5 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4
`op_Multiply` (i + 2)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 255 column 43 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 6 va_sM == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 256 column 40 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; 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_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_16_51_body (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret
/\ l_and (4 <= i) (i < 13) /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b) /\ Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0)
(va_get_xmm 2 va_s0) == Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` i) block
hash_orig /\ l_and (l_and (l_and (va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4
`op_Multiply` i) block) (va_get_xmm 4 va_s0 == Vale.Arch.Types.add_wrap_quad32
(Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 1)) block)
(Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1) + 1) block))) (va_get_xmm 5 va_s0 ==
Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2)) block)) (va_get_xmm 6 va_s0 ==
Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1)) block)) /\ (forall (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_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags
va_x_efl (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_s0)))))))) in va_get_ok va_sM /\ (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_sM) (va_get_xmm 2 va_sM) == Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1))
block hash_orig /\ va_get_xmm 4 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i +
1)) block /\ va_get_xmm 5 va_sM == Vale.Arch.Types.add_wrap_quad32
(Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2)) block)
(Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block) /\ va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block /\ va_get_xmm 3 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_51_body : i:nat -> k_b:buffer128 -> block:block_w ->
hash_orig:hash256 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_51_body i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_51_body i)
([va_Mod_flags; 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_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_51_body i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_51_body (va_code_Loop_rounds_16_51_body i) va_s0 i
k_b block hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags 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_ok va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_flags; 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_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_51_body (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_16_51_body i)) =
(va_QProc (va_code_Loop_rounds_16_51_body i) ([va_Mod_flags; 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_wp_Loop_rounds_16_51_body i k_b block hash_orig) (va_wpProof_Loop_rounds_16_51_body i k_b
block hash_orig))
//--
//-- Msg_shift
val va_code_Msg_shift : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Msg_shift () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
3) (va_op_xmm_xmm 4)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
5) (va_op_xmm_xmm 0)) (va_CNil ()))))))))
val va_codegen_success_Msg_shift : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Msg_shift () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 5) (va_op_xmm_xmm 0)) (va_ttrue ())))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Msg_shift (va_mods:va_mods_t) : (va_quickCode unit (va_code_Msg_shift ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 290 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 291 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 292 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 293 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 294 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 295 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 5) (va_op_xmm_xmm 0)) (va_QEmpty (())))))))))
val va_lemma_Msg_shift : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Msg_shift ()) va_s0 /\ va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_xmm 3 va_sM == va_get_xmm 4 va_s0 /\ va_get_xmm 4 va_sM == va_get_xmm 5 va_s0 /\
va_get_xmm 5 va_sM == va_get_xmm 6 va_s0 /\ va_get_xmm 6 va_sM == va_get_xmm 3 va_s0) /\
va_state_eq va_sM (va_update_xmm 0 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_ok va_sM
va_s0)))))))))
[@"opaque_to_smt"]
let va_lemma_Msg_shift va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_xmm 0; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4;
va_Mod_xmm 3; va_Mod_ok] in
let va_qc = va_qcode_Msg_shift va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Msg_shift ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 276 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 285 column 26 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 3 va_sM == va_get_xmm 4 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 286 column 26 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 4 va_sM == va_get_xmm 5 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 287 column 26 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 5 va_sM == va_get_xmm 6 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 288 column 26 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 6 va_sM == va_get_xmm 3 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 0; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4;
va_Mod_xmm 3; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Msg_shift (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm0:quad32) . let va_sM =
va_upd_xmm 0 va_x_xmm0 (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_s0))))) in va_get_ok va_sM /\ (va_get_xmm 3
va_sM == va_get_xmm 4 va_s0 /\ va_get_xmm 4 va_sM == va_get_xmm 5 va_s0 /\ va_get_xmm 5 va_sM
== va_get_xmm 6 va_s0 /\ va_get_xmm 6 va_sM == va_get_xmm 3 va_s0) ==> va_k va_sM (())))
val va_wpProof_Msg_shift : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Msg_shift va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Msg_shift ()) ([va_Mod_xmm 0;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Msg_shift va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Msg_shift (va_code_Msg_shift ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 0 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_ok va_sM
va_s0))))))));
va_lemma_norm_mods ([va_Mod_xmm 0; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4;
va_Mod_xmm 3]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Msg_shift () : (va_quickCode unit (va_code_Msg_shift ())) =
(va_QProc (va_code_Msg_shift ()) ([va_Mod_xmm 0; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3]) va_wp_Msg_shift va_wpProof_Msg_shift)
//--
//-- Loop_rounds_16_51_recursive
val va_code_Loop_rounds_16_51_recursive : i:nat -> Tot va_code(decreases %[i])
[@ "opaque_to_smt"]
let rec va_code_Loop_rounds_16_51_recursive i =
(va_Block (va_CCons (if (i > 4) then va_Block (va_CCons (va_code_Loop_rounds_16_51_recursive (i -
1)) (va_CNil ())) else va_Block (va_CNil ())) (va_CCons (va_code_Loop_rounds_16_51_body i)
(va_CCons (va_code_Msg_shift ()) (va_CNil ())))))
val va_codegen_success_Loop_rounds_16_51_recursive : i:nat -> Tot va_pbool(decreases %[i])
[@ "opaque_to_smt"]
let rec va_codegen_success_Loop_rounds_16_51_recursive i =
(va_pbool_and (if (i > 4) then va_pbool_and (va_codegen_success_Loop_rounds_16_51_recursive (i -
1)) (va_ttrue ()) else va_ttrue ()) (va_pbool_and (va_codegen_success_Loop_rounds_16_51_body i)
(va_pbool_and (va_codegen_success_Msg_shift ()) (va_ttrue ()))))
val va_lemma_Loop_rounds_16_51_recursive : va_b0:va_code -> va_s0:va_state -> i:nat ->
k_b:buffer128 -> block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)(decreases %[va_b0;va_s0;i;k_b;block;hash_orig])
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_51_recursive i) va_s0 /\ va_get_ok
va_s0 /\ (sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0
va_s0) (va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ l_and (4 <= i) (i <
13) /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_s0) k_b) /\ Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` 4) block hash_orig /\ l_and (l_and
(l_and (va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` 4) block)
(va_get_xmm 4 va_s0 == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4
`op_Multiply` (4 + 1)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (4 - 1) + 1)
block))) (va_get_xmm 5 va_s0 == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (4 + 2))
block)) (va_get_xmm 6 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (4 - 1))
block))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block hash_orig /\ va_get_xmm
3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1)) block /\ va_get_xmm 4 va_sM
== Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2))
block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block) /\ va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block /\ va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block) /\ va_state_eq va_sM (va_update_flags
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_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_Loop_rounds_16_51_recursive va_b0 va_s0 i k_b block hash_orig =
va_reveal_opaque (`%va_code_Loop_rounds_16_51_recursive) (va_code_Loop_rounds_16_51_recursive i);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b11 = va_tl va_b1 in
let va_c11 = va_hd va_b1 in
let (va_fc11, va_s11) =
(
if (i > 4) then
(
let va_b12 = va_get_block va_c11 in
let (va_s13, va_fc13) = va_lemma_Loop_rounds_16_51_recursive (va_hd va_b12) va_s0 (i - 1) k_b
block hash_orig in
let va_b13 = va_tl va_b12 in
let (va_s11, va_f13) = va_lemma_empty_total va_s13 va_b13 in
let va_fc11 = va_lemma_merge_total va_b12 va_s0 va_fc13 va_s13 va_f13 va_s11 in
(va_fc11, va_s11)
)
else
(
let va_b14 = va_get_block va_c11 in
let (va_s11, va_fc11) = va_lemma_empty_total va_s0 va_b14 in
(va_fc11, va_s11)
)
) in
let (va_s15, va_fc15) = va_lemma_Loop_rounds_16_51_body (va_hd va_b11) va_s11 i k_b block
hash_orig in
let va_b15 = va_tl va_b11 in
let (va_s16, va_fc16) = va_lemma_Msg_shift (va_hd va_b15) va_s15 in
let va_b16 = va_tl va_b15 in
let (va_sM, va_f16) = va_lemma_empty_total va_s16 va_b16 in
let va_f15 = va_lemma_merge_total va_b15 va_s15 va_fc16 va_s16 va_f16 va_sM in
let va_f11 = va_lemma_merge_total va_b11 va_s11 va_fc15 va_s15 va_f15 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc11 va_s11 va_f11 va_sM in
(va_sM, va_fM)
//--
//-- Loop_rounds_16_51
val va_code_Loop_rounds_16_51 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt"] | false | true | Vale.SHA.X64.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_code_Loop_rounds_16_51 : va_dummy:unit -> Tot va_code | [] | Vale.SHA.X64.va_code_Loop_rounds_16_51 | {
"file_name": "obj/Vale.SHA.X64.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | va_dummy: Prims.unit -> Vale.X64.Decls.va_code | {
"end_col": 77,
"end_line": 958,
"start_col": 2,
"start_line": 958
} |
Prims.Tot | val va_code_Preamble : va_dummy:unit -> Tot va_code | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": 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_code_Preamble () =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_CCons (va_code_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax))
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 2)
(va_op_xmm_xmm 2) 27) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_CCons
(va_code_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Shufpd (va_op_xmm_xmm
2) (va_op_xmm_xmm 0) 0) (va_CNil ()))))))))))) | val va_code_Preamble : va_dummy:unit -> Tot va_code
let va_code_Preamble () = | false | null | false | (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi)
0
Secret)
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 2)
(va_op_reg_opr64_reg64 rRdi)
16
Secret)
(va_CCons (va_code_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax))
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27)
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177)
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7))
(va_CCons (va_code_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_CCons (va_code_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0)
(va_CNil ()))))))))))) | {
"checked_file": "Vale.SHA.X64.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.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.InsStack.fsti.checked",
"Vale.X64.InsSha.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.SHA.SHA_helpers.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.X64.fst"
} | [
"total"
] | [
"Prims.unit",
"Vale.X64.Decls.va_Block",
"Vale.X64.Decls.va_CCons",
"Vale.X64.InsVector.va_code_Load128_buffer",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRdi",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.InsVector.va_code_InitPshufbStableMask",
"Vale.X64.Machine_s.rRax",
"Vale.X64.InsVector.va_code_Pshufd",
"Vale.X64.InsVector.va_code_Mov128",
"Vale.X64.InsVector.va_code_Palignr8",
"Vale.X64.InsVector.va_code_Shufpd",
"Vale.X64.Decls.va_CNil",
"Vale.X64.Decls.va_code"
] | [] | module Vale.SHA.X64
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsStack
open Vale.X64.InsVector
open Vale.X64.InsSha
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.SHA.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
#reset-options "--z3rlimit 40"
//-- Preamble
val va_code_Preamble : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr] | false | true | Vale.SHA.X64.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_code_Preamble : va_dummy:unit -> Tot va_code | [] | Vale.SHA.X64.va_code_Preamble | {
"file_name": "obj/Vale.SHA.X64.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | va_dummy: Prims.unit -> Vale.X64.Decls.va_code | {
"end_col": 50,
"end_line": 42,
"start_col": 2,
"start_line": 34
} |
Prims.Tot | val va_code_Msg_shift : va_dummy:unit -> Tot va_code | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": 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_code_Msg_shift () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
3) (va_op_xmm_xmm 4)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
5) (va_op_xmm_xmm 0)) (va_CNil ())))))))) | val va_code_Msg_shift : va_dummy:unit -> Tot va_code
let va_code_Msg_shift () = | false | null | false | (va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 7))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 5) (va_op_xmm_xmm 0)) (va_CNil ()))
)))))) | {
"checked_file": "Vale.SHA.X64.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.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.InsStack.fsti.checked",
"Vale.X64.InsSha.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.SHA.SHA_helpers.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.X64.fst"
} | [
"total"
] | [
"Prims.unit",
"Vale.X64.Decls.va_Block",
"Vale.X64.Decls.va_CCons",
"Vale.X64.InsVector.va_code_Mov128",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.Decls.va_CNil",
"Vale.X64.Decls.va_code"
] | [] | module Vale.SHA.X64
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsStack
open Vale.X64.InsVector
open Vale.X64.InsSha
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.SHA.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
#reset-options "--z3rlimit 40"
//-- Preamble
val va_code_Preamble : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Preamble () =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_CCons (va_code_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax))
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 2)
(va_op_xmm_xmm 2) 27) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_CCons
(va_code_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Shufpd (va_op_xmm_xmm
2) (va_op_xmm_xmm 0) 0) (va_CNil ())))))))))))
val va_codegen_success_Preamble : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Preamble () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_pbool_and (va_codegen_success_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27)
(va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (va_ttrue ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Preamble (va_mods:va_mods_t) (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abcd:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_s) in let (efgh:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 1
(va_get_mem_heaplet 0 va_s) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRdi) 0 Secret ctx_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64
rRdi) 16 Secret ctx_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 89 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 91 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 93 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 96 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 98 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (fun (va_s:va_state) _ -> va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 99 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(FStar.Seq.Base.equal #Vale.SHA.SHA_helpers.word (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s) (va_get_xmm 2 va_s)) (Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)) (va_QEmpty
(())))))))))))))
val va_lemma_Preamble : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Preamble ()) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled
/\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdi va_s0) ctx_b
2 (va_get_mem_layout va_s0) Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ (let abcd =
Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm
1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 8 va_sM (va_update_xmm 7 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_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_Preamble va_b0 va_s0 ctx_b =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok] in
let va_qc = va_qcode_Preamble va_mods ctx_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Preamble ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 57 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 74 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 75 column 72 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 80 column 63 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm
1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Preamble (ctx_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRdi va_s0) ctx_b 2 (va_get_mem_layout va_s0) Secret) /\ (forall (va_x_rax:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (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_s0)))))) in va_get_ok va_sM /\ (va_get_xmm 7 va_sM == va_get_xmm
8 va_sM /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087
134810123 202182159 /\ (let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_sM) in let efgh = Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in
l_and (l_and (va_get_xmm 1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) ==> va_k va_sM (())))
val va_wpProof_Preamble : ctx_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Preamble ctx_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Preamble ()) ([va_Mod_flags;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Preamble ctx_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Preamble (va_code_Preamble ()) va_s0 ctx_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 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_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Preamble (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble ())) =
(va_QProc (va_code_Preamble ()) ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax]) (va_wp_Preamble ctx_b) (va_wpProof_Preamble
ctx_b))
//--
//-- Loop_rounds_0_15
val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rRsi) 0 Secret)
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4)
(va_op_reg_opr64_reg64 rRsi) 16 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 5) (va_op_reg_opr64_reg64 rRsi) 32 Secret)
(va_CCons (va_code_PshufbStable (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6)
(va_op_reg_opr64_reg64 rRsi) 48 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRcx) 0 Secret)
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3))
(va_CCons (va_code_PshufbStable (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 9)
(va_op_xmm_xmm 1)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 16 Secret) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_CCons (va_code_PshufbStable
(va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rRsi)
(va_const_opr64 64)) (va_CCons (va_code_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0)
(va_op_xmm_xmm 5)) (va_CCons (va_code_PshufbStable (va_op_xmm_xmm 6) (va_op_xmm_xmm 7))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm
7) (va_op_xmm_xmm 5)) (va_CCons (va_code_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_CCons
(va_code_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_CCons (va_code_SHA256_rnds2
(va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRcx) 48 Secret)
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 6))
(va_CCons (va_code_SHA256_msg2 (va_op_xmm_xmm 3) (va_op_xmm_xmm 6)) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 7)
(va_op_xmm_xmm 3)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_CCons (va_code_SHA256_msg1
(va_op_xmm_xmm 5) (va_op_xmm_xmm 6)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 2)) (va_CNil ()))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_codegen_success_Loop_rounds_0_15 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3)
(va_op_reg_opr64_reg64 rRsi) 0 Secret) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64 rRsi) 16 Secret)
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
5) (va_op_reg_opr64_reg64 rRsi) 32 Secret) (va_pbool_and (va_codegen_success_PshufbStable
(va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6) (va_op_reg_opr64_reg64 rRsi) 48 Secret)
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
0) (va_op_reg_opr64_reg64 rRcx) 0 Secret) (va_pbool_and (va_codegen_success_Paddd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_PshufbStable
(va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0)
14) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 16 Secret) (va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm
0) (va_op_xmm_xmm 4)) (va_pbool_and (va_codegen_success_PshufbStable (va_op_xmm_xmm 5)
(va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0)
14) (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rRsi) (va_const_opr64 64))
(va_pbool_and (va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
0) (va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Paddd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PshufbStable
(va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_SHA256_rnds2
(va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0)
(va_op_xmm_xmm 0) 14) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm
6)) (va_pbool_and (va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 48 Secret) (va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm
0) (va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_SHA256_msg2 (va_op_xmm_xmm 3)
(va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0)
14) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_ttrue
()))))))))))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (k_b:buffer128) (offset:nat) :
(va_quickCode unit (va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 146 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_1582 (s_1583:(FStar.Seq.Base.seq a_1582)) (i_1584:Prims.nat) (j_1585:Prims.nat) -> let
(j_1545:Prims.nat) = j_1585 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1584
j_1545) (Prims.op_LessThanOrEqual j_1545 (FStar.Seq.Base.length #a_1582 s_1583))))
Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s) in_b) offset
(offset + 4)) (fun _ -> let (input_LE:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) =
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) in_b) offset (offset + 4) in let (input_BE:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let
(block:block_w) = Vale.SHA.SHA_helpers.quads_to_block input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 149 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_quads_to_block input_BE) (let
(hash_orig:Vale.SHA.SHA_helpers.hash256) = Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s)
(va_get_xmm 2 va_s) in let (va_arg79:Vale.SHA.SHA_helpers.block_w) = block in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 153 column 30 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_repeat_range_0_vale va_arg79 hash_orig) (let
(ks:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) k_b in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 158 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64
rRsi) 0 Secret in_b (offset + 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 159 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64
rRsi) 16 Secret in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 160 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 5) (va_op_reg_opr64_reg64
rRsi) 32 Secret in_b (offset + 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 161 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 162 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 162 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 3 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 0) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 163 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6) (va_op_reg_opr64_reg64
rRsi) 48 Secret in_b (offset + 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 165 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 0 Secret k_b 0) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 166 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 166 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 167 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 169 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 170 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 170 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 4 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 1) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 171 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 174 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 0 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 175 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 176 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 177 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 2 block hash_orig) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 180 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 16 Secret k_b 1) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 181 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 181 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 182 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 183 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 184 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 184 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 5 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 2) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 185 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 4 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 186 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 187 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rRsi) (va_const_opr64 64)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4) 16 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 189 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 6 block hash_orig) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 192 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 32 Secret k_b 2) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 193 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 193 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 195 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 196 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 196 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 6 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 3) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 197 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 8 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 200 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5) 20 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 203 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 10 block hash_orig) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 206 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 48 Secret k_b 3) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 207 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 207 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 209 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg2 (va_op_xmm_xmm 3) (va_op_xmm_xmm 6) 16 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 210 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 12 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 211 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 212 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 213 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 214 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) 24 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 216 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 14 block hash_orig) (va_QEmpty
(())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Loop_rounds_0_15 : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> k_b:buffer128
-> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_15 ()) va_s0 /\ va_get_ok va_s0 /\
(sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0
va_s0) (va_get_reg64 rRsi va_s0) in_b offset 4 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRsi va_s0 + 64 < pow2_64 /\ va_get_xmm 7
va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\
Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0)
k_b))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64 /\ (let input_LE =
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) in_b) offset (offset + 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let (block:block_w) =
Vale.SHA.SHA_helpers.quads_to_block input_BE in l_and (l_and (l_and (l_and
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale 16 block (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0))) (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 16 block))
(va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 20
block) (Vale.SHA.SHA_helpers.ws_quad32 13 block))) (va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial 24 block)) (va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 12 block)) /\ va_get_xmm 9 va_sM == va_get_xmm 1 va_s0 /\
va_get_xmm 10 va_sM == va_get_xmm 2 va_s0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 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 rRsi va_sM (va_update_ok va_sM
va_s0)))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b k_b offset =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b k_b offset in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 128 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 138 column 37 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) in_b) offset (offset + 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let (block:block_w) =
Vale.SHA.SHA_helpers.quads_to_block input_BE in l_and (l_and (l_and (l_and
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale 16 block (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0))) (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 16 block))
(va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 20
block) (Vale.SHA.SHA_helpers.ws_quad32 13 block))) (va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial 24 block)) (va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 12 block)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 141 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 9 va_sM == va_get_xmm 1 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 142 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 10 va_sM == va_get_xmm 2 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_0_15 (in_b:buffer128) (k_b:buffer128) (offset:nat) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_s0) in_b offset 4 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx
va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRsi va_s0 + 64 < pow2_64 /\
va_get_xmm 7 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159 /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_s0) k_b)) /\ (forall (va_x_rsi: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_xmm9:quad32) (va_x_xmm10:quad32) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (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
rRsi va_x_rsi va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg64 rRsi va_sM == va_get_reg64
rRsi va_s0 + 64 /\ (let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) in_b) offset (offset + 4) in let
input_BE = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let (block:block_w) =
Vale.SHA.SHA_helpers.quads_to_block input_BE in l_and (l_and (l_and (l_and
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale 16 block (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0))) (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 16 block))
(va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 20
block) (Vale.SHA.SHA_helpers.ws_quad32 13 block))) (va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial 24 block)) (va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 12 block)) /\ va_get_xmm 9 va_sM == va_get_xmm 1 va_s0 /\
va_get_xmm 10 va_sM == va_get_xmm 2 va_s0) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_0_15 : in_b:buffer128 -> k_b:buffer128 -> offset:nat -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_15 in_b k_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_15 ()) ([va_Mod_flags;
va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b k_b offset va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b k_b
offset in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 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 rRsi va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_15 (in_b:buffer128) (k_b:buffer128) (offset:nat) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(va_QProc (va_code_Loop_rounds_0_15 ()) ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi]) (va_wp_Loop_rounds_0_15 in_b k_b offset)
(va_wpProof_Loop_rounds_0_15 in_b k_b offset))
//--
//-- Loop_rounds_16_51_body
val va_code_Loop_rounds_16_51_body : i:nat -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_51_body i =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` i) Secret) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_msg2
(va_op_xmm_xmm 4) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm
7) (va_op_xmm_xmm 3)) (va_CCons (va_code_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_CCons
(va_code_SHA256_msg1 (va_op_xmm_xmm 6) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_rnds2
(va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CNil ())))))))))))))
val va_codegen_success_Loop_rounds_16_51_body : i:nat -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_51_body i =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` i) Secret) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_msg2 (va_op_xmm_xmm 4) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 6) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_51_body (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_16_51_body i)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(ks:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) k_b in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 259 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) (16 `op_Multiply` i) Secret k_b i) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 260 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks i) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 260 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks i) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 262 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 263 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg2 (va_op_xmm_xmm 4) (va_op_xmm_xmm 3) (4 `op_Multiply` (i + 1)) block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 264 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (4 `op_Multiply` i) block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 265 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 266 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 267 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 268 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 269 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 6) (va_op_xmm_xmm 3) (4 `op_Multiply` (i + 3)) block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (4 `op_Multiply` i + 2) block
hash_orig) (va_QEmpty (())))))))))))))))
val va_lemma_Loop_rounds_16_51_body : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_51_body i) va_s0 /\ va_get_ok va_s0 /\
(sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ l_and (4 <= i) (i < 13) /\
Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b)
/\ Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` i) block hash_orig /\ l_and (l_and
(l_and (va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block)
(va_get_xmm 4 va_s0 == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4
`op_Multiply` (i + 1)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1) + 1)
block))) (va_get_xmm 5 va_s0 == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2))
block)) (va_get_xmm 6 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1))
block))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block hash_orig /\ va_get_xmm
4 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1)) block /\ va_get_xmm 5 va_sM
== Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2))
block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block) /\ va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block /\ va_get_xmm 3 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block) /\ va_state_eq va_sM (va_update_flags
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_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_51_body va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_flags; 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_ok] in
let va_qc = va_qcode_Loop_rounds_16_51_body va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_51_body i) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 219 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 251 column 78 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block hash_orig) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 253 column 42 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 4 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1)) block) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 254 column 87 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 5 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4
`op_Multiply` (i + 2)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 255 column 43 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 6 va_sM == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 256 column 40 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; 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_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_16_51_body (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret
/\ l_and (4 <= i) (i < 13) /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b) /\ Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0)
(va_get_xmm 2 va_s0) == Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` i) block
hash_orig /\ l_and (l_and (l_and (va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4
`op_Multiply` i) block) (va_get_xmm 4 va_s0 == Vale.Arch.Types.add_wrap_quad32
(Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 1)) block)
(Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1) + 1) block))) (va_get_xmm 5 va_s0 ==
Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2)) block)) (va_get_xmm 6 va_s0 ==
Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1)) block)) /\ (forall (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_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags
va_x_efl (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_s0)))))))) in va_get_ok va_sM /\ (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_sM) (va_get_xmm 2 va_sM) == Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1))
block hash_orig /\ va_get_xmm 4 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i +
1)) block /\ va_get_xmm 5 va_sM == Vale.Arch.Types.add_wrap_quad32
(Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2)) block)
(Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block) /\ va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block /\ va_get_xmm 3 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_51_body : i:nat -> k_b:buffer128 -> block:block_w ->
hash_orig:hash256 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_51_body i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_51_body i)
([va_Mod_flags; 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_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_51_body i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_51_body (va_code_Loop_rounds_16_51_body i) va_s0 i
k_b block hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags 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_ok va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_flags; 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_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_51_body (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_16_51_body i)) =
(va_QProc (va_code_Loop_rounds_16_51_body i) ([va_Mod_flags; 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_wp_Loop_rounds_16_51_body i k_b block hash_orig) (va_wpProof_Loop_rounds_16_51_body i k_b
block hash_orig))
//--
//-- Msg_shift
val va_code_Msg_shift : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr] | false | true | Vale.SHA.X64.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_code_Msg_shift : va_dummy:unit -> Tot va_code | [] | Vale.SHA.X64.va_code_Msg_shift | {
"file_name": "obj/Vale.SHA.X64.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | va_dummy: Prims.unit -> Vale.X64.Decls.va_code | {
"end_col": 45,
"end_line": 780,
"start_col": 2,
"start_line": 776
} |
Prims.Tot | val va_codegen_success_Loop_while0 : va_dummy:unit -> Tot va_pbool | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": 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_codegen_success_Loop_while0 () =
(va_pbool_and (va_codegen_success_Loop_body0 ()) (va_ttrue ())) | val va_codegen_success_Loop_while0 : va_dummy:unit -> Tot va_pbool
let va_codegen_success_Loop_while0 () = | false | null | false | (va_pbool_and (va_codegen_success_Loop_body0 ()) (va_ttrue ())) | {
"checked_file": "Vale.SHA.X64.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.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.InsStack.fsti.checked",
"Vale.X64.InsSha.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.SHA.SHA_helpers.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.X64.fst"
} | [
"total"
] | [
"Prims.unit",
"Vale.X64.Decls.va_pbool_and",
"Vale.SHA.X64.va_codegen_success_Loop_body0",
"Vale.X64.Decls.va_ttrue",
"Vale.X64.Decls.va_pbool"
] | [] | module Vale.SHA.X64
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsStack
open Vale.X64.InsVector
open Vale.X64.InsSha
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.SHA.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
#reset-options "--z3rlimit 40"
//-- Preamble
val va_code_Preamble : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Preamble () =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_CCons (va_code_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax))
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 2)
(va_op_xmm_xmm 2) 27) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_CCons
(va_code_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Shufpd (va_op_xmm_xmm
2) (va_op_xmm_xmm 0) 0) (va_CNil ())))))))))))
val va_codegen_success_Preamble : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Preamble () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_pbool_and (va_codegen_success_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27)
(va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (va_ttrue ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Preamble (va_mods:va_mods_t) (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abcd:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_s) in let (efgh:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 1
(va_get_mem_heaplet 0 va_s) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRdi) 0 Secret ctx_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64
rRdi) 16 Secret ctx_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 89 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 91 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 93 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 96 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 98 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (fun (va_s:va_state) _ -> va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 99 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(FStar.Seq.Base.equal #Vale.SHA.SHA_helpers.word (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s) (va_get_xmm 2 va_s)) (Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)) (va_QEmpty
(())))))))))))))
val va_lemma_Preamble : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Preamble ()) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled
/\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdi va_s0) ctx_b
2 (va_get_mem_layout va_s0) Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ (let abcd =
Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm
1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 8 va_sM (va_update_xmm 7 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_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_Preamble va_b0 va_s0 ctx_b =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok] in
let va_qc = va_qcode_Preamble va_mods ctx_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Preamble ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 57 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 74 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 75 column 72 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 80 column 63 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm
1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Preamble (ctx_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRdi va_s0) ctx_b 2 (va_get_mem_layout va_s0) Secret) /\ (forall (va_x_rax:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (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_s0)))))) in va_get_ok va_sM /\ (va_get_xmm 7 va_sM == va_get_xmm
8 va_sM /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087
134810123 202182159 /\ (let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_sM) in let efgh = Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in
l_and (l_and (va_get_xmm 1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) ==> va_k va_sM (())))
val va_wpProof_Preamble : ctx_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Preamble ctx_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Preamble ()) ([va_Mod_flags;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Preamble ctx_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Preamble (va_code_Preamble ()) va_s0 ctx_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 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_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Preamble (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble ())) =
(va_QProc (va_code_Preamble ()) ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax]) (va_wp_Preamble ctx_b) (va_wpProof_Preamble
ctx_b))
//--
//-- Loop_rounds_0_15
val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rRsi) 0 Secret)
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4)
(va_op_reg_opr64_reg64 rRsi) 16 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 5) (va_op_reg_opr64_reg64 rRsi) 32 Secret)
(va_CCons (va_code_PshufbStable (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6)
(va_op_reg_opr64_reg64 rRsi) 48 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRcx) 0 Secret)
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3))
(va_CCons (va_code_PshufbStable (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 9)
(va_op_xmm_xmm 1)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 16 Secret) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_CCons (va_code_PshufbStable
(va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rRsi)
(va_const_opr64 64)) (va_CCons (va_code_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0)
(va_op_xmm_xmm 5)) (va_CCons (va_code_PshufbStable (va_op_xmm_xmm 6) (va_op_xmm_xmm 7))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm
7) (va_op_xmm_xmm 5)) (va_CCons (va_code_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_CCons
(va_code_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_CCons (va_code_SHA256_rnds2
(va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRcx) 48 Secret)
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 6))
(va_CCons (va_code_SHA256_msg2 (va_op_xmm_xmm 3) (va_op_xmm_xmm 6)) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 7)
(va_op_xmm_xmm 3)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_CCons (va_code_SHA256_msg1
(va_op_xmm_xmm 5) (va_op_xmm_xmm 6)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 2)) (va_CNil ()))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_codegen_success_Loop_rounds_0_15 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3)
(va_op_reg_opr64_reg64 rRsi) 0 Secret) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64 rRsi) 16 Secret)
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
5) (va_op_reg_opr64_reg64 rRsi) 32 Secret) (va_pbool_and (va_codegen_success_PshufbStable
(va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6) (va_op_reg_opr64_reg64 rRsi) 48 Secret)
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
0) (va_op_reg_opr64_reg64 rRcx) 0 Secret) (va_pbool_and (va_codegen_success_Paddd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_PshufbStable
(va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0)
14) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 16 Secret) (va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm
0) (va_op_xmm_xmm 4)) (va_pbool_and (va_codegen_success_PshufbStable (va_op_xmm_xmm 5)
(va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0)
14) (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rRsi) (va_const_opr64 64))
(va_pbool_and (va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
0) (va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Paddd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PshufbStable
(va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_SHA256_rnds2
(va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0)
(va_op_xmm_xmm 0) 14) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm
6)) (va_pbool_and (va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 48 Secret) (va_pbool_and (va_codegen_success_Paddd (va_op_xmm_xmm
0) (va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_SHA256_msg2 (va_op_xmm_xmm 3)
(va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0)
14) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_ttrue
()))))))))))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (k_b:buffer128) (offset:nat) :
(va_quickCode unit (va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 146 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_1582 (s_1583:(FStar.Seq.Base.seq a_1582)) (i_1584:Prims.nat) (j_1585:Prims.nat) -> let
(j_1545:Prims.nat) = j_1585 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1584
j_1545) (Prims.op_LessThanOrEqual j_1545 (FStar.Seq.Base.length #a_1582 s_1583))))
Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s) in_b) offset
(offset + 4)) (fun _ -> let (input_LE:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) =
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) in_b) offset (offset + 4) in let (input_BE:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let
(block:block_w) = Vale.SHA.SHA_helpers.quads_to_block input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 149 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_quads_to_block input_BE) (let
(hash_orig:Vale.SHA.SHA_helpers.hash256) = Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s)
(va_get_xmm 2 va_s) in let (va_arg79:Vale.SHA.SHA_helpers.block_w) = block in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 153 column 30 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_repeat_range_0_vale va_arg79 hash_orig) (let
(ks:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) k_b in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 158 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64
rRsi) 0 Secret in_b (offset + 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 159 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64
rRsi) 16 Secret in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 160 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 5) (va_op_reg_opr64_reg64
rRsi) 32 Secret in_b (offset + 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 161 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 162 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 162 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 3 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 0) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 163 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6) (va_op_reg_opr64_reg64
rRsi) 48 Secret in_b (offset + 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 165 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 0 Secret k_b 0) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 166 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 0) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 166 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 167 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 169 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 170 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 170 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 4 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 1) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 171 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 174 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 0 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 175 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 176 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 177 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 2 block hash_orig) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 180 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 16 Secret k_b 1) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 181 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 181 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 182 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 183 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 184 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 184 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 5 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 2) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 185 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 4 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 186 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 187 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rRsi) (va_const_opr64 64)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4) 16 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 189 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 6 block hash_orig) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 192 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 32 Secret k_b 2) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 193 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 193 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 195 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_PshufbStable (va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (fun (va_s:va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 196 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.Def.Types_s.quad32 input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 196 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 6 va_s == FStar.Seq.Base.index #Vale.Def.Types_s.quad32 input_BE 3) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 197 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 8 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 200 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5) 20 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 203 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 10 block hash_orig) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 206 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 48 Secret k_b 3) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 207 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 207 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 209 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg2 (va_op_xmm_xmm 3) (va_op_xmm_xmm 6) 16 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 210 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) 12 block hash_orig) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 211 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 212 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 213 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 214 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 215 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) 24 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 216 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) 14 block hash_orig) (va_QEmpty
(())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Loop_rounds_0_15 : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> k_b:buffer128
-> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_15 ()) va_s0 /\ va_get_ok va_s0 /\
(sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0
va_s0) (va_get_reg64 rRsi va_s0) in_b offset 4 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRsi va_s0 + 64 < pow2_64 /\ va_get_xmm 7
va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\
Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0)
k_b))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64 /\ (let input_LE =
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) in_b) offset (offset + 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let (block:block_w) =
Vale.SHA.SHA_helpers.quads_to_block input_BE in l_and (l_and (l_and (l_and
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale 16 block (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0))) (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 16 block))
(va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 20
block) (Vale.SHA.SHA_helpers.ws_quad32 13 block))) (va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial 24 block)) (va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 12 block)) /\ va_get_xmm 9 va_sM == va_get_xmm 1 va_s0 /\
va_get_xmm 10 va_sM == va_get_xmm 2 va_s0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 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 rRsi va_sM (va_update_ok va_sM
va_s0)))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b k_b offset =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b k_b offset in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 128 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 138 column 37 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) in_b) offset (offset + 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let (block:block_w) =
Vale.SHA.SHA_helpers.quads_to_block input_BE in l_and (l_and (l_and (l_and
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale 16 block (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0))) (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 16 block))
(va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 20
block) (Vale.SHA.SHA_helpers.ws_quad32 13 block))) (va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial 24 block)) (va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 12 block)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 141 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 9 va_sM == va_get_xmm 1 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 142 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 10 va_sM == va_get_xmm 2 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_0_15 (in_b:buffer128) (k_b:buffer128) (offset:nat) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_s0) in_b offset 4 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx
va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRsi va_s0 + 64 < pow2_64 /\
va_get_xmm 7 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159 /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_s0) k_b)) /\ (forall (va_x_rsi: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_xmm9:quad32) (va_x_xmm10:quad32) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (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
rRsi va_x_rsi va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg64 rRsi va_sM == va_get_reg64
rRsi va_s0 + 64 /\ (let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) in_b) offset (offset + 4) in let
input_BE = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let (block:block_w) =
Vale.SHA.SHA_helpers.quads_to_block input_BE in l_and (l_and (l_and (l_and
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale 16 block (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0))) (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 16 block))
(va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 20
block) (Vale.SHA.SHA_helpers.ws_quad32 13 block))) (va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial 24 block)) (va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 12 block)) /\ va_get_xmm 9 va_sM == va_get_xmm 1 va_s0 /\
va_get_xmm 10 va_sM == va_get_xmm 2 va_s0) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_0_15 : in_b:buffer128 -> k_b:buffer128 -> offset:nat -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_15 in_b k_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_15 ()) ([va_Mod_flags;
va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b k_b offset va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b k_b
offset in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 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 rRsi va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_15 (in_b:buffer128) (k_b:buffer128) (offset:nat) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(va_QProc (va_code_Loop_rounds_0_15 ()) ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRsi]) (va_wp_Loop_rounds_0_15 in_b k_b offset)
(va_wpProof_Loop_rounds_0_15 in_b k_b offset))
//--
//-- Loop_rounds_16_51_body
val va_code_Loop_rounds_16_51_body : i:nat -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_51_body i =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` i) Secret) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_msg2
(va_op_xmm_xmm 4) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm
7) (va_op_xmm_xmm 3)) (va_CCons (va_code_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_CCons
(va_code_SHA256_msg1 (va_op_xmm_xmm 6) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_rnds2
(va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CNil ())))))))))))))
val va_codegen_success_Loop_rounds_16_51_body : i:nat -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_51_body i =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` i) Secret) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_msg2 (va_op_xmm_xmm 4) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_SHA256_msg1 (va_op_xmm_xmm 6) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_51_body (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_16_51_body i)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(ks:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) k_b in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 259 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) (16 `op_Multiply` i) Secret k_b i) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 260 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks i) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 260 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks i) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 262 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 263 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg2 (va_op_xmm_xmm 4) (va_op_xmm_xmm 3) (4 `op_Multiply` (i + 1)) block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 264 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (4 `op_Multiply` i) block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 265 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 266 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 267 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 268 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 269 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg1 (va_op_xmm_xmm 6) (va_op_xmm_xmm 3) (4 `op_Multiply` (i + 3)) block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (4 `op_Multiply` i + 2) block
hash_orig) (va_QEmpty (())))))))))))))))
val va_lemma_Loop_rounds_16_51_body : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_51_body i) va_s0 /\ va_get_ok va_s0 /\
(sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ l_and (4 <= i) (i < 13) /\
Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b)
/\ Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` i) block hash_orig /\ l_and (l_and
(l_and (va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block)
(va_get_xmm 4 va_s0 == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4
`op_Multiply` (i + 1)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1) + 1)
block))) (va_get_xmm 5 va_s0 == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2))
block)) (va_get_xmm 6 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1))
block))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block hash_orig /\ va_get_xmm
4 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1)) block /\ va_get_xmm 5 va_sM
== Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2))
block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block) /\ va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block /\ va_get_xmm 3 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block) /\ va_state_eq va_sM (va_update_flags
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_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_51_body va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_flags; 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_ok] in
let va_qc = va_qcode_Loop_rounds_16_51_body va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_51_body i) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 219 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 251 column 78 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block hash_orig) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 253 column 42 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 4 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1)) block) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 254 column 87 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 5 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4
`op_Multiply` (i + 2)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 255 column 43 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 6 va_sM == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 256 column 40 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; 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_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_16_51_body (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret
/\ l_and (4 <= i) (i < 13) /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b) /\ Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0)
(va_get_xmm 2 va_s0) == Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` i) block
hash_orig /\ l_and (l_and (l_and (va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4
`op_Multiply` i) block) (va_get_xmm 4 va_s0 == Vale.Arch.Types.add_wrap_quad32
(Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 1)) block)
(Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1) + 1) block))) (va_get_xmm 5 va_s0 ==
Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2)) block)) (va_get_xmm 6 va_s0 ==
Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1)) block)) /\ (forall (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_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags
va_x_efl (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_s0)))))))) in va_get_ok va_sM /\ (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_sM) (va_get_xmm 2 va_sM) == Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1))
block hash_orig /\ va_get_xmm 4 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i +
1)) block /\ va_get_xmm 5 va_sM == Vale.Arch.Types.add_wrap_quad32
(Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2)) block)
(Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block) /\ va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block /\ va_get_xmm 3 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_51_body : i:nat -> k_b:buffer128 -> block:block_w ->
hash_orig:hash256 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_51_body i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_51_body i)
([va_Mod_flags; 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_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_51_body i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_51_body (va_code_Loop_rounds_16_51_body i) va_s0 i
k_b block hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags 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_ok va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_flags; 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_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_51_body (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_16_51_body i)) =
(va_QProc (va_code_Loop_rounds_16_51_body i) ([va_Mod_flags; 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_wp_Loop_rounds_16_51_body i k_b block hash_orig) (va_wpProof_Loop_rounds_16_51_body i k_b
block hash_orig))
//--
//-- Msg_shift
val va_code_Msg_shift : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Msg_shift () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
3) (va_op_xmm_xmm 4)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
5) (va_op_xmm_xmm 0)) (va_CNil ()))))))))
val va_codegen_success_Msg_shift : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Msg_shift () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 5) (va_op_xmm_xmm 0)) (va_ttrue ())))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Msg_shift (va_mods:va_mods_t) : (va_quickCode unit (va_code_Msg_shift ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 290 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 291 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 292 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 293 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 294 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 295 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 5) (va_op_xmm_xmm 0)) (va_QEmpty (())))))))))
val va_lemma_Msg_shift : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Msg_shift ()) va_s0 /\ va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_xmm 3 va_sM == va_get_xmm 4 va_s0 /\ va_get_xmm 4 va_sM == va_get_xmm 5 va_s0 /\
va_get_xmm 5 va_sM == va_get_xmm 6 va_s0 /\ va_get_xmm 6 va_sM == va_get_xmm 3 va_s0) /\
va_state_eq va_sM (va_update_xmm 0 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_ok va_sM
va_s0)))))))))
[@"opaque_to_smt"]
let va_lemma_Msg_shift va_b0 va_s0 =
let (va_mods:va_mods_t) = [va_Mod_xmm 0; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4;
va_Mod_xmm 3; va_Mod_ok] in
let va_qc = va_qcode_Msg_shift va_mods in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Msg_shift ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 276 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 285 column 26 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 3 va_sM == va_get_xmm 4 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 286 column 26 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 4 va_sM == va_get_xmm 5 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 287 column 26 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 5 va_sM == va_get_xmm 6 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 288 column 26 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 6 va_sM == va_get_xmm 3 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 0; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4;
va_Mod_xmm 3; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Msg_shift (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm0:quad32) . let va_sM =
va_upd_xmm 0 va_x_xmm0 (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_s0))))) in va_get_ok va_sM /\ (va_get_xmm 3
va_sM == va_get_xmm 4 va_s0 /\ va_get_xmm 4 va_sM == va_get_xmm 5 va_s0 /\ va_get_xmm 5 va_sM
== va_get_xmm 6 va_s0 /\ va_get_xmm 6 va_sM == va_get_xmm 3 va_s0) ==> va_k va_sM (())))
val va_wpProof_Msg_shift : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Msg_shift va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Msg_shift ()) ([va_Mod_xmm 0;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Msg_shift va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Msg_shift (va_code_Msg_shift ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 0 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_ok va_sM
va_s0))))))));
va_lemma_norm_mods ([va_Mod_xmm 0; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4;
va_Mod_xmm 3]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Msg_shift () : (va_quickCode unit (va_code_Msg_shift ())) =
(va_QProc (va_code_Msg_shift ()) ([va_Mod_xmm 0; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3]) va_wp_Msg_shift va_wpProof_Msg_shift)
//--
//-- Loop_rounds_16_51_recursive
val va_code_Loop_rounds_16_51_recursive : i:nat -> Tot va_code(decreases %[i])
[@ "opaque_to_smt"]
let rec va_code_Loop_rounds_16_51_recursive i =
(va_Block (va_CCons (if (i > 4) then va_Block (va_CCons (va_code_Loop_rounds_16_51_recursive (i -
1)) (va_CNil ())) else va_Block (va_CNil ())) (va_CCons (va_code_Loop_rounds_16_51_body i)
(va_CCons (va_code_Msg_shift ()) (va_CNil ())))))
val va_codegen_success_Loop_rounds_16_51_recursive : i:nat -> Tot va_pbool(decreases %[i])
[@ "opaque_to_smt"]
let rec va_codegen_success_Loop_rounds_16_51_recursive i =
(va_pbool_and (if (i > 4) then va_pbool_and (va_codegen_success_Loop_rounds_16_51_recursive (i -
1)) (va_ttrue ()) else va_ttrue ()) (va_pbool_and (va_codegen_success_Loop_rounds_16_51_body i)
(va_pbool_and (va_codegen_success_Msg_shift ()) (va_ttrue ()))))
val va_lemma_Loop_rounds_16_51_recursive : va_b0:va_code -> va_s0:va_state -> i:nat ->
k_b:buffer128 -> block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)(decreases %[va_b0;va_s0;i;k_b;block;hash_orig])
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_51_recursive i) va_s0 /\ va_get_ok
va_s0 /\ (sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0
va_s0) (va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ l_and (4 <= i) (i <
13) /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_s0) k_b) /\ Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` 4) block hash_orig /\ l_and (l_and
(l_and (va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` 4) block)
(va_get_xmm 4 va_s0 == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4
`op_Multiply` (4 + 1)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (4 - 1) + 1)
block))) (va_get_xmm 5 va_s0 == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (4 + 2))
block)) (va_get_xmm 6 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (4 - 1))
block))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block hash_orig /\ va_get_xmm
3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1)) block /\ va_get_xmm 4 va_sM
== Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2))
block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block) /\ va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block /\ va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block) /\ va_state_eq va_sM (va_update_flags
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_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_Loop_rounds_16_51_recursive va_b0 va_s0 i k_b block hash_orig =
va_reveal_opaque (`%va_code_Loop_rounds_16_51_recursive) (va_code_Loop_rounds_16_51_recursive i);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b11 = va_tl va_b1 in
let va_c11 = va_hd va_b1 in
let (va_fc11, va_s11) =
(
if (i > 4) then
(
let va_b12 = va_get_block va_c11 in
let (va_s13, va_fc13) = va_lemma_Loop_rounds_16_51_recursive (va_hd va_b12) va_s0 (i - 1) k_b
block hash_orig in
let va_b13 = va_tl va_b12 in
let (va_s11, va_f13) = va_lemma_empty_total va_s13 va_b13 in
let va_fc11 = va_lemma_merge_total va_b12 va_s0 va_fc13 va_s13 va_f13 va_s11 in
(va_fc11, va_s11)
)
else
(
let va_b14 = va_get_block va_c11 in
let (va_s11, va_fc11) = va_lemma_empty_total va_s0 va_b14 in
(va_fc11, va_s11)
)
) in
let (va_s15, va_fc15) = va_lemma_Loop_rounds_16_51_body (va_hd va_b11) va_s11 i k_b block
hash_orig in
let va_b15 = va_tl va_b11 in
let (va_s16, va_fc16) = va_lemma_Msg_shift (va_hd va_b15) va_s15 in
let va_b16 = va_tl va_b15 in
let (va_sM, va_f16) = va_lemma_empty_total va_s16 va_b16 in
let va_f15 = va_lemma_merge_total va_b15 va_s15 va_fc16 va_s16 va_f16 va_sM in
let va_f11 = va_lemma_merge_total va_b11 va_s11 va_fc15 va_s15 va_f15 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc11 va_s11 va_f11 va_sM in
(va_sM, va_fM)
//--
//-- Loop_rounds_16_51
val va_code_Loop_rounds_16_51 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt"]
let va_code_Loop_rounds_16_51 () =
(va_Block (va_CCons (va_code_Loop_rounds_16_51_recursive 12) (va_CNil ())))
val va_codegen_success_Loop_rounds_16_51 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt"]
let va_codegen_success_Loop_rounds_16_51 () =
(va_pbool_and (va_codegen_success_Loop_rounds_16_51_recursive 12) (va_ttrue ()))
val va_lemma_Loop_rounds_16_51 : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 -> block:block_w
-> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_51 ()) va_s0 /\ va_get_ok va_s0 /\
(sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\
Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b)
/\ Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` 4) block hash_orig /\ l_and (l_and
(l_and (va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` 4) block)
(va_get_xmm 4 va_s0 == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4
`op_Multiply` (4 + 1)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (4 - 1) + 1)
block))) (va_get_xmm 5 va_s0 == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (4 + 2))
block)) (va_get_xmm 6 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (4 - 1))
block))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let i = 12 in Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block hash_orig /\ va_get_xmm
3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1)) block /\ va_get_xmm 4 va_sM
== Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2))
block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block) /\ va_get_xmm 5 va_sM ==
Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block /\ va_get_xmm 6 va_sM ==
Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block) /\ va_state_eq va_sM (va_update_flags
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_ok va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_51 va_b0 va_s0 k_b block hash_orig =
va_reveal_opaque (`%va_code_Loop_rounds_16_51) (va_code_Loop_rounds_16_51 ());
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s11, va_fc11) = va_lemma_Loop_rounds_16_51_recursive (va_hd va_b1) va_s0 12 k_b block
hash_orig in
let va_b11 = va_tl va_b1 in
let (va_sM, va_f11) = va_lemma_empty_total va_s11 va_b11 in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc11 va_s11 va_f11 va_sM in
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_16_51 (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret
/\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0)
k_b) /\ Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==
Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` 4) block hash_orig /\ l_and (l_and
(l_and (va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` 4) block)
(va_get_xmm 4 va_s0 == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4
`op_Multiply` (4 + 1)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (4 - 1) + 1)
block))) (va_get_xmm 5 va_s0 == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (4 + 2))
block)) (va_get_xmm 6 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (4 - 1)) block))
/\ (forall (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_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (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_s0)))))))) in
va_get_ok va_sM /\ (let i = 12 in Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM)
(va_get_xmm 2 va_sM) == Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block
hash_orig /\ va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1))
block /\ va_get_xmm 4 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial
(4 `op_Multiply` (i + 2)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block)
/\ va_get_xmm 5 va_sM == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block /\
va_get_xmm 6 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_16_51 : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_51 k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_51 ()) ([va_Mod_flags;
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_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_51 k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_51 (va_code_Loop_rounds_16_51 ()) va_s0 k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags 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_ok va_sM va_s0)))))))))));
va_lemma_norm_mods ([va_Mod_flags; 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_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_51 (k_b:buffer128) (block:block_w) (hash_orig:hash256) : (va_quickCode
unit (va_code_Loop_rounds_16_51 ())) =
(va_QProc (va_code_Loop_rounds_16_51 ()) ([va_Mod_flags; 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_wp_Loop_rounds_16_51 k_b block hash_orig) (va_wpProof_Loop_rounds_16_51 k_b block
hash_orig))
//--
//-- Loop_rounds_52_64
val va_code_Loop_rounds_52_64 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_52_64 () =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` 13) Secret) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_msg2
(va_op_xmm_xmm 4) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm
7) (va_op_xmm_xmm 3)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_CCons (va_code_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply`
14) Secret) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0)
(va_op_xmm_xmm 4)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1))
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons
(va_code_SHA256_msg2 (va_op_xmm_xmm 5) (va_op_xmm_xmm 4)) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 7) (va_op_xmm_xmm 8)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` 15) Secret) (va_CCons
(va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Sub64 (va_op_dst_opr64_reg64 rRdx)
(va_const_opr64 1)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_CCons (va_code_Paddd (va_op_xmm_xmm 2) (va_op_xmm_xmm 10)) (va_CCons (va_code_Paddd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 9)) (va_CNil ())))))))))))))))))))))))))))))
val va_codegen_success_Loop_rounds_52_64 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_52_64 () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` 13) Secret) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_msg2 (va_op_xmm_xmm 4) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` 14) Secret) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_pbool_and
(va_codegen_success_SHA256_msg2 (va_op_xmm_xmm 5) (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 8)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` 15) Secret) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_pbool_and
(va_codegen_success_Sub64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 1)) (va_pbool_and
(va_codegen_success_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 2) (va_op_xmm_xmm 10)) (va_pbool_and
(va_codegen_success_Paddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 9)) (va_ttrue
())))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_52_64 (va_mods:va_mods_t) (k_b:buffer128) (block:block_w) : (va_quickCode
unit (va_code_Loop_rounds_52_64 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(hash_orig:Vale.SHA.SHA_helpers.hash256) = Vale.SHA.SHA_helpers.make_hash (va_get_xmm 9 va_s)
(va_get_xmm 10 va_s) in let (ks:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) =
Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s) k_b in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 424 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) (16 `op_Multiply` 13) Secret k_b 13) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 425 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 13) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 425 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 13) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 426 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 427 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg2 (va_op_xmm_xmm 4) (va_op_xmm_xmm 3) (4 `op_Multiply` (13 + 1)) block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 428 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (4 `op_Multiply` 13) block
hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 429 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 430 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 431 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 432 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (4 `op_Multiply` 13 + 2) block
hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 433 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 435 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) (16 `op_Multiply` 14) Secret k_b 14) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 436 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 14) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 436 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 437 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 438 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (4 `op_Multiply` 14) block
hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 439 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 440 column 16 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_msg2 (va_op_xmm_xmm 5) (va_op_xmm_xmm 4) (4 `op_Multiply` (14 + 1)) block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 441 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 8)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 442 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (4 `op_Multiply` 14 + 2) block
hash_orig) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 444 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) (16 `op_Multiply` 15) Secret k_b 15) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 445 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_336 (s_337:(FStar.Seq.Base.seq a_336)) (i_338:Prims.nat) -> let (i_312:Prims.nat) =
i_338 in Prims.b2t (Prims.op_LessThan i_312 (FStar.Seq.Base.length #a_336 s_337)))
Vale.X64.Decls.quad32 ks 15) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 445 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 0 va_s == FStar.Seq.Base.index #Vale.X64.Decls.quad32 ks 15) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 446 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 447 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (4 `op_Multiply` 15) block
hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 448 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 449 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Sub64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 1)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 450 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (4 `op_Multiply` 15 + 2) block
hash_orig) (fun (va_s:va_state) _ -> let (abef_shuffle:quad32) = va_get_xmm 1 va_s in let
(cdgh_shuffle:quad32) = va_get_xmm 2 va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 456 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 2) (va_op_xmm_xmm 10)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 457 column 10 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Paddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> let
(va_arg56:Vale.SHA.SHA_helpers.block_w) = block in let (va_arg55:Vale.Def.Types_s.quad32) =
va_get_xmm 10 va_s in let (va_arg54:Vale.Def.Types_s.quad32) = va_get_xmm 9 va_s in let
(va_arg53:Vale.Def.Types_s.quad32) = va_get_xmm 2 va_s in let
(va_arg52:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let
(va_arg51:Vale.Def.Types_s.quad32) = cdgh_shuffle in let (va_arg50:Vale.Def.Types_s.quad32) =
abef_shuffle in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 459 column 17 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(fun (_:unit) -> Vale.SHA.SHA_helpers.update_lemma va_arg50 va_arg51 va_arg52 va_arg53 va_arg54
va_arg55 va_arg56) (va_QEmpty (()))))))))))))))))))))))))))))))))))
val va_lemma_Loop_rounds_52_64 : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_52_64 ()) va_s0 /\ va_get_ok va_s0 /\
(sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdx va_s0 >
0 /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0)
k_b) /\ (let hash_orig = Vale.SHA.SHA_helpers.make_hash (va_get_xmm 9 va_s0) (va_get_xmm 10
va_s0) in Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==
Vale.SHA.SHA_helpers.repeat_range_vale 52 block hash_orig) /\ va_get_xmm 3 va_s0 ==
Vale.SHA.SHA_helpers.ws_quad32 52 block /\ va_get_xmm 4 va_s0 ==
Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 56 block)
(Vale.SHA.SHA_helpers.ws_quad32 49 block) /\ va_get_xmm 5 va_s0 ==
Vale.SHA.SHA_helpers.ws_partial 60 block /\ va_get_xmm 6 va_s0 ==
Vale.SHA.SHA_helpers.ws_quad32 48 block)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_xmm 7 va_sM == va_get_xmm 8 va_s0 /\ va_get_reg64 rRdx va_sM == va_get_reg64 rRdx va_s0
- 1 /\ (let hash_orig = Vale.SHA.SHA_helpers.make_hash (va_get_xmm 9 va_sM) (va_get_xmm 10
va_sM) in Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.update_block hash_orig block)) /\ va_state_eq va_sM (va_update_flags 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 rRdx va_sM (va_update_ok va_sM va_s0)))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_52_64 va_b0 va_s0 k_b block =
let (va_mods:va_mods_t) = [va_Mod_flags; 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 rRdx; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_52_64 va_mods k_b block in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_52_64 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 385 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 416 column 30 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 7 va_sM == va_get_xmm 8 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 417 column 28 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_reg64 rRdx va_sM == va_get_reg64 rRdx va_s0 - 1) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 419 column 64 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let hash_orig = Vale.SHA.SHA_helpers.make_hash (va_get_xmm 9 va_sM) (va_get_xmm 10 va_sM) in
Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.update_block hash_orig block))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; 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 rRdx; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_52_64 (k_b:buffer128) (block:block_w) (va_s0:va_state) (va_k:(va_state ->
unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret
/\ va_get_reg64 rRdx va_s0 > 0 /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b) /\ (let hash_orig = Vale.SHA.SHA_helpers.make_hash
(va_get_xmm 9 va_s0) (va_get_xmm 10 va_s0) in Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s0) (va_get_xmm 2 va_s0) == Vale.SHA.SHA_helpers.repeat_range_vale 52 block hash_orig) /\
va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 52 block /\ va_get_xmm 4 va_s0 ==
Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial 56 block)
(Vale.SHA.SHA_helpers.ws_quad32 49 block) /\ va_get_xmm 5 va_s0 ==
Vale.SHA.SHA_helpers.ws_partial 60 block /\ va_get_xmm 6 va_s0 ==
Vale.SHA.SHA_helpers.ws_quad32 48 block) /\ (forall (va_x_rdx: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_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags
va_x_efl (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 rRdx va_x_rdx va_s0))))))))) in va_get_ok va_sM /\ (va_get_xmm 7 va_sM
== va_get_xmm 8 va_s0 /\ va_get_reg64 rRdx va_sM == va_get_reg64 rRdx va_s0 - 1 /\ (let
hash_orig = Vale.SHA.SHA_helpers.make_hash (va_get_xmm 9 va_sM) (va_get_xmm 10 va_sM) in
Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.update_block hash_orig block)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_52_64 : k_b:buffer128 -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_52_64 k_b block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_52_64 ()) ([va_Mod_flags;
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 rRdx]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_52_64 k_b block va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_52_64 (va_code_Loop_rounds_52_64 ()) va_s0 k_b block in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags 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 rRdx va_sM (va_update_ok va_sM
va_s0))))))))))));
va_lemma_norm_mods ([va_Mod_flags; 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 rRdx]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_52_64 (k_b:buffer128) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_52_64 ())) =
(va_QProc (va_code_Loop_rounds_52_64 ()) ([va_Mod_flags; 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 rRdx])
(va_wp_Loop_rounds_52_64 k_b block) (va_wpProof_Loop_rounds_52_64 k_b block))
//--
//-- Loop_rounds
val va_code_Loop_rounds : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Loop_rounds_0_15 ()) (va_CCons
(va_code_Loop_rounds_16_51 ()) (va_CCons (va_code_Loop_rounds_52_64 ()) (va_CNil ()))))))
val va_codegen_success_Loop_rounds : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds () =
(va_pbool_and (va_codegen_success_Loop_rounds_0_15 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_16_51 ()) (va_pbool_and (va_codegen_success_Loop_rounds_52_64
()) (va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds (va_mods:va_mods_t) (in_b:buffer128) (k_b:buffer128) (offset:nat)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 508 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
((fun a_1582 (s_1583:(FStar.Seq.Base.seq a_1582)) (i_1584:Prims.nat) (j_1585:Prims.nat) -> let
(j_1545:Prims.nat) = j_1585 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1584
j_1545) (Prims.op_LessThanOrEqual j_1545 (FStar.Seq.Base.length #a_1582 s_1583))))
Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s) in_b) offset
(offset + 4)) (fun _ -> let (input_LE:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) =
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) in_b) offset (offset + 4) in let (input_BE:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in let
(block:block_w) = Vale.SHA.SHA_helpers.quads_to_block input_BE in let
(hash_init:Vale.SHA.SHA_helpers.hash256) = Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s)
(va_get_xmm 2 va_s) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 514 column 21 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Loop_rounds_0_15 in_b k_b offset) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 515 column 22 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Loop_rounds_16_51 k_b block hash_init) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 516 column 22 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Loop_rounds_52_64 k_b block) (fun (va_s:va_state) _ -> let (va_arg27:Prims.nat) =
offset in let (va_arg26:Vale.SHA.SHA_helpers.hash256) = hash_orig in let
(va_arg25:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) in_b in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 518 column 29 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_update_multi_quads va_arg25 va_arg26 va_arg27)
(va_QEmpty (()))))))))
val va_lemma_Loop_rounds : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> k_b:buffer128 ->
offset:nat -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds ()) va_s0 /\ va_get_ok va_s0 /\
(sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0
va_s0) (va_get_reg64 rRsi va_s0) in_b offset 4 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRsi va_s0 + 64 < pow2_64 /\ va_get_reg64 rRdx
va_s0 > 0 /\ va_get_xmm 7 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051
67438087 134810123 202182159 /\ va_get_xmm 8 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ Vale.SHA.SHA_helpers.k_reqs
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b) /\ (let input_LE =
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) in_b) 0 offset in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in Vale.SHA.SHA_helpers.make_hash
(va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) == Vale.SHA.SHA_helpers.update_multi_quads input_BE
hash_orig))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64 /\ va_get_reg64 rRdx va_sM ==
va_get_reg64 rRdx va_s0 - 1 /\ va_get_xmm 7 va_sM == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ va_get_xmm 8 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ (let
input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) in_b) 0 (offset + 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in Vale.SHA.SHA_helpers.make_hash
(va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) == Vale.SHA.SHA_helpers.update_multi_quads input_BE
hash_orig)) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 10 va_sM (va_update_xmm
9 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 rRdx va_sM (va_update_reg64 rRsi va_sM (va_update_ok va_sM
va_s0))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds va_b0 va_s0 in_b k_b offset hash_orig =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRdx; va_Mod_reg64 rRsi; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds va_mods in_b k_b offset hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 463 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 497 column 31 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 498 column 28 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_reg64 rRdx va_sM == va_get_reg64 rRdx va_s0 - 1) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 499 column 74 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 7 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 500 column 72 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 504 column 73 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) in_b) 0 (offset + 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in Vale.SHA.SHA_helpers.make_hash
(va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) == Vale.SHA.SHA_helpers.update_multi_quads input_BE
hash_orig))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRdx; va_Mod_reg64 rRsi; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds (in_b:buffer128) (k_b:buffer128) (offset:nat) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sha_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_s0) in_b offset 4 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx
va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRsi va_s0 + 64 < pow2_64 /\
va_get_reg64 rRdx va_s0 > 0 /\ va_get_xmm 7 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ va_get_xmm 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\
Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b)
/\ (let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) in_b) 0 offset in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in Vale.SHA.SHA_helpers.make_hash
(va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) == Vale.SHA.SHA_helpers.update_multi_quads input_BE
hash_orig)) /\ (forall (va_x_rsi:nat64) (va_x_rdx: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_xmm9:quad32) (va_x_xmm10:quad32) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (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
rRdx va_x_rdx (va_upd_reg64 rRsi va_x_rsi va_s0)))))))))))) in va_get_ok va_sM /\ (va_get_reg64
rRsi va_sM == va_get_reg64 rRsi va_s0 + 64 /\ va_get_reg64 rRdx va_sM == va_get_reg64 rRdx
va_s0 - 1 /\ va_get_xmm 7 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051
67438087 134810123 202182159 /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ (let input_LE =
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) in_b) 0 (offset + 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in Vale.SHA.SHA_helpers.make_hash
(va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) == Vale.SHA.SHA_helpers.update_multi_quads input_BE
hash_orig)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds : in_b:buffer128 -> k_b:buffer128 -> offset:nat -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds in_b k_b offset hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds ()) ([va_Mod_flags;
va_Mod_xmm 10; va_Mod_xmm 9; 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 rRdx; va_Mod_reg64 rRsi]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds in_b k_b offset hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds (va_code_Loop_rounds ()) va_s0 in_b k_b offset
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 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 rRdx va_sM (va_update_reg64 rRsi va_sM (va_update_ok va_sM
va_s0)))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRdx; va_Mod_reg64 rRsi]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds (in_b:buffer128) (k_b:buffer128) (offset:nat) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds ())) =
(va_QProc (va_code_Loop_rounds ()) ([va_Mod_flags; va_Mod_xmm 10; va_Mod_xmm 9; 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 rRdx; va_Mod_reg64 rRsi]) (va_wp_Loop_rounds in_b k_b offset hash_orig)
(va_wpProof_Loop_rounds in_b k_b offset hash_orig))
//--
//-- Loop_body0
val va_code_Loop_body0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_body0 () =
(va_Block (va_CCons (va_code_Loop_rounds ()) (va_CNil ())))
val va_codegen_success_Loop_body0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_body0 () =
(va_pbool_and (va_codegen_success_Loop_rounds ()) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_body0 (va_mods:va_mods_t) (va_old:va_state) (va_in_hash_orig:hash256)
(va_in_in_b:buffer128) (va_in_k_b:buffer128) (va_in_count:nat) : (va_quickCode (nat)
(va_code_Loop_body0 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (hash_orig:hash256)
= va_in_hash_orig in let (in_b:buffer128) = va_in_in_b in let (k_b:buffer128) = va_in_k_b in
let (count:nat) = va_in_count in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 578 column 20 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Loop_rounds in_b k_b (count `op_Multiply` 4) hash_orig) (fun (va_s:va_state) _ -> let
(count:nat) = count + 1 in va_QEmpty ((count)))))
val va_lemma_Loop_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state ->
va_in_hash_orig:hash256 -> va_in_in_b:buffer128 -> va_in_k_b:buffer128 -> va_in_count:nat
-> Ghost (va_state & va_fuel & nat)
(requires (va_require_total va_b0 (va_code_Loop_body0 ()) va_s0 /\ va_get_ok va_s0 /\
(sha_enabled /\ sse_enabled) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRsi va_old) va_in_in_b (4 `op_Multiply` va_get_reg64 rRdx va_old)
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0
va_s0) (va_get_reg64 rRcx va_s0) va_in_k_b 16 (va_get_mem_layout va_s0) Secret /\ va_get_reg64
rRsi va_old + 64 `op_Multiply` va_get_reg64 rRdx va_old < pow2_64 /\ va_get_reg64 rRdx va_s0 ==
va_get_reg64 rRdx va_old - va_in_count /\ va_get_reg64 rRsi va_s0 == va_get_reg64 rRsi va_old +
64 `op_Multiply` va_in_count /\ va_get_xmm 7 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ va_get_xmm 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\
Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0)
va_in_k_b) /\ (let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) va_in_in_b) 0 (va_in_count
`op_Multiply` 4) in let input_BE = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in
Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==
Vale.SHA.SHA_helpers.update_multi_quads input_BE va_in_hash_orig) /\ va_get_reg64 rRdx va_s0 >
0))
(ensures (fun (va_sM, va_fM, count) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (sha_enabled /\ sse_enabled) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM)
(va_get_reg64 rRsi va_old) va_in_in_b (4 `op_Multiply` va_get_reg64 rRdx va_old)
(va_get_mem_layout va_sM) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0
va_sM) (va_get_reg64 rRcx va_sM) va_in_k_b 16 (va_get_mem_layout va_sM) Secret /\ va_get_reg64
rRsi va_old + 64 `op_Multiply` va_get_reg64 rRdx va_old < pow2_64 /\ va_get_reg64 rRdx va_sM ==
va_get_reg64 rRdx va_old - count /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_old + 64
`op_Multiply` count /\ va_get_xmm 7 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
66051 67438087 134810123 202182159 /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ Vale.SHA.SHA_helpers.k_reqs
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) va_in_k_b) /\ (let input_LE =
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) va_in_in_b) 0 (count `op_Multiply` 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in Vale.SHA.SHA_helpers.make_hash
(va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) == Vale.SHA.SHA_helpers.update_multi_quads input_BE
va_in_hash_orig) /\ precedes_wrap (va_get_reg64 rRdx va_sM) (va_get_reg64 rRdx va_s0) /\
va_state_eq va_sM (va_update_xmm 9 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 10 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rRsi
va_sM (va_update_reg64 rRdx va_sM (va_update_ok va_sM (va_update_flags va_sM
va_s0))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_body0 va_b0 va_s0 va_old va_in_hash_orig va_in_in_b va_in_k_b va_in_count =
let va_old = va_expand_state va_old in
let (va_mods:va_mods_t) = [va_Mod_xmm 9; 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 10; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRsi;
va_Mod_reg64 rRdx; va_Mod_ok; va_Mod_flags] in
let va_qc = va_qcode_Loop_body0 va_mods va_old va_in_hash_orig va_in_in_b va_in_k_b va_in_count in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_body0 ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let count = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 521 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 558 column 39 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(sha_enabled /\ sse_enabled) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 560 column 86 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old)
va_in_in_b (4 `op_Multiply` va_get_reg64 rRdx va_old) (va_get_mem_layout va_sM) Secret) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 561 column 86 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRcx va_sM)
va_in_k_b 16 (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 563 column 47 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_reg64 rRsi va_old + 64 `op_Multiply` va_get_reg64 rRdx va_old < pow2_64) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 565 column 36 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_reg64 rRdx va_sM == va_get_reg64 rRdx va_old - count) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 566 column 43 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_old + 64 `op_Multiply` count) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 568 column 78 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 7 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 569 column 76 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 571 column 49 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM)
va_in_k_b)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 575 column 77 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) va_in_in_b) 0 (count `op_Multiply` 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in Vale.SHA.SHA_helpers.make_hash
(va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) == Vale.SHA.SHA_helpers.update_multi_quads input_BE
va_in_hash_orig) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 576 column 9 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(precedes_wrap (va_get_reg64 rRdx va_sM) (va_get_reg64 rRdx va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 9; 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 10; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRsi;
va_Mod_reg64 rRdx; va_Mod_ok; va_Mod_flags]) va_sM va_s0;
let count = va_g in
(va_sM, va_fM, count)
[@ va_qattr]
let va_wp_Loop_body0 (va_old:va_state) (va_in_hash_orig:hash256) (va_in_in_b:buffer128)
(va_in_k_b:buffer128) (va_in_count:nat) (va_s0:va_state) (va_k:(va_state -> nat -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ (sha_enabled /\ sse_enabled) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_old) va_in_in_b (4 `op_Multiply`
va_get_reg64 rRdx va_old) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) va_in_k_b 16 (va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRsi va_old + 64 `op_Multiply` va_get_reg64 rRdx va_old < pow2_64 /\
va_get_reg64 rRdx va_s0 == va_get_reg64 rRdx va_old - va_in_count /\ va_get_reg64 rRsi va_s0 ==
va_get_reg64 rRsi va_old + 64 `op_Multiply` va_in_count /\ va_get_xmm 7 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\
va_get_xmm 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159 /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_s0) va_in_k_b) /\ (let input_LE = FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) va_in_in_b) 0 (va_in_count
`op_Multiply` 4) in let input_BE = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in
Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==
Vale.SHA.SHA_helpers.update_multi_quads input_BE va_in_hash_orig) /\ va_get_reg64 rRdx va_s0 >
0 /\ (forall (va_x_efl:Vale.X64.Flags.t) (va_x_ok:bool) (va_x_rdx:nat64) (va_x_rsi:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm10: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_xmm9:quad32)
(count:nat) . let va_sM = va_upd_xmm 9 va_x_xmm9 (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 10 va_x_xmm10 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdx va_x_rdx (va_upd_ok va_x_ok (va_upd_flags
va_x_efl va_s0))))))))))))) in va_get_ok va_sM /\ (sha_enabled /\ sse_enabled) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRsi va_old)
va_in_in_b (4 `op_Multiply` va_get_reg64 rRdx va_old) (va_get_mem_layout va_sM) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg64 rRcx va_sM)
va_in_k_b 16 (va_get_mem_layout va_sM) Secret /\ va_get_reg64 rRsi va_old + 64 `op_Multiply`
va_get_reg64 rRdx va_old < pow2_64 /\ va_get_reg64 rRdx va_sM == va_get_reg64 rRdx va_old -
count /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_old + 64 `op_Multiply` count /\
va_get_xmm 7 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159 /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051
67438087 134810123 202182159 /\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) va_in_k_b) /\ (let input_LE = FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM)
va_in_in_b) 0 (count `op_Multiply` 4) in let input_BE =
Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in Vale.SHA.SHA_helpers.make_hash
(va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) == Vale.SHA.SHA_helpers.update_multi_quads input_BE
va_in_hash_orig) /\ precedes_wrap (va_get_reg64 rRdx va_sM) (va_get_reg64 rRdx va_s0) ==> va_k
va_sM ((count))))
val va_wpProof_Loop_body0 : va_old:va_state -> va_in_hash_orig:hash256 -> va_in_in_b:buffer128 ->
va_in_k_b:buffer128 -> va_in_count:nat -> va_s0:va_state -> va_k:(va_state -> nat -> Type0)
-> Ghost (va_state & va_fuel & nat)
(requires (va_t_require va_s0 /\ va_wp_Loop_body0 va_old va_in_hash_orig va_in_in_b va_in_k_b
va_in_count va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_body0 ()) ([va_Mod_xmm 9;
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
10; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_ok; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_body0 va_old va_in_hash_orig va_in_in_b va_in_k_b va_in_count va_s0 va_k =
let (va_sM, va_f0, count) = va_lemma_Loop_body0 (va_code_Loop_body0 ()) va_s0 va_old
va_in_hash_orig va_in_in_b va_in_k_b va_in_count in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 9 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 10 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rRsi
va_sM (va_update_reg64 rRdx va_sM (va_update_ok va_sM (va_update_flags va_sM
va_s0)))))))))))))));
va_lemma_norm_mods ([va_Mod_xmm 9; 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 10; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRsi;
va_Mod_reg64 rRdx; va_Mod_ok; va_Mod_flags]) va_sM va_s0;
let va_g = (count) in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_body0 (va_old:va_state) (va_in_hash_orig:hash256) (va_in_in_b:buffer128)
(va_in_k_b:buffer128) (va_in_count:nat) : (va_quickCode nat (va_code_Loop_body0 ())) =
(va_QProc (va_code_Loop_body0 ()) ([va_Mod_xmm 9; 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 10; va_Mod_xmm 1; va_Mod_xmm 0;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_ok; va_Mod_flags]) (va_wp_Loop_body0 va_old
va_in_hash_orig va_in_in_b va_in_k_b va_in_count) (va_wpProof_Loop_body0 va_old va_in_hash_orig
va_in_in_b va_in_k_b va_in_count))
//--
//-- Loop_while0
val va_code_Loop_while0 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_while0 () =
(va_Block (va_CCons (va_While (va_cmp_gt (va_op_cmp_reg64 rRdx) (va_const_cmp 0)) (va_Block
(va_CCons (va_code_Loop_body0 ()) (va_CNil ())))) (va_CNil ())))
val va_codegen_success_Loop_while0 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr] | false | true | Vale.SHA.X64.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_codegen_success_Loop_while0 : va_dummy:unit -> Tot va_pbool | [] | Vale.SHA.X64.va_codegen_success_Loop_while0 | {
"file_name": "obj/Vale.SHA.X64.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | va_dummy: Prims.unit -> Vale.X64.Decls.va_pbool | {
"end_col": 65,
"end_line": 1694,
"start_col": 2,
"start_line": 1694
} |
Prims.Tot | val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.SHA_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.InsSha",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"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.Stack_i",
"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.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.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA",
"short_module": null
},
{
"abbrev": 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_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rRsi) 0 Secret)
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 4)
(va_op_reg_opr64_reg64 rRsi) 16 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 5) (va_op_reg_opr64_reg64 rRsi) 32 Secret)
(va_CCons (va_code_PshufbStable (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 6)
(va_op_reg_opr64_reg64 rRsi) 48 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRcx) 0 Secret)
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3))
(va_CCons (va_code_PshufbStable (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 2)) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 9)
(va_op_xmm_xmm 1)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2))
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx) 16 Secret) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_CCons (va_code_PshufbStable
(va_op_xmm_xmm 5) (va_op_xmm_xmm 7)) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rRsi)
(va_const_opr64 64)) (va_CCons (va_code_SHA256_msg1 (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0)
(va_op_xmm_xmm 5)) (va_CCons (va_code_PshufbStable (va_op_xmm_xmm 6) (va_op_xmm_xmm 7))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 2)
(va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons
(va_code_Mov128 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm
7) (va_op_xmm_xmm 5)) (va_CCons (va_code_Paddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7)) (va_CCons
(va_code_SHA256_msg1 (va_op_xmm_xmm 4) (va_op_xmm_xmm 5)) (va_CCons (va_code_SHA256_rnds2
(va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRcx) 48 Secret)
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 6))
(va_CCons (va_code_SHA256_msg2 (va_op_xmm_xmm 3) (va_op_xmm_xmm 6)) (va_CCons
(va_code_SHA256_rnds2 (va_op_xmm_xmm 2) (va_op_xmm_xmm 1)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 0) (va_op_xmm_xmm 0) 14) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 7)
(va_op_xmm_xmm 3)) (va_CCons (va_code_Palignr4 (va_op_xmm_xmm 7) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Paddd (va_op_xmm_xmm 4) (va_op_xmm_xmm 7)) (va_CCons (va_code_SHA256_msg1
(va_op_xmm_xmm 5) (va_op_xmm_xmm 6)) (va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 2)) (va_CNil ())))))))))))))))))))))))))))))))))))))))))))))))))))) | val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code
let va_code_Loop_rounds_0_15 () = | false | null | false | (va_Block (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 3)
(va_op_reg_opr64_reg64 rRsi)
0
Secret)
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 4)
(va_op_reg_opr64_reg64 rRsi)
16
Secret)
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 5)
(va_op_reg_opr64_reg64 rRsi)
32
Secret)
(va_CCons (va_code_PshufbStable (va_op_xmm_xmm 3) (va_op_xmm_xmm 7))
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 6)
(va_op_reg_opr64_reg64 rRsi)
48
Secret)
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRcx)
0
Secret)
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Paddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)
)
(va_CCons (va_code_PshufbStable (va_op_xmm_xmm 4)
(va_op_xmm_xmm 7))
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 10)
(va_op_xmm_xmm 2))
(va_CCons (va_code_SHA256_rnds2 (va_op_xmm_xmm
2)
(va_op_xmm_xmm 1))
(va_CCons (va_code_Pshufd (va_op_xmm_xmm
0)
(va_op_xmm_xmm 0)
14)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm
9)
(va_op_xmm_xmm 1))
(va_CCons (va_code_SHA256_rnds2 (
va_op_xmm_xmm 1)
(va_op_xmm_xmm 2))
(va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet
0)
(va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64
rRcx)
16
Secret)
(va_CCons (va_Block (va_CNil
()))
(va_CCons (va_code_Paddd
(va_op_xmm_xmm
0)
(va_op_xmm_xmm
4))
(va_CCons (va_code_PshufbStable
(va_op_xmm_xmm
5)
(va_op_xmm_xmm
7))
(va_CCons (va_Block
(va_CNil
()
))
(va_CCons
(va_code_SHA256_rnds2
(
va_op_xmm_xmm
2
)
(
va_op_xmm_xmm
1
)
)
(va_CCons
(
va_code_Pshufd
(
va_op_xmm_xmm
0
)
(
va_op_xmm_xmm
0
)
14
)
(
va_CCons
(
va_code_Add64
(
va_op_dst_opr64_reg64
rRsi
)
(
va_const_opr64
64
)
)
(
va_CCons
(
va_code_SHA256_msg1
(
va_op_xmm_xmm
3
)
(
va_op_xmm_xmm
4
)
)
(
va_CCons
(
va_code_SHA256_rnds2
(
va_op_xmm_xmm
1
)
(
va_op_xmm_xmm
2
)
)
(
va_CCons
(
va_code_Load128_buffer
(
va_op_heaplet_mem_heaplet
0
)
(
va_op_xmm_xmm
0
)
(
va_op_reg_opr64_reg64
rRcx
)
32
Secret
)
(
va_CCons
(
va_Block
(
va_CNil
()
)
)
(
va_CCons
(
va_code_Paddd
(
va_op_xmm_xmm
0
)
(
va_op_xmm_xmm
5
)
)
(
va_CCons
(
va_code_PshufbStable
(
va_op_xmm_xmm
6
)
(
va_op_xmm_xmm
7
)
)
(
va_CCons
(
va_Block
(
va_CNil
()
)
)
(
va_CCons
(
va_code_SHA256_rnds2
(
va_op_xmm_xmm
2
)
(
va_op_xmm_xmm
1
)
)
(
va_CCons
(
va_code_Pshufd
(
va_op_xmm_xmm
0
)
(
va_op_xmm_xmm
0
)
14
)
(
va_CCons
(
va_code_Mov128
(
va_op_xmm_xmm
7
)
(
va_op_xmm_xmm
6
)
)
(
va_CCons
(
va_code_Palignr4
(
va_op_xmm_xmm
7
)
(
va_op_xmm_xmm
5
)
)
(
va_CCons
(
va_code_Paddd
(
va_op_xmm_xmm
3
)
(
va_op_xmm_xmm
7
)
)
(
va_CCons
(
va_code_SHA256_msg1
(
va_op_xmm_xmm
4
)
(
va_op_xmm_xmm
5
)
)
(
va_CCons
(
va_code_SHA256_rnds2
(
va_op_xmm_xmm
1
)
(
va_op_xmm_xmm
2
)
)
(
va_CCons
(
va_code_Load128_buffer
(
va_op_heaplet_mem_heaplet
0
)
(
va_op_xmm_xmm
0
)
(
va_op_reg_opr64_reg64
rRcx
)
48
Secret
)
(
va_CCons
(
va_Block
(
va_CNil
()
)
)
(
va_CCons
(
va_code_Paddd
(
va_op_xmm_xmm
0
)
(
va_op_xmm_xmm
6
)
)
(
va_CCons
(
va_code_SHA256_msg2
(
va_op_xmm_xmm
3
)
(
va_op_xmm_xmm
6
)
)
(
va_CCons
(
va_code_SHA256_rnds2
(
va_op_xmm_xmm
2
)
(
va_op_xmm_xmm
1
)
)
(
va_CCons
(
va_code_Pshufd
(
va_op_xmm_xmm
0
)
(
va_op_xmm_xmm
0
)
14
)
(
va_CCons
(
va_code_Mov128
(
va_op_xmm_xmm
7
)
(
va_op_xmm_xmm
3
)
)
(
va_CCons
(
va_code_Palignr4
(
va_op_xmm_xmm
7
)
(
va_op_xmm_xmm
6
)
)
(
va_CCons
(
va_code_Paddd
(
va_op_xmm_xmm
4
)
(
va_op_xmm_xmm
7
)
)
(
va_CCons
(
va_code_SHA256_msg1
(
va_op_xmm_xmm
5
)
(
va_op_xmm_xmm
6
)
)
(
va_CCons
(
va_code_SHA256_rnds2
(
va_op_xmm_xmm
1
)
(
va_op_xmm_xmm
2
)
)
(
va_CNil
()
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
))
))))))))))))
))))))))))) | {
"checked_file": "Vale.SHA.X64.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.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.InsStack.fsti.checked",
"Vale.X64.InsSha.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.SHA.SHA_helpers.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.X64.fst"
} | [
"total"
] | [
"Prims.unit",
"Vale.X64.Decls.va_Block",
"Vale.X64.Decls.va_CCons",
"Vale.X64.Decls.va_CNil",
"Vale.X64.InsVector.va_code_Load128_buffer",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRsi",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.InsVector.va_code_PshufbStable",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.InsVector.va_code_Paddd",
"Vale.X64.InsVector.va_code_Mov128",
"Vale.X64.InsSha.va_code_SHA256_rnds2",
"Vale.X64.InsVector.va_code_Pshufd",
"Vale.X64.InsBasic.va_code_Add64",
"Vale.X64.Decls.va_op_dst_opr64_reg64",
"Vale.X64.Decls.va_const_opr64",
"Vale.X64.InsSha.va_code_SHA256_msg1",
"Vale.X64.InsVector.va_code_Palignr4",
"Vale.X64.InsSha.va_code_SHA256_msg2",
"Vale.X64.Decls.va_code"
] | [] | module Vale.SHA.X64
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsStack
open Vale.X64.InsVector
open Vale.X64.InsSha
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.SHA.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
#reset-options "--z3rlimit 40"
//-- Preamble
val va_code_Preamble : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Preamble () =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_CCons (va_code_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax))
(va_CCons (va_code_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_CCons (va_code_Pshufd (va_op_xmm_xmm 2)
(va_op_xmm_xmm 2) 27) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_CCons
(va_code_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Shufpd (va_op_xmm_xmm
2) (va_op_xmm_xmm 0) 0) (va_CNil ())))))))))))
val va_codegen_success_Preamble : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Preamble () =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRdi) 0 Secret) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64 rRdi) 16 Secret)
(va_pbool_and (va_codegen_success_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64
rRax)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27)
(va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_pbool_and
(va_codegen_success_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_pbool_and
(va_codegen_success_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and
(va_codegen_success_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (va_ttrue ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Preamble (va_mods:va_mods_t) (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abcd:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_s) in let (efgh:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read ctx_b 1
(va_get_mem_heaplet 0 va_s) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRdi) 0 Secret ctx_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 2) (va_op_reg_opr64_reg64
rRdi) 16 Secret ctx_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 89 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_InitPshufbStableMask (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 91 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) 177) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 93 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 2) (va_op_xmm_xmm 2) 27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 8) (va_op_xmm_xmm 7)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 96 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Palignr8 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 98 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_quick_Shufpd (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) 0) (fun (va_s:va_state) _ -> va_qAssert
va_range1
"***** PRECONDITION NOT MET AT line 99 column 5 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(FStar.Seq.Base.equal #Vale.SHA.SHA_helpers.word (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1
va_s) (va_get_xmm 2 va_s)) (Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)) (va_QEmpty
(())))))))))))))
val va_lemma_Preamble : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Preamble ()) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled
/\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdi va_s0) ctx_b
2 (va_get_mem_layout va_s0) Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\ (let abcd =
Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm
1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_xmm 8 va_sM (va_update_xmm 7 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_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_Preamble va_b0 va_s0 ctx_b =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok] in
let va_qc = va_qcode_Preamble va_mods ctx_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Preamble ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 57 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 74 column 25 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 7 va_sM == va_get_xmm 8 va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 75 column 72 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123
202182159) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 80 column 63 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****"
(let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =
Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm
1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Preamble (ctx_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRdi va_s0) ctx_b 2 (va_get_mem_layout va_s0) Secret) /\ (forall (va_x_rax:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (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_s0)))))) in va_get_ok va_sM /\ (va_get_xmm 7 va_sM == va_get_xmm
8 va_sM /\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087
134810123 202182159 /\ (let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0
va_sM) in let efgh = Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in
l_and (l_and (va_get_xmm 1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32
(Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3
efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2
abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==
Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) ==> va_k va_sM (())))
val va_wpProof_Preamble : ctx_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Preamble ctx_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Preamble ()) ([va_Mod_flags;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Preamble ctx_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Preamble (va_code_Preamble ()) va_s0 ctx_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 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_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rRax]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Preamble (ctx_b:buffer128) : (va_quickCode unit (va_code_Preamble ())) =
(va_QProc (va_code_Preamble ()) ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax]) (va_wp_Preamble ctx_b) (va_wpProof_Preamble
ctx_b))
//--
//-- Loop_rounds_0_15
val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr] | false | true | Vale.SHA.X64.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code | [] | Vale.SHA.X64.va_code_Loop_rounds_0_15 | {
"file_name": "obj/Vale.SHA.X64.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | va_dummy: Prims.unit -> Vale.X64.Decls.va_code | {
"end_col": 86,
"end_line": 236,
"start_col": 2,
"start_line": 196
} |
Subsets and Splits