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 | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let down_view16 = inverses16 (); DV.View 2 put16 get16 | let down_view16 = | false | null | false | inverses16 ();
DV.View 2 put16 get16 | {
"checked_file": "Vale.Interop.Views.fsti.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Seq.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Views.fsti"
} | [
"total"
] | [
"LowStar.BufferView.Down.View",
"FStar.UInt16.t",
"FStar.UInt8.t",
"Vale.Interop.Views.put16",
"Vale.Interop.Views.get16",
"Prims.unit",
"Vale.Interop.Views.inverses16"
] | [] | module Vale.Interop.Views
module DV = LowStar.BufferView.Down
module BV = LowStar.BufferView.Up
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Opaque_s
open Vale.Lib.Seqs_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Seq
open Vale.Def.Words.Four_s
module U8 = FStar.UInt8
let get8_def (s:Seq.lseq U8.t 1) = Seq.index s 0
[@"opaque_to_smt"] let get8 = opaque_make get8_def
irreducible let get8_reveal = opaque_revealer (`%get8) get8 get8_def
let put8_def (x:U8.t) : GTot (Seq.lseq U8.t 1) =
let contents (i:nat{i<1}) = x in
Seq.init 1 contents
[@"opaque_to_smt"] let put8 = opaque_make put8_def
irreducible let put8_reveal = opaque_revealer (`%put8) put8 put8_def
val inverses8 (u:unit) : Lemma (DV.inverses get8 put8)
let up_view8 = inverses8 (); BV.View 1 get8 put8
let down_view8 = inverses8 (); DV.View 1 put8 get8
let get16_def (s:Seq.lseq U8.t 2) = UInt16.uint_to_t (
U8.v (Seq.index s 0) +
U8.v (Seq.index s 1) * 0x100
)
[@"opaque_to_smt"] let get16 = opaque_make get16_def
irreducible let get16_reveal = opaque_revealer (`%get16) get16 get16_def
let put16_def (x:UInt16.t) : GTot (Seq.lseq U8.t 2) =
let s = Seq.create 2 (U8.uint_to_t 0) in
let x = UInt16.v x in
let s = Seq.upd s 0 (U8.uint_to_t (x % 0x100)) in
let x = x `op_Division` 0x100 in
let s = Seq.upd s 1 (U8.uint_to_t (x % 0x100)) in
s
[@"opaque_to_smt"] let put16 = opaque_make put16_def
irreducible let put16_reveal = opaque_revealer (`%put16) put16 put16_def
val inverses16 (u:unit) : Lemma (DV.inverses get16 put16) | false | true | Vale.Interop.Views.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 down_view16 : LowStar.BufferView.Down.view FStar.UInt16.t FStar.UInt8.t | [] | Vale.Interop.Views.down_view16 | {
"file_name": "vale/specs/interop/Vale.Interop.Views.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | LowStar.BufferView.Down.view FStar.UInt16.t FStar.UInt8.t | {
"end_col": 54,
"end_line": 51,
"start_col": 18,
"start_line": 51
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let view32_128 = inverses32_128 (); BV.View 4 get32_128 put32_128 | let view32_128 = | false | null | false | inverses32_128 ();
BV.View 4 get32_128 put32_128 | {
"checked_file": "Vale.Interop.Views.fsti.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Seq.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Views.fsti"
} | [
"total"
] | [
"LowStar.BufferView.Up.View",
"FStar.UInt32.t",
"Vale.Def.Types_s.quad32",
"Vale.Interop.Views.get32_128",
"Vale.Interop.Views.put32_128",
"Prims.unit",
"Vale.Interop.Views.inverses32_128"
] | [] | module Vale.Interop.Views
module DV = LowStar.BufferView.Down
module BV = LowStar.BufferView.Up
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Opaque_s
open Vale.Lib.Seqs_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Seq
open Vale.Def.Words.Four_s
module U8 = FStar.UInt8
let get8_def (s:Seq.lseq U8.t 1) = Seq.index s 0
[@"opaque_to_smt"] let get8 = opaque_make get8_def
irreducible let get8_reveal = opaque_revealer (`%get8) get8 get8_def
let put8_def (x:U8.t) : GTot (Seq.lseq U8.t 1) =
let contents (i:nat{i<1}) = x in
Seq.init 1 contents
[@"opaque_to_smt"] let put8 = opaque_make put8_def
irreducible let put8_reveal = opaque_revealer (`%put8) put8 put8_def
val inverses8 (u:unit) : Lemma (DV.inverses get8 put8)
let up_view8 = inverses8 (); BV.View 1 get8 put8
let down_view8 = inverses8 (); DV.View 1 put8 get8
let get16_def (s:Seq.lseq U8.t 2) = UInt16.uint_to_t (
U8.v (Seq.index s 0) +
U8.v (Seq.index s 1) * 0x100
)
[@"opaque_to_smt"] let get16 = opaque_make get16_def
irreducible let get16_reveal = opaque_revealer (`%get16) get16 get16_def
let put16_def (x:UInt16.t) : GTot (Seq.lseq U8.t 2) =
let s = Seq.create 2 (U8.uint_to_t 0) in
let x = UInt16.v x in
let s = Seq.upd s 0 (U8.uint_to_t (x % 0x100)) in
let x = x `op_Division` 0x100 in
let s = Seq.upd s 1 (U8.uint_to_t (x % 0x100)) in
s
[@"opaque_to_smt"] let put16 = opaque_make put16_def
irreducible let put16_reveal = opaque_revealer (`%put16) put16 put16_def
val inverses16 (u:unit) : Lemma (DV.inverses get16 put16)
let up_view16 = inverses16 (); BV.View 2 get16 put16
let down_view16 = inverses16 (); DV.View 2 put16 get16
let get32_def (s:Seq.lseq U8.t 4) =
UInt32.uint_to_t (four_to_nat 8 (seq_to_four_LE (seq_uint8_to_seq_nat8 s)))
[@"opaque_to_smt"] let get32 = opaque_make get32_def
irreducible let get32_reveal = opaque_revealer (`%get32) get32 get32_def
let put32_def (x:UInt32.t) : GTot (Seq.lseq U8.t 4) =
seq_nat8_to_seq_uint8 (four_to_seq_LE (nat_to_four 8 (UInt32.v x)))
[@"opaque_to_smt"] let put32 = opaque_make put32_def
irreducible let put32_reveal = opaque_revealer (`%put32) put32 put32_def
val inverses32 (u:unit) : Lemma (DV.inverses get32 put32)
let up_view32 = inverses32(); BV.View 4 get32 put32
let down_view32 = inverses32(); DV.View 4 put32 get32
let get64_def (s:Seq.lseq U8.t 8) =
UInt64.uint_to_t (le_bytes_to_nat64 (seq_uint8_to_seq_nat8 s))
[@"opaque_to_smt"] let get64 = opaque_make get64_def
irreducible let get64_reveal = opaque_revealer (`%get64) get64 get64_def
let put64_def (a:UInt64.t) : GTot (Seq.lseq U8.t 8) =
seq_nat8_to_seq_uint8 (le_nat64_to_bytes (UInt64.v a))
[@"opaque_to_smt"] let put64 = opaque_make put64_def
irreducible let put64_reveal = opaque_revealer (`%put64) put64 put64_def
val inverses64 (u:unit) : Lemma (DV.inverses get64 put64)
let up_view64 = inverses64 (); BV.View 8 get64 put64
let down_view64 = inverses64 (); DV.View 8 put64 get64
let get128_def (s:Seq.lseq U8.t 16) =
le_bytes_to_quad32 (seq_uint8_to_seq_nat8 s)
[@"opaque_to_smt"] let get128 = opaque_make get128_def
irreducible let get128_reveal = opaque_revealer (`%get128) get128 get128_def
let put128_def (a:quad32) : GTot (Seq.lseq U8.t 16) =
seq_nat8_to_seq_uint8 (le_quad32_to_bytes a)
[@"opaque_to_smt"] let put128 = opaque_make put128_def
irreducible let put128_reveal = opaque_revealer (`%put128) put128 put128_def
val inverses128 (u:unit) : Lemma (DV.inverses get128 put128)
let up_view128 = inverses128 (); BV.View 16 get128 put128
let down_view128 = inverses128 (); DV.View 16 put128 get128
let nat32s_to_nat128 (v1 v2 v3 v4: nat32): nat128 =
v1 + v2 * 0x100000000 + v3 * 0x1000000000000 + v4 * 0x1000000000000000000000000
module U32 = FStar.UInt32
let get32_128_def (s: Seq.lseq U32.t 4) : quad32 =
seq_to_four_LE (seq_map UInt32.v s)
[@"opaque_to_smt"] let get32_128 = opaque_make get32_128_def
irreducible let get32_128_reveal = opaque_revealer (`%get32_128) get32_128 get32_128_def
let put32_128_def (a:quad32) : GTot (Seq.lseq U32.t 4) =
seq_map UInt32.uint_to_t (four_to_seq_LE a)
[@"opaque_to_smt"] let put32_128 = opaque_make put32_128_def
irreducible let put32_128_reveal = opaque_revealer (`%put32_128) put32_128 put32_128_def
val inverses32_128 (u: unit): Lemma (DV.inverses get32_128 put32_128) | false | true | Vale.Interop.Views.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 view32_128 : LowStar.BufferView.Up.view FStar.UInt32.t Vale.Def.Types_s.quad32 | [] | Vale.Interop.Views.view32_128 | {
"file_name": "vale/specs/interop/Vale.Interop.Views.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | LowStar.BufferView.Up.view FStar.UInt32.t Vale.Def.Types_s.quad32 | {
"end_col": 65,
"end_line": 115,
"start_col": 17,
"start_line": 115
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let get32_def (s:Seq.lseq U8.t 4) =
UInt32.uint_to_t (four_to_nat 8 (seq_to_four_LE (seq_uint8_to_seq_nat8 s))) | let get32_def (s: Seq.lseq U8.t 4) = | false | null | false | UInt32.uint_to_t (four_to_nat 8 (seq_to_four_LE (seq_uint8_to_seq_nat8 s))) | {
"checked_file": "Vale.Interop.Views.fsti.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Seq.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Views.fsti"
} | [
"total"
] | [
"FStar.Seq.Properties.lseq",
"FStar.UInt8.t",
"FStar.UInt32.uint_to_t",
"Vale.Def.Words.Four_s.four_to_nat",
"Vale.Def.Words.Seq_s.seq_to_four_LE",
"Vale.Def.Words_s.nat8",
"Vale.Def.Words.Seq_s.seq_uint8_to_seq_nat8",
"FStar.UInt32.t"
] | [] | module Vale.Interop.Views
module DV = LowStar.BufferView.Down
module BV = LowStar.BufferView.Up
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Opaque_s
open Vale.Lib.Seqs_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Seq
open Vale.Def.Words.Four_s
module U8 = FStar.UInt8
let get8_def (s:Seq.lseq U8.t 1) = Seq.index s 0
[@"opaque_to_smt"] let get8 = opaque_make get8_def
irreducible let get8_reveal = opaque_revealer (`%get8) get8 get8_def
let put8_def (x:U8.t) : GTot (Seq.lseq U8.t 1) =
let contents (i:nat{i<1}) = x in
Seq.init 1 contents
[@"opaque_to_smt"] let put8 = opaque_make put8_def
irreducible let put8_reveal = opaque_revealer (`%put8) put8 put8_def
val inverses8 (u:unit) : Lemma (DV.inverses get8 put8)
let up_view8 = inverses8 (); BV.View 1 get8 put8
let down_view8 = inverses8 (); DV.View 1 put8 get8
let get16_def (s:Seq.lseq U8.t 2) = UInt16.uint_to_t (
U8.v (Seq.index s 0) +
U8.v (Seq.index s 1) * 0x100
)
[@"opaque_to_smt"] let get16 = opaque_make get16_def
irreducible let get16_reveal = opaque_revealer (`%get16) get16 get16_def
let put16_def (x:UInt16.t) : GTot (Seq.lseq U8.t 2) =
let s = Seq.create 2 (U8.uint_to_t 0) in
let x = UInt16.v x in
let s = Seq.upd s 0 (U8.uint_to_t (x % 0x100)) in
let x = x `op_Division` 0x100 in
let s = Seq.upd s 1 (U8.uint_to_t (x % 0x100)) in
s
[@"opaque_to_smt"] let put16 = opaque_make put16_def
irreducible let put16_reveal = opaque_revealer (`%put16) put16 put16_def
val inverses16 (u:unit) : Lemma (DV.inverses get16 put16)
let up_view16 = inverses16 (); BV.View 2 get16 put16
let down_view16 = inverses16 (); DV.View 2 put16 get16 | false | false | Vale.Interop.Views.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 get32_def : s: FStar.Seq.Properties.lseq FStar.UInt8.t 4 -> FStar.UInt32.t | [] | Vale.Interop.Views.get32_def | {
"file_name": "vale/specs/interop/Vale.Interop.Views.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Properties.lseq FStar.UInt8.t 4 -> FStar.UInt32.t | {
"end_col": 78,
"end_line": 54,
"start_col": 2,
"start_line": 54
} |
|
Prims.Tot | val nat32s_to_nat128 (v1 v2 v3 v4: nat32) : nat128 | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let nat32s_to_nat128 (v1 v2 v3 v4: nat32): nat128 =
v1 + v2 * 0x100000000 + v3 * 0x1000000000000 + v4 * 0x1000000000000000000000000 | val nat32s_to_nat128 (v1 v2 v3 v4: nat32) : nat128
let nat32s_to_nat128 (v1 v2 v3 v4: nat32) : nat128 = | false | null | false | v1 + v2 * 0x100000000 + v3 * 0x1000000000000 + v4 * 0x1000000000000000000000000 | {
"checked_file": "Vale.Interop.Views.fsti.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Seq.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Views.fsti"
} | [
"total"
] | [
"Vale.Def.Types_s.nat32",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Vale.Def.Words_s.nat128"
] | [] | module Vale.Interop.Views
module DV = LowStar.BufferView.Down
module BV = LowStar.BufferView.Up
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Opaque_s
open Vale.Lib.Seqs_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Seq
open Vale.Def.Words.Four_s
module U8 = FStar.UInt8
let get8_def (s:Seq.lseq U8.t 1) = Seq.index s 0
[@"opaque_to_smt"] let get8 = opaque_make get8_def
irreducible let get8_reveal = opaque_revealer (`%get8) get8 get8_def
let put8_def (x:U8.t) : GTot (Seq.lseq U8.t 1) =
let contents (i:nat{i<1}) = x in
Seq.init 1 contents
[@"opaque_to_smt"] let put8 = opaque_make put8_def
irreducible let put8_reveal = opaque_revealer (`%put8) put8 put8_def
val inverses8 (u:unit) : Lemma (DV.inverses get8 put8)
let up_view8 = inverses8 (); BV.View 1 get8 put8
let down_view8 = inverses8 (); DV.View 1 put8 get8
let get16_def (s:Seq.lseq U8.t 2) = UInt16.uint_to_t (
U8.v (Seq.index s 0) +
U8.v (Seq.index s 1) * 0x100
)
[@"opaque_to_smt"] let get16 = opaque_make get16_def
irreducible let get16_reveal = opaque_revealer (`%get16) get16 get16_def
let put16_def (x:UInt16.t) : GTot (Seq.lseq U8.t 2) =
let s = Seq.create 2 (U8.uint_to_t 0) in
let x = UInt16.v x in
let s = Seq.upd s 0 (U8.uint_to_t (x % 0x100)) in
let x = x `op_Division` 0x100 in
let s = Seq.upd s 1 (U8.uint_to_t (x % 0x100)) in
s
[@"opaque_to_smt"] let put16 = opaque_make put16_def
irreducible let put16_reveal = opaque_revealer (`%put16) put16 put16_def
val inverses16 (u:unit) : Lemma (DV.inverses get16 put16)
let up_view16 = inverses16 (); BV.View 2 get16 put16
let down_view16 = inverses16 (); DV.View 2 put16 get16
let get32_def (s:Seq.lseq U8.t 4) =
UInt32.uint_to_t (four_to_nat 8 (seq_to_four_LE (seq_uint8_to_seq_nat8 s)))
[@"opaque_to_smt"] let get32 = opaque_make get32_def
irreducible let get32_reveal = opaque_revealer (`%get32) get32 get32_def
let put32_def (x:UInt32.t) : GTot (Seq.lseq U8.t 4) =
seq_nat8_to_seq_uint8 (four_to_seq_LE (nat_to_four 8 (UInt32.v x)))
[@"opaque_to_smt"] let put32 = opaque_make put32_def
irreducible let put32_reveal = opaque_revealer (`%put32) put32 put32_def
val inverses32 (u:unit) : Lemma (DV.inverses get32 put32)
let up_view32 = inverses32(); BV.View 4 get32 put32
let down_view32 = inverses32(); DV.View 4 put32 get32
let get64_def (s:Seq.lseq U8.t 8) =
UInt64.uint_to_t (le_bytes_to_nat64 (seq_uint8_to_seq_nat8 s))
[@"opaque_to_smt"] let get64 = opaque_make get64_def
irreducible let get64_reveal = opaque_revealer (`%get64) get64 get64_def
let put64_def (a:UInt64.t) : GTot (Seq.lseq U8.t 8) =
seq_nat8_to_seq_uint8 (le_nat64_to_bytes (UInt64.v a))
[@"opaque_to_smt"] let put64 = opaque_make put64_def
irreducible let put64_reveal = opaque_revealer (`%put64) put64 put64_def
val inverses64 (u:unit) : Lemma (DV.inverses get64 put64)
let up_view64 = inverses64 (); BV.View 8 get64 put64
let down_view64 = inverses64 (); DV.View 8 put64 get64
let get128_def (s:Seq.lseq U8.t 16) =
le_bytes_to_quad32 (seq_uint8_to_seq_nat8 s)
[@"opaque_to_smt"] let get128 = opaque_make get128_def
irreducible let get128_reveal = opaque_revealer (`%get128) get128 get128_def
let put128_def (a:quad32) : GTot (Seq.lseq U8.t 16) =
seq_nat8_to_seq_uint8 (le_quad32_to_bytes a)
[@"opaque_to_smt"] let put128 = opaque_make put128_def
irreducible let put128_reveal = opaque_revealer (`%put128) put128 put128_def
val inverses128 (u:unit) : Lemma (DV.inverses get128 put128)
let up_view128 = inverses128 (); BV.View 16 get128 put128
let down_view128 = inverses128 (); DV.View 16 put128 get128 | false | true | Vale.Interop.Views.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 nat32s_to_nat128 (v1 v2 v3 v4: nat32) : nat128 | [] | Vale.Interop.Views.nat32s_to_nat128 | {
"file_name": "vale/specs/interop/Vale.Interop.Views.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
v1: Vale.Def.Types_s.nat32 ->
v2: Vale.Def.Types_s.nat32 ->
v3: Vale.Def.Types_s.nat32 ->
v4: Vale.Def.Types_s.nat32
-> Vale.Def.Words_s.nat128 | {
"end_col": 81,
"end_line": 99,
"start_col": 2,
"start_line": 99
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let get16_def (s:Seq.lseq U8.t 2) = UInt16.uint_to_t (
U8.v (Seq.index s 0) +
U8.v (Seq.index s 1) * 0x100
) | let get16_def (s: Seq.lseq U8.t 2) = | false | null | false | UInt16.uint_to_t (U8.v (Seq.index s 0) + U8.v (Seq.index s 1) * 0x100) | {
"checked_file": "Vale.Interop.Views.fsti.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Seq.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Views.fsti"
} | [
"total"
] | [
"FStar.Seq.Properties.lseq",
"FStar.UInt8.t",
"FStar.UInt16.uint_to_t",
"Prims.op_Addition",
"FStar.UInt8.v",
"FStar.Seq.Base.index",
"FStar.Mul.op_Star",
"FStar.UInt16.t"
] | [] | module Vale.Interop.Views
module DV = LowStar.BufferView.Down
module BV = LowStar.BufferView.Up
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Opaque_s
open Vale.Lib.Seqs_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Seq
open Vale.Def.Words.Four_s
module U8 = FStar.UInt8
let get8_def (s:Seq.lseq U8.t 1) = Seq.index s 0
[@"opaque_to_smt"] let get8 = opaque_make get8_def
irreducible let get8_reveal = opaque_revealer (`%get8) get8 get8_def
let put8_def (x:U8.t) : GTot (Seq.lseq U8.t 1) =
let contents (i:nat{i<1}) = x in
Seq.init 1 contents
[@"opaque_to_smt"] let put8 = opaque_make put8_def
irreducible let put8_reveal = opaque_revealer (`%put8) put8 put8_def
val inverses8 (u:unit) : Lemma (DV.inverses get8 put8)
let up_view8 = inverses8 (); BV.View 1 get8 put8
let down_view8 = inverses8 (); DV.View 1 put8 get8 | false | false | Vale.Interop.Views.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 get16_def : s: FStar.Seq.Properties.lseq FStar.UInt8.t 2 -> FStar.UInt16.t | [] | Vale.Interop.Views.get16_def | {
"file_name": "vale/specs/interop/Vale.Interop.Views.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Properties.lseq FStar.UInt8.t 2 -> FStar.UInt16.t | {
"end_col": 3,
"end_line": 34,
"start_col": 36,
"start_line": 31
} |
|
Prims.GTot | val put32_def (x: UInt32.t) : GTot (Seq.lseq U8.t 4) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let put32_def (x:UInt32.t) : GTot (Seq.lseq U8.t 4) =
seq_nat8_to_seq_uint8 (four_to_seq_LE (nat_to_four 8 (UInt32.v x))) | val put32_def (x: UInt32.t) : GTot (Seq.lseq U8.t 4)
let put32_def (x: UInt32.t) : GTot (Seq.lseq U8.t 4) = | false | null | false | seq_nat8_to_seq_uint8 (four_to_seq_LE (nat_to_four 8 (UInt32.v x))) | {
"checked_file": "Vale.Interop.Views.fsti.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Seq.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Views.fsti"
} | [
"sometrivial"
] | [
"FStar.UInt32.t",
"Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8",
"Vale.Def.Words.Seq_s.four_to_seq_LE",
"Vale.Def.Words_s.natN",
"Prims.pow2",
"Vale.Def.Words.Four_s.nat_to_four",
"FStar.UInt32.v",
"FStar.Seq.Properties.lseq",
"FStar.UInt8.t"
] | [] | module Vale.Interop.Views
module DV = LowStar.BufferView.Down
module BV = LowStar.BufferView.Up
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Opaque_s
open Vale.Lib.Seqs_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Seq
open Vale.Def.Words.Four_s
module U8 = FStar.UInt8
let get8_def (s:Seq.lseq U8.t 1) = Seq.index s 0
[@"opaque_to_smt"] let get8 = opaque_make get8_def
irreducible let get8_reveal = opaque_revealer (`%get8) get8 get8_def
let put8_def (x:U8.t) : GTot (Seq.lseq U8.t 1) =
let contents (i:nat{i<1}) = x in
Seq.init 1 contents
[@"opaque_to_smt"] let put8 = opaque_make put8_def
irreducible let put8_reveal = opaque_revealer (`%put8) put8 put8_def
val inverses8 (u:unit) : Lemma (DV.inverses get8 put8)
let up_view8 = inverses8 (); BV.View 1 get8 put8
let down_view8 = inverses8 (); DV.View 1 put8 get8
let get16_def (s:Seq.lseq U8.t 2) = UInt16.uint_to_t (
U8.v (Seq.index s 0) +
U8.v (Seq.index s 1) * 0x100
)
[@"opaque_to_smt"] let get16 = opaque_make get16_def
irreducible let get16_reveal = opaque_revealer (`%get16) get16 get16_def
let put16_def (x:UInt16.t) : GTot (Seq.lseq U8.t 2) =
let s = Seq.create 2 (U8.uint_to_t 0) in
let x = UInt16.v x in
let s = Seq.upd s 0 (U8.uint_to_t (x % 0x100)) in
let x = x `op_Division` 0x100 in
let s = Seq.upd s 1 (U8.uint_to_t (x % 0x100)) in
s
[@"opaque_to_smt"] let put16 = opaque_make put16_def
irreducible let put16_reveal = opaque_revealer (`%put16) put16 put16_def
val inverses16 (u:unit) : Lemma (DV.inverses get16 put16)
let up_view16 = inverses16 (); BV.View 2 get16 put16
let down_view16 = inverses16 (); DV.View 2 put16 get16
let get32_def (s:Seq.lseq U8.t 4) =
UInt32.uint_to_t (four_to_nat 8 (seq_to_four_LE (seq_uint8_to_seq_nat8 s)))
[@"opaque_to_smt"] let get32 = opaque_make get32_def
irreducible let get32_reveal = opaque_revealer (`%get32) get32 get32_def | false | false | Vale.Interop.Views.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 put32_def (x: UInt32.t) : GTot (Seq.lseq U8.t 4) | [] | Vale.Interop.Views.put32_def | {
"file_name": "vale/specs/interop/Vale.Interop.Views.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: FStar.UInt32.t -> Prims.GTot (FStar.Seq.Properties.lseq FStar.UInt8.t 4) | {
"end_col": 69,
"end_line": 59,
"start_col": 2,
"start_line": 59
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let up_view64 = inverses64 (); BV.View 8 get64 put64 | let up_view64 = | false | null | false | inverses64 ();
BV.View 8 get64 put64 | {
"checked_file": "Vale.Interop.Views.fsti.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Seq.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Views.fsti"
} | [
"total"
] | [
"LowStar.BufferView.Up.View",
"FStar.UInt8.t",
"FStar.UInt64.t",
"Vale.Interop.Views.get64",
"Vale.Interop.Views.put64",
"Prims.unit",
"Vale.Interop.Views.inverses64"
] | [] | module Vale.Interop.Views
module DV = LowStar.BufferView.Down
module BV = LowStar.BufferView.Up
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Opaque_s
open Vale.Lib.Seqs_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Seq
open Vale.Def.Words.Four_s
module U8 = FStar.UInt8
let get8_def (s:Seq.lseq U8.t 1) = Seq.index s 0
[@"opaque_to_smt"] let get8 = opaque_make get8_def
irreducible let get8_reveal = opaque_revealer (`%get8) get8 get8_def
let put8_def (x:U8.t) : GTot (Seq.lseq U8.t 1) =
let contents (i:nat{i<1}) = x in
Seq.init 1 contents
[@"opaque_to_smt"] let put8 = opaque_make put8_def
irreducible let put8_reveal = opaque_revealer (`%put8) put8 put8_def
val inverses8 (u:unit) : Lemma (DV.inverses get8 put8)
let up_view8 = inverses8 (); BV.View 1 get8 put8
let down_view8 = inverses8 (); DV.View 1 put8 get8
let get16_def (s:Seq.lseq U8.t 2) = UInt16.uint_to_t (
U8.v (Seq.index s 0) +
U8.v (Seq.index s 1) * 0x100
)
[@"opaque_to_smt"] let get16 = opaque_make get16_def
irreducible let get16_reveal = opaque_revealer (`%get16) get16 get16_def
let put16_def (x:UInt16.t) : GTot (Seq.lseq U8.t 2) =
let s = Seq.create 2 (U8.uint_to_t 0) in
let x = UInt16.v x in
let s = Seq.upd s 0 (U8.uint_to_t (x % 0x100)) in
let x = x `op_Division` 0x100 in
let s = Seq.upd s 1 (U8.uint_to_t (x % 0x100)) in
s
[@"opaque_to_smt"] let put16 = opaque_make put16_def
irreducible let put16_reveal = opaque_revealer (`%put16) put16 put16_def
val inverses16 (u:unit) : Lemma (DV.inverses get16 put16)
let up_view16 = inverses16 (); BV.View 2 get16 put16
let down_view16 = inverses16 (); DV.View 2 put16 get16
let get32_def (s:Seq.lseq U8.t 4) =
UInt32.uint_to_t (four_to_nat 8 (seq_to_four_LE (seq_uint8_to_seq_nat8 s)))
[@"opaque_to_smt"] let get32 = opaque_make get32_def
irreducible let get32_reveal = opaque_revealer (`%get32) get32 get32_def
let put32_def (x:UInt32.t) : GTot (Seq.lseq U8.t 4) =
seq_nat8_to_seq_uint8 (four_to_seq_LE (nat_to_four 8 (UInt32.v x)))
[@"opaque_to_smt"] let put32 = opaque_make put32_def
irreducible let put32_reveal = opaque_revealer (`%put32) put32 put32_def
val inverses32 (u:unit) : Lemma (DV.inverses get32 put32)
let up_view32 = inverses32(); BV.View 4 get32 put32
let down_view32 = inverses32(); DV.View 4 put32 get32
let get64_def (s:Seq.lseq U8.t 8) =
UInt64.uint_to_t (le_bytes_to_nat64 (seq_uint8_to_seq_nat8 s))
[@"opaque_to_smt"] let get64 = opaque_make get64_def
irreducible let get64_reveal = opaque_revealer (`%get64) get64 get64_def
let put64_def (a:UInt64.t) : GTot (Seq.lseq U8.t 8) =
seq_nat8_to_seq_uint8 (le_nat64_to_bytes (UInt64.v a))
[@"opaque_to_smt"] let put64 = opaque_make put64_def
irreducible let put64_reveal = opaque_revealer (`%put64) put64 put64_def
val inverses64 (u:unit) : Lemma (DV.inverses get64 put64) | false | true | Vale.Interop.Views.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 up_view64 : LowStar.BufferView.Up.view FStar.UInt8.t FStar.UInt64.t | [] | Vale.Interop.Views.up_view64 | {
"file_name": "vale/specs/interop/Vale.Interop.Views.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | LowStar.BufferView.Up.view FStar.UInt8.t FStar.UInt64.t | {
"end_col": 52,
"end_line": 80,
"start_col": 16,
"start_line": 80
} |
|
Prims.GTot | val put128_def (a: quad32) : GTot (Seq.lseq U8.t 16) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let put128_def (a:quad32) : GTot (Seq.lseq U8.t 16) =
seq_nat8_to_seq_uint8 (le_quad32_to_bytes a) | val put128_def (a: quad32) : GTot (Seq.lseq U8.t 16)
let put128_def (a: quad32) : GTot (Seq.lseq U8.t 16) = | false | null | false | seq_nat8_to_seq_uint8 (le_quad32_to_bytes a) | {
"checked_file": "Vale.Interop.Views.fsti.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Seq.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Views.fsti"
} | [
"sometrivial"
] | [
"Vale.Def.Types_s.quad32",
"Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8",
"Vale.Def.Types_s.le_quad32_to_bytes",
"FStar.Seq.Properties.lseq",
"FStar.UInt8.t"
] | [] | module Vale.Interop.Views
module DV = LowStar.BufferView.Down
module BV = LowStar.BufferView.Up
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Opaque_s
open Vale.Lib.Seqs_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Seq
open Vale.Def.Words.Four_s
module U8 = FStar.UInt8
let get8_def (s:Seq.lseq U8.t 1) = Seq.index s 0
[@"opaque_to_smt"] let get8 = opaque_make get8_def
irreducible let get8_reveal = opaque_revealer (`%get8) get8 get8_def
let put8_def (x:U8.t) : GTot (Seq.lseq U8.t 1) =
let contents (i:nat{i<1}) = x in
Seq.init 1 contents
[@"opaque_to_smt"] let put8 = opaque_make put8_def
irreducible let put8_reveal = opaque_revealer (`%put8) put8 put8_def
val inverses8 (u:unit) : Lemma (DV.inverses get8 put8)
let up_view8 = inverses8 (); BV.View 1 get8 put8
let down_view8 = inverses8 (); DV.View 1 put8 get8
let get16_def (s:Seq.lseq U8.t 2) = UInt16.uint_to_t (
U8.v (Seq.index s 0) +
U8.v (Seq.index s 1) * 0x100
)
[@"opaque_to_smt"] let get16 = opaque_make get16_def
irreducible let get16_reveal = opaque_revealer (`%get16) get16 get16_def
let put16_def (x:UInt16.t) : GTot (Seq.lseq U8.t 2) =
let s = Seq.create 2 (U8.uint_to_t 0) in
let x = UInt16.v x in
let s = Seq.upd s 0 (U8.uint_to_t (x % 0x100)) in
let x = x `op_Division` 0x100 in
let s = Seq.upd s 1 (U8.uint_to_t (x % 0x100)) in
s
[@"opaque_to_smt"] let put16 = opaque_make put16_def
irreducible let put16_reveal = opaque_revealer (`%put16) put16 put16_def
val inverses16 (u:unit) : Lemma (DV.inverses get16 put16)
let up_view16 = inverses16 (); BV.View 2 get16 put16
let down_view16 = inverses16 (); DV.View 2 put16 get16
let get32_def (s:Seq.lseq U8.t 4) =
UInt32.uint_to_t (four_to_nat 8 (seq_to_four_LE (seq_uint8_to_seq_nat8 s)))
[@"opaque_to_smt"] let get32 = opaque_make get32_def
irreducible let get32_reveal = opaque_revealer (`%get32) get32 get32_def
let put32_def (x:UInt32.t) : GTot (Seq.lseq U8.t 4) =
seq_nat8_to_seq_uint8 (four_to_seq_LE (nat_to_four 8 (UInt32.v x)))
[@"opaque_to_smt"] let put32 = opaque_make put32_def
irreducible let put32_reveal = opaque_revealer (`%put32) put32 put32_def
val inverses32 (u:unit) : Lemma (DV.inverses get32 put32)
let up_view32 = inverses32(); BV.View 4 get32 put32
let down_view32 = inverses32(); DV.View 4 put32 get32
let get64_def (s:Seq.lseq U8.t 8) =
UInt64.uint_to_t (le_bytes_to_nat64 (seq_uint8_to_seq_nat8 s))
[@"opaque_to_smt"] let get64 = opaque_make get64_def
irreducible let get64_reveal = opaque_revealer (`%get64) get64 get64_def
let put64_def (a:UInt64.t) : GTot (Seq.lseq U8.t 8) =
seq_nat8_to_seq_uint8 (le_nat64_to_bytes (UInt64.v a))
[@"opaque_to_smt"] let put64 = opaque_make put64_def
irreducible let put64_reveal = opaque_revealer (`%put64) put64 put64_def
val inverses64 (u:unit) : Lemma (DV.inverses get64 put64)
let up_view64 = inverses64 (); BV.View 8 get64 put64
let down_view64 = inverses64 (); DV.View 8 put64 get64
let get128_def (s:Seq.lseq U8.t 16) =
le_bytes_to_quad32 (seq_uint8_to_seq_nat8 s)
[@"opaque_to_smt"] let get128 = opaque_make get128_def
irreducible let get128_reveal = opaque_revealer (`%get128) get128 get128_def | false | false | Vale.Interop.Views.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 put128_def (a: quad32) : GTot (Seq.lseq U8.t 16) | [] | Vale.Interop.Views.put128_def | {
"file_name": "vale/specs/interop/Vale.Interop.Views.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Def.Types_s.quad32 -> Prims.GTot (FStar.Seq.Properties.lseq FStar.UInt8.t 16) | {
"end_col": 46,
"end_line": 89,
"start_col": 2,
"start_line": 89
} |
Prims.Tot | val get32_128_def (s: Seq.lseq U32.t 4) : quad32 | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let get32_128_def (s: Seq.lseq U32.t 4) : quad32 =
seq_to_four_LE (seq_map UInt32.v s) | val get32_128_def (s: Seq.lseq U32.t 4) : quad32
let get32_128_def (s: Seq.lseq U32.t 4) : quad32 = | false | null | false | seq_to_four_LE (seq_map UInt32.v s) | {
"checked_file": "Vale.Interop.Views.fsti.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Seq.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Views.fsti"
} | [
"total"
] | [
"FStar.Seq.Properties.lseq",
"FStar.UInt32.t",
"Vale.Def.Words.Seq_s.seq_to_four_LE",
"Vale.Def.Types_s.nat32",
"Vale.Lib.Seqs_s.seq_map",
"FStar.UInt32.v",
"Vale.Def.Types_s.quad32"
] | [] | module Vale.Interop.Views
module DV = LowStar.BufferView.Down
module BV = LowStar.BufferView.Up
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Opaque_s
open Vale.Lib.Seqs_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Seq
open Vale.Def.Words.Four_s
module U8 = FStar.UInt8
let get8_def (s:Seq.lseq U8.t 1) = Seq.index s 0
[@"opaque_to_smt"] let get8 = opaque_make get8_def
irreducible let get8_reveal = opaque_revealer (`%get8) get8 get8_def
let put8_def (x:U8.t) : GTot (Seq.lseq U8.t 1) =
let contents (i:nat{i<1}) = x in
Seq.init 1 contents
[@"opaque_to_smt"] let put8 = opaque_make put8_def
irreducible let put8_reveal = opaque_revealer (`%put8) put8 put8_def
val inverses8 (u:unit) : Lemma (DV.inverses get8 put8)
let up_view8 = inverses8 (); BV.View 1 get8 put8
let down_view8 = inverses8 (); DV.View 1 put8 get8
let get16_def (s:Seq.lseq U8.t 2) = UInt16.uint_to_t (
U8.v (Seq.index s 0) +
U8.v (Seq.index s 1) * 0x100
)
[@"opaque_to_smt"] let get16 = opaque_make get16_def
irreducible let get16_reveal = opaque_revealer (`%get16) get16 get16_def
let put16_def (x:UInt16.t) : GTot (Seq.lseq U8.t 2) =
let s = Seq.create 2 (U8.uint_to_t 0) in
let x = UInt16.v x in
let s = Seq.upd s 0 (U8.uint_to_t (x % 0x100)) in
let x = x `op_Division` 0x100 in
let s = Seq.upd s 1 (U8.uint_to_t (x % 0x100)) in
s
[@"opaque_to_smt"] let put16 = opaque_make put16_def
irreducible let put16_reveal = opaque_revealer (`%put16) put16 put16_def
val inverses16 (u:unit) : Lemma (DV.inverses get16 put16)
let up_view16 = inverses16 (); BV.View 2 get16 put16
let down_view16 = inverses16 (); DV.View 2 put16 get16
let get32_def (s:Seq.lseq U8.t 4) =
UInt32.uint_to_t (four_to_nat 8 (seq_to_four_LE (seq_uint8_to_seq_nat8 s)))
[@"opaque_to_smt"] let get32 = opaque_make get32_def
irreducible let get32_reveal = opaque_revealer (`%get32) get32 get32_def
let put32_def (x:UInt32.t) : GTot (Seq.lseq U8.t 4) =
seq_nat8_to_seq_uint8 (four_to_seq_LE (nat_to_four 8 (UInt32.v x)))
[@"opaque_to_smt"] let put32 = opaque_make put32_def
irreducible let put32_reveal = opaque_revealer (`%put32) put32 put32_def
val inverses32 (u:unit) : Lemma (DV.inverses get32 put32)
let up_view32 = inverses32(); BV.View 4 get32 put32
let down_view32 = inverses32(); DV.View 4 put32 get32
let get64_def (s:Seq.lseq U8.t 8) =
UInt64.uint_to_t (le_bytes_to_nat64 (seq_uint8_to_seq_nat8 s))
[@"opaque_to_smt"] let get64 = opaque_make get64_def
irreducible let get64_reveal = opaque_revealer (`%get64) get64 get64_def
let put64_def (a:UInt64.t) : GTot (Seq.lseq U8.t 8) =
seq_nat8_to_seq_uint8 (le_nat64_to_bytes (UInt64.v a))
[@"opaque_to_smt"] let put64 = opaque_make put64_def
irreducible let put64_reveal = opaque_revealer (`%put64) put64 put64_def
val inverses64 (u:unit) : Lemma (DV.inverses get64 put64)
let up_view64 = inverses64 (); BV.View 8 get64 put64
let down_view64 = inverses64 (); DV.View 8 put64 get64
let get128_def (s:Seq.lseq U8.t 16) =
le_bytes_to_quad32 (seq_uint8_to_seq_nat8 s)
[@"opaque_to_smt"] let get128 = opaque_make get128_def
irreducible let get128_reveal = opaque_revealer (`%get128) get128 get128_def
let put128_def (a:quad32) : GTot (Seq.lseq U8.t 16) =
seq_nat8_to_seq_uint8 (le_quad32_to_bytes a)
[@"opaque_to_smt"] let put128 = opaque_make put128_def
irreducible let put128_reveal = opaque_revealer (`%put128) put128 put128_def
val inverses128 (u:unit) : Lemma (DV.inverses get128 put128)
let up_view128 = inverses128 (); BV.View 16 get128 put128
let down_view128 = inverses128 (); DV.View 16 put128 get128
let nat32s_to_nat128 (v1 v2 v3 v4: nat32): nat128 =
v1 + v2 * 0x100000000 + v3 * 0x1000000000000 + v4 * 0x1000000000000000000000000
module U32 = FStar.UInt32 | false | false | Vale.Interop.Views.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 get32_128_def (s: Seq.lseq U32.t 4) : quad32 | [] | Vale.Interop.Views.get32_128_def | {
"file_name": "vale/specs/interop/Vale.Interop.Views.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Properties.lseq FStar.UInt32.t 4 -> Vale.Def.Types_s.quad32 | {
"end_col": 37,
"end_line": 104,
"start_col": 2,
"start_line": 104
} |
Prims.GTot | val put32_128_def (a: quad32) : GTot (Seq.lseq U32.t 4) | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"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": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let put32_128_def (a:quad32) : GTot (Seq.lseq U32.t 4) =
seq_map UInt32.uint_to_t (four_to_seq_LE a) | val put32_128_def (a: quad32) : GTot (Seq.lseq U32.t 4)
let put32_128_def (a: quad32) : GTot (Seq.lseq U32.t 4) = | false | null | false | seq_map UInt32.uint_to_t (four_to_seq_LE a) | {
"checked_file": "Vale.Interop.Views.fsti.checked",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Words.Seq.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.Views.fsti"
} | [
"sometrivial"
] | [
"Vale.Def.Types_s.quad32",
"Vale.Lib.Seqs_s.seq_map",
"Vale.Def.Types_s.nat32",
"FStar.UInt32.t",
"FStar.UInt32.uint_to_t",
"Vale.Def.Words.Seq_s.four_to_seq_LE",
"FStar.Seq.Properties.lseq"
] | [] | module Vale.Interop.Views
module DV = LowStar.BufferView.Down
module BV = LowStar.BufferView.Up
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Def.Opaque_s
open Vale.Lib.Seqs_s
open Vale.Def.Words.Seq_s
open Vale.Def.Words.Seq
open Vale.Def.Words.Four_s
module U8 = FStar.UInt8
let get8_def (s:Seq.lseq U8.t 1) = Seq.index s 0
[@"opaque_to_smt"] let get8 = opaque_make get8_def
irreducible let get8_reveal = opaque_revealer (`%get8) get8 get8_def
let put8_def (x:U8.t) : GTot (Seq.lseq U8.t 1) =
let contents (i:nat{i<1}) = x in
Seq.init 1 contents
[@"opaque_to_smt"] let put8 = opaque_make put8_def
irreducible let put8_reveal = opaque_revealer (`%put8) put8 put8_def
val inverses8 (u:unit) : Lemma (DV.inverses get8 put8)
let up_view8 = inverses8 (); BV.View 1 get8 put8
let down_view8 = inverses8 (); DV.View 1 put8 get8
let get16_def (s:Seq.lseq U8.t 2) = UInt16.uint_to_t (
U8.v (Seq.index s 0) +
U8.v (Seq.index s 1) * 0x100
)
[@"opaque_to_smt"] let get16 = opaque_make get16_def
irreducible let get16_reveal = opaque_revealer (`%get16) get16 get16_def
let put16_def (x:UInt16.t) : GTot (Seq.lseq U8.t 2) =
let s = Seq.create 2 (U8.uint_to_t 0) in
let x = UInt16.v x in
let s = Seq.upd s 0 (U8.uint_to_t (x % 0x100)) in
let x = x `op_Division` 0x100 in
let s = Seq.upd s 1 (U8.uint_to_t (x % 0x100)) in
s
[@"opaque_to_smt"] let put16 = opaque_make put16_def
irreducible let put16_reveal = opaque_revealer (`%put16) put16 put16_def
val inverses16 (u:unit) : Lemma (DV.inverses get16 put16)
let up_view16 = inverses16 (); BV.View 2 get16 put16
let down_view16 = inverses16 (); DV.View 2 put16 get16
let get32_def (s:Seq.lseq U8.t 4) =
UInt32.uint_to_t (four_to_nat 8 (seq_to_four_LE (seq_uint8_to_seq_nat8 s)))
[@"opaque_to_smt"] let get32 = opaque_make get32_def
irreducible let get32_reveal = opaque_revealer (`%get32) get32 get32_def
let put32_def (x:UInt32.t) : GTot (Seq.lseq U8.t 4) =
seq_nat8_to_seq_uint8 (four_to_seq_LE (nat_to_four 8 (UInt32.v x)))
[@"opaque_to_smt"] let put32 = opaque_make put32_def
irreducible let put32_reveal = opaque_revealer (`%put32) put32 put32_def
val inverses32 (u:unit) : Lemma (DV.inverses get32 put32)
let up_view32 = inverses32(); BV.View 4 get32 put32
let down_view32 = inverses32(); DV.View 4 put32 get32
let get64_def (s:Seq.lseq U8.t 8) =
UInt64.uint_to_t (le_bytes_to_nat64 (seq_uint8_to_seq_nat8 s))
[@"opaque_to_smt"] let get64 = opaque_make get64_def
irreducible let get64_reveal = opaque_revealer (`%get64) get64 get64_def
let put64_def (a:UInt64.t) : GTot (Seq.lseq U8.t 8) =
seq_nat8_to_seq_uint8 (le_nat64_to_bytes (UInt64.v a))
[@"opaque_to_smt"] let put64 = opaque_make put64_def
irreducible let put64_reveal = opaque_revealer (`%put64) put64 put64_def
val inverses64 (u:unit) : Lemma (DV.inverses get64 put64)
let up_view64 = inverses64 (); BV.View 8 get64 put64
let down_view64 = inverses64 (); DV.View 8 put64 get64
let get128_def (s:Seq.lseq U8.t 16) =
le_bytes_to_quad32 (seq_uint8_to_seq_nat8 s)
[@"opaque_to_smt"] let get128 = opaque_make get128_def
irreducible let get128_reveal = opaque_revealer (`%get128) get128 get128_def
let put128_def (a:quad32) : GTot (Seq.lseq U8.t 16) =
seq_nat8_to_seq_uint8 (le_quad32_to_bytes a)
[@"opaque_to_smt"] let put128 = opaque_make put128_def
irreducible let put128_reveal = opaque_revealer (`%put128) put128 put128_def
val inverses128 (u:unit) : Lemma (DV.inverses get128 put128)
let up_view128 = inverses128 (); BV.View 16 get128 put128
let down_view128 = inverses128 (); DV.View 16 put128 get128
let nat32s_to_nat128 (v1 v2 v3 v4: nat32): nat128 =
v1 + v2 * 0x100000000 + v3 * 0x1000000000000 + v4 * 0x1000000000000000000000000
module U32 = FStar.UInt32
let get32_128_def (s: Seq.lseq U32.t 4) : quad32 =
seq_to_four_LE (seq_map UInt32.v s)
[@"opaque_to_smt"] let get32_128 = opaque_make get32_128_def
irreducible let get32_128_reveal = opaque_revealer (`%get32_128) get32_128 get32_128_def | false | false | Vale.Interop.Views.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 put32_128_def (a: quad32) : GTot (Seq.lseq U32.t 4) | [] | Vale.Interop.Views.put32_128_def | {
"file_name": "vale/specs/interop/Vale.Interop.Views.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Def.Types_s.quad32 -> Prims.GTot (FStar.Seq.Properties.lseq FStar.UInt32.t 4) | {
"end_col": 45,
"end_line": 109,
"start_col": 2,
"start_line": 109
} |
Prims.Tot | val u16_from_UInt16: (n:FStar.UInt16.t) -> u:uint16{uint_v #U16 u = UInt16.v n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 u16_from_UInt16 x = x | val u16_from_UInt16: (n:FStar.UInt16.t) -> u:uint16{uint_v #U16 u = UInt16.v n}
let u16_from_UInt16 x = | false | null | false | x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"FStar.UInt16.t",
"Lib.IntTypes.uint16",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U16",
"FStar.UInt.size",
"FStar.UInt16.n",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.SEC",
"FStar.UInt16.v"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes
let u8_from_UInt8 x = x | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val u16_from_UInt16: (n:FStar.UInt16.t) -> u:uint16{uint_v #U16 u = UInt16.v n} | [] | Lib.RawIntTypes.u16_from_UInt16 | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: FStar.UInt16.t -> u3: Lib.IntTypes.uint16{Lib.IntTypes.uint_v u3 = FStar.UInt16.v n} | {
"end_col": 25,
"end_line": 14,
"start_col": 24,
"start_line": 14
} |
Prims.Tot | val u32_from_UInt32: (n:FStar.UInt32.t) -> u:uint32{uint_v #U32 u = UInt32.v n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 u32_from_UInt32 x = x | val u32_from_UInt32: (n:FStar.UInt32.t) -> u:uint32{uint_v #U32 u = UInt32.v n}
let u32_from_UInt32 x = | false | null | false | x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"FStar.UInt32.t",
"Lib.IntTypes.uint32",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U32",
"FStar.UInt.size",
"FStar.UInt32.n",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.SEC",
"FStar.UInt32.v"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes
let u8_from_UInt8 x = x
let u16_from_UInt16 x = x | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val u32_from_UInt32: (n:FStar.UInt32.t) -> u:uint32{uint_v #U32 u = UInt32.v n} | [] | Lib.RawIntTypes.u32_from_UInt32 | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: FStar.UInt32.t -> u4: Lib.IntTypes.uint32{Lib.IntTypes.uint_v u4 = FStar.UInt32.v n} | {
"end_col": 25,
"end_line": 16,
"start_col": 24,
"start_line": 16
} |
Prims.Tot | val u8_to_UInt8: (u:uint8) -> n:UInt8.t{uint_v #U8 u = UInt8.v n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 u8_to_UInt8 x = x | val u8_to_UInt8: (u:uint8) -> n:UInt8.t{uint_v #U8 u = UInt8.v n}
let u8_to_UInt8 x = | false | null | false | x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"Lib.IntTypes.uint8",
"FStar.UInt8.t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U8",
"FStar.UInt.size",
"FStar.UInt8.n",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.SEC",
"FStar.UInt8.v"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes
let u8_from_UInt8 x = x
let u16_from_UInt16 x = x
let u32_from_UInt32 x = x
let u64_from_UInt64 x = x
let u128_from_UInt128 x = x
let size_from_UInt32 x = x | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val u8_to_UInt8: (u:uint8) -> n:UInt8.t{uint_v #U8 u = UInt8.v n} | [] | Lib.RawIntTypes.u8_to_UInt8 | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | u7: Lib.IntTypes.uint8 -> n: FStar.UInt8.t{Lib.IntTypes.uint_v u7 = FStar.UInt8.v n} | {
"end_col": 21,
"end_line": 24,
"start_col": 20,
"start_line": 24
} |
Prims.Tot | val u16_to_UInt16: (u:uint16) -> n:UInt16.t{uint_v #U16 u = UInt16.v n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 u16_to_UInt16 x = x | val u16_to_UInt16: (u:uint16) -> n:UInt16.t{uint_v #U16 u = UInt16.v n}
let u16_to_UInt16 x = | false | null | false | x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"Lib.IntTypes.uint16",
"FStar.UInt16.t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U16",
"FStar.UInt.size",
"FStar.UInt16.n",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.SEC",
"FStar.UInt16.v"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes
let u8_from_UInt8 x = x
let u16_from_UInt16 x = x
let u32_from_UInt32 x = x
let u64_from_UInt64 x = x
let u128_from_UInt128 x = x
let size_from_UInt32 x = x
let u8_to_UInt8 x = x | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val u16_to_UInt16: (u:uint16) -> n:UInt16.t{uint_v #U16 u = UInt16.v n} | [] | Lib.RawIntTypes.u16_to_UInt16 | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | u8: Lib.IntTypes.uint16 -> n: FStar.UInt16.t{Lib.IntTypes.uint_v u8 = FStar.UInt16.v n} | {
"end_col": 23,
"end_line": 26,
"start_col": 22,
"start_line": 26
} |
Prims.Tot | val u64_to_UInt64: (u:uint64) -> n:UInt64.t{uint_v #U64 u = UInt64.v n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 u64_to_UInt64 x = x | val u64_to_UInt64: (u:uint64) -> n:UInt64.t{uint_v #U64 u = UInt64.v n}
let u64_to_UInt64 x = | false | null | false | x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"Lib.IntTypes.uint64",
"FStar.UInt64.t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U64",
"FStar.UInt.size",
"FStar.UInt64.n",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.SEC",
"FStar.UInt64.v"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes
let u8_from_UInt8 x = x
let u16_from_UInt16 x = x
let u32_from_UInt32 x = x
let u64_from_UInt64 x = x
let u128_from_UInt128 x = x
let size_from_UInt32 x = x
let u8_to_UInt8 x = x
let u16_to_UInt16 x = x
let u32_to_UInt32 x = x | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val u64_to_UInt64: (u:uint64) -> n:UInt64.t{uint_v #U64 u = UInt64.v n} | [] | Lib.RawIntTypes.u64_to_UInt64 | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | u10: Lib.IntTypes.uint64 -> n: FStar.UInt64.t{Lib.IntTypes.uint_v u10 = FStar.UInt64.v n} | {
"end_col": 23,
"end_line": 30,
"start_col": 22,
"start_line": 30
} |
Prims.Tot | val u8_from_UInt8: (n:FStar.UInt8.t) -> u:uint8{uint_v #U8 u = UInt8.v n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 u8_from_UInt8 x = x | val u8_from_UInt8: (n:FStar.UInt8.t) -> u:uint8{uint_v #U8 u = UInt8.v n}
let u8_from_UInt8 x = | false | null | false | x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"FStar.UInt8.t",
"Lib.IntTypes.uint8",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U8",
"FStar.UInt.size",
"FStar.UInt8.n",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.SEC",
"FStar.UInt8.v"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val u8_from_UInt8: (n:FStar.UInt8.t) -> u:uint8{uint_v #U8 u = UInt8.v n} | [] | Lib.RawIntTypes.u8_from_UInt8 | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: FStar.UInt8.t -> u2: Lib.IntTypes.uint8{Lib.IntTypes.uint_v u2 = FStar.UInt8.v n} | {
"end_col": 23,
"end_line": 12,
"start_col": 22,
"start_line": 12
} |
Prims.Tot | val size_from_UInt32: (n:FStar.UInt32.t) -> u:size_t{uint_v u = UInt32.v n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 size_from_UInt32 x = x | val size_from_UInt32: (n:FStar.UInt32.t) -> u:size_t{uint_v u = UInt32.v n}
let size_from_UInt32 x = | false | null | false | x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"FStar.UInt32.t",
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U32",
"FStar.UInt.size",
"FStar.UInt32.n",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.PUB",
"FStar.UInt32.v"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes
let u8_from_UInt8 x = x
let u16_from_UInt16 x = x
let u32_from_UInt32 x = x
let u64_from_UInt64 x = x
let u128_from_UInt128 x = x | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val size_from_UInt32: (n:FStar.UInt32.t) -> u:size_t{uint_v u = UInt32.v n} | [] | Lib.RawIntTypes.size_from_UInt32 | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: FStar.UInt32.t -> u7: Lib.IntTypes.size_t{Lib.IntTypes.uint_v u7 = FStar.UInt32.v n} | {
"end_col": 26,
"end_line": 22,
"start_col": 25,
"start_line": 22
} |
Prims.Tot | val u32_to_UInt32: (u:uint32) -> n:UInt32.t{uint_v #U32 u = UInt32.v n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 u32_to_UInt32 x = x | val u32_to_UInt32: (u:uint32) -> n:UInt32.t{uint_v #U32 u = UInt32.v n}
let u32_to_UInt32 x = | false | null | false | x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"Lib.IntTypes.uint32",
"FStar.UInt32.t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U32",
"FStar.UInt.size",
"FStar.UInt32.n",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.SEC",
"FStar.UInt32.v"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes
let u8_from_UInt8 x = x
let u16_from_UInt16 x = x
let u32_from_UInt32 x = x
let u64_from_UInt64 x = x
let u128_from_UInt128 x = x
let size_from_UInt32 x = x
let u8_to_UInt8 x = x
let u16_to_UInt16 x = x | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val u32_to_UInt32: (u:uint32) -> n:UInt32.t{uint_v #U32 u = UInt32.v n} | [] | Lib.RawIntTypes.u32_to_UInt32 | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | u9: Lib.IntTypes.uint32 -> n: FStar.UInt32.t{Lib.IntTypes.uint_v u9 = FStar.UInt32.v n} | {
"end_col": 23,
"end_line": 28,
"start_col": 22,
"start_line": 28
} |
Prims.Tot | val u64_from_UInt64: (n:FStar.UInt64.t) -> u:uint64{uint_v #U64 u = UInt64.v n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 u64_from_UInt64 x = x | val u64_from_UInt64: (n:FStar.UInt64.t) -> u:uint64{uint_v #U64 u = UInt64.v n}
let u64_from_UInt64 x = | false | null | false | x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"FStar.UInt64.t",
"Lib.IntTypes.uint64",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U64",
"FStar.UInt.size",
"FStar.UInt64.n",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.SEC",
"FStar.UInt64.v"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes
let u8_from_UInt8 x = x
let u16_from_UInt16 x = x
let u32_from_UInt32 x = x | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val u64_from_UInt64: (n:FStar.UInt64.t) -> u:uint64{uint_v #U64 u = UInt64.v n} | [] | Lib.RawIntTypes.u64_from_UInt64 | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: FStar.UInt64.t -> u5: Lib.IntTypes.uint64{Lib.IntTypes.uint_v u5 = FStar.UInt64.v n} | {
"end_col": 25,
"end_line": 18,
"start_col": 24,
"start_line": 18
} |
Prims.Tot | val uint_to_nat: #t:inttype{unsigned t} -> #l:secrecy_level -> u:uint_t t l -> n:nat{n = uint_v #t u} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 uint_to_nat #t #l (x:uint_t t l) = uint_v #t #l x | val uint_to_nat: #t:inttype{unsigned t} -> #l:secrecy_level -> u:uint_t t l -> n:nat{n = uint_v #t u}
let uint_to_nat #t #l (x: uint_t t l) = | false | null | false | uint_v #t #l x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"Lib.IntTypes.inttype",
"Prims.b2t",
"Lib.IntTypes.unsigned",
"Lib.IntTypes.secrecy_level",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.uint_v",
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Prims.op_GreaterThanOrEqual",
"Lib.IntTypes.range"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes
let u8_from_UInt8 x = x
let u16_from_UInt16 x = x
let u32_from_UInt32 x = x
let u64_from_UInt64 x = x
let u128_from_UInt128 x = x
let size_from_UInt32 x = x
let u8_to_UInt8 x = x
let u16_to_UInt16 x = x
let u32_to_UInt32 x = x
let u64_to_UInt64 x = x
let u128_to_UInt128 x = x
let size_to_UInt32 x = x | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val uint_to_nat: #t:inttype{unsigned t} -> #l:secrecy_level -> u:uint_t t l -> n:nat{n = uint_v #t u} | [] | Lib.RawIntTypes.uint_to_nat | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | u17: Lib.IntTypes.uint_t t l -> n: Prims.nat{n = Lib.IntTypes.uint_v u17} | {
"end_col": 53,
"end_line": 36,
"start_col": 39,
"start_line": 36
} |
Prims.Tot | val size_to_UInt32: (u:size_t) -> n:UInt32.t{uint_v u = UInt32.v n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 size_to_UInt32 x = x | val size_to_UInt32: (u:size_t) -> n:UInt32.t{uint_v u = UInt32.v n}
let size_to_UInt32 x = | false | null | false | x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"Lib.IntTypes.size_t",
"FStar.UInt32.t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U32",
"FStar.UInt.size",
"FStar.UInt32.n",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.PUB",
"FStar.UInt32.v"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes
let u8_from_UInt8 x = x
let u16_from_UInt16 x = x
let u32_from_UInt32 x = x
let u64_from_UInt64 x = x
let u128_from_UInt128 x = x
let size_from_UInt32 x = x
let u8_to_UInt8 x = x
let u16_to_UInt16 x = x
let u32_to_UInt32 x = x
let u64_to_UInt64 x = x
let u128_to_UInt128 x = x | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val size_to_UInt32: (u:size_t) -> n:UInt32.t{uint_v u = UInt32.v n} | [] | Lib.RawIntTypes.size_to_UInt32 | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | u12: Lib.IntTypes.size_t -> n: FStar.UInt32.t{Lib.IntTypes.uint_v u12 = FStar.UInt32.v n} | {
"end_col": 24,
"end_line": 34,
"start_col": 23,
"start_line": 34
} |
Prims.Tot | val u128_to_UInt128: (u:uint128) -> n:UInt128.t{uint_v #U128 u = UInt128.v n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 u128_to_UInt128 x = x | val u128_to_UInt128: (u:uint128) -> n:UInt128.t{uint_v #U128 u = UInt128.v n}
let u128_to_UInt128 x = | false | null | false | x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"Lib.IntTypes.uint128",
"FStar.UInt128.t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U128",
"FStar.UInt.size",
"FStar.UInt128.n",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.SEC",
"FStar.UInt128.v"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes
let u8_from_UInt8 x = x
let u16_from_UInt16 x = x
let u32_from_UInt32 x = x
let u64_from_UInt64 x = x
let u128_from_UInt128 x = x
let size_from_UInt32 x = x
let u8_to_UInt8 x = x
let u16_to_UInt16 x = x
let u32_to_UInt32 x = x
let u64_to_UInt64 x = x | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val u128_to_UInt128: (u:uint128) -> n:UInt128.t{uint_v #U128 u = UInt128.v n} | [] | Lib.RawIntTypes.u128_to_UInt128 | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | u11: Lib.IntTypes.uint128 -> n: FStar.UInt128.t{Lib.IntTypes.uint_v u11 = FStar.UInt128.v n} | {
"end_col": 25,
"end_line": 32,
"start_col": 24,
"start_line": 32
} |
Prims.Tot | val u128_from_UInt128: (n:FStar.UInt128.t) -> u:uint128{uint_v #U128 u = UInt128.v n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": 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 u128_from_UInt128 x = x | val u128_from_UInt128: (n:FStar.UInt128.t) -> u:uint128{uint_v #U128 u = UInt128.v n}
let u128_from_UInt128 x = | false | null | false | x | {
"checked_file": "Lib.RawIntTypes.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fst.checked",
"Lib.IntTypes.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.RawIntTypes.fst"
} | [
"total"
] | [
"FStar.UInt128.t",
"Lib.IntTypes.uint128",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U128",
"FStar.UInt.size",
"FStar.UInt128.n",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.SEC",
"FStar.UInt128.v"
] | [] | module Lib.RawIntTypes
open Lib.IntTypes
(* This module offers direct access to the internals of IntTypes.
Typechecking it requires full access to IntTypes.fst (not just IntTypes.fsti)
Use only if you need to, because using this module will load more F* dependencies.
More importantly, using the u*_to_UInt* functions BREAKS secret independence. *)
friend Lib.IntTypes
let u8_from_UInt8 x = x
let u16_from_UInt16 x = x
let u32_from_UInt32 x = x
let u64_from_UInt64 x = x | false | false | Lib.RawIntTypes.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val u128_from_UInt128: (n:FStar.UInt128.t) -> u:uint128{uint_v #U128 u = UInt128.v n} | [] | Lib.RawIntTypes.u128_from_UInt128 | {
"file_name": "lib/Lib.RawIntTypes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: FStar.UInt128.t -> u6: Lib.IntTypes.uint128{Lib.IntTypes.uint_v u6 = FStar.UInt128.v n} | {
"end_col": 27,
"end_line": 20,
"start_col": 26,
"start_line": 20
} |
Prims.Tot | val push_context (ctx: string) (r: range) (g: env) : (g': env{g == g'}) | [
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": 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 push_context (ctx:string) (r:range) (g:env) : (g':env { g == g' })
= push_context g ctx r | val push_context (ctx: string) (r: range) (g: env) : (g': env{g == g'})
let push_context (ctx: string) (r: range) (g: env) : (g': env{g == g'}) = | false | null | false | push_context g ctx r | {
"checked_file": "Pulse.Checker.Pure.fsti.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.Elaborate.Pure.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Builtins.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Checker.Pure.fsti"
} | [
"total"
] | [
"Prims.string",
"Pulse.Syntax.Base.range",
"Pulse.Typing.Env.env",
"Pulse.Typing.Env.push_context",
"Prims.eq2"
] | [] | module Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Elaborate.Pure
open Pulse.Typing
open Pulse.Readback
module RTB = FStar.Tactics.Builtins
module RU = Pulse.RuntimeUtils | false | false | Pulse.Checker.Pure.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 push_context (ctx: string) (r: range) (g: env) : (g': env{g == g'}) | [] | Pulse.Checker.Pure.push_context | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fsti",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | ctx: Prims.string -> r: Pulse.Syntax.Base.range -> g: Pulse.Typing.Env.env
-> g': Pulse.Typing.Env.env{g == g'} | {
"end_col": 24,
"end_line": 15,
"start_col": 4,
"start_line": 15
} |
Prims.Tot | val blake2s_init:Impl.blake2_init_st Spec.Blake2S Core.M128 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let blake2s_init : Impl.blake2_init_st Spec.Blake2S Core.M128 =
Impl.blake2_init #Spec.Blake2S #Core.M128 | val blake2s_init:Impl.blake2_init_st Spec.Blake2S Core.M128
let blake2s_init:Impl.blake2_init_st Spec.Blake2S Core.M128 = | false | null | false | Impl.blake2_init #Spec.Blake2S #Core.M128 | {
"checked_file": "Hacl.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_init",
"Spec.Blake2.Blake2S",
"Hacl.Impl.Blake2.Core.M128"
] | [] | module Hacl.Blake2s_128
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2s_update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128 | false | false | Hacl.Blake2s_128.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2s_init:Impl.blake2_init_st Spec.Blake2S Core.M128 | [] | Hacl.Blake2s_128.blake2s_init | {
"file_name": "code/blake2/Hacl.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_init_st Spec.Blake2.Blake2S Hacl.Impl.Blake2.Core.M128 | {
"end_col": 43,
"end_line": 14,
"start_col": 2,
"start_line": 14
} |
Prims.Tot | val blake2s:Impl.blake2_st Spec.Blake2S Core.M128 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let blake2s : Impl.blake2_st Spec.Blake2S Core.M128 =
Impl.blake2 #Spec.Blake2S #Core.M128 blake2s_init blake2s_update blake2s_finish | val blake2s:Impl.blake2_st Spec.Blake2S Core.M128
let blake2s:Impl.blake2_st Spec.Blake2S Core.M128 = | false | null | false | Impl.blake2 #Spec.Blake2S #Core.M128 blake2s_init blake2s_update blake2s_finish | {
"checked_file": "Hacl.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2",
"Spec.Blake2.Blake2S",
"Hacl.Impl.Blake2.Core.M128",
"Hacl.Blake2s_128.blake2s_init",
"Hacl.Blake2s_128.blake2s_update",
"Hacl.Blake2s_128.blake2s_finish"
] | [] | module Hacl.Blake2s_128
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2s_update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128
let blake2s_init : Impl.blake2_init_st Spec.Blake2S Core.M128 =
Impl.blake2_init #Spec.Blake2S #Core.M128
let blake2s_update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 =
Impl.blake2_update_key #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 =
Impl.blake2_update_multi #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 =
Impl.blake2_update_last #Spec.Blake2S #Core.M128 blake2s_update_block
[@CInline]
private
let blake2s_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 =
Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 blake2s_update_multi blake2s_update_last
[@CInline]
private
let blake2s_update : Impl.blake2_update_st Spec.Blake2S Core.M128 =
Impl.blake2_update #Spec.Blake2S #Core.M128 blake2s_update_key blake2s_update_blocks
let blake2s_finish : Impl.blake2_finish_st Spec.Blake2S Core.M128 =
Impl.blake2_finish #Spec.Blake2S #Core.M128
(* The one-shot hash *)
[@@ Comment "Write the BLAKE2s digest of message `d` using key `k` into `output`.
@param nn Length of to-be-generated digest with 1 <= `nn` <= 32.
@param output Pointer to `nn` bytes of memory where the digest is written to.
@param ll Length of the input message.
@param d Pointer to `ll` bytes of memory where the input message is read from.
@param kk Length of the key. Can be 0.
@param k Pointer to `kk` bytes of memory where the key is read from."] | false | false | Hacl.Blake2s_128.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2s:Impl.blake2_st Spec.Blake2S Core.M128 | [] | Hacl.Blake2s_128.blake2s | {
"file_name": "code/blake2/Hacl.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_st Spec.Blake2.Blake2S Hacl.Impl.Blake2.Core.M128 | {
"end_col": 81,
"end_line": 48,
"start_col": 2,
"start_line": 48
} |
Prims.Tot | val blake2s_update_multi:Impl.blake2_update_multi_st Spec.Blake2S Core.M128 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let blake2s_update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 =
Impl.blake2_update_multi #Spec.Blake2S #Core.M128 blake2s_update_block | val blake2s_update_multi:Impl.blake2_update_multi_st Spec.Blake2S Core.M128
let blake2s_update_multi:Impl.blake2_update_multi_st Spec.Blake2S Core.M128 = | false | null | false | Impl.blake2_update_multi #Spec.Blake2S #Core.M128 blake2s_update_block | {
"checked_file": "Hacl.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_update_multi",
"Spec.Blake2.Blake2S",
"Hacl.Impl.Blake2.Core.M128",
"Hacl.Blake2s_128.blake2s_update_block"
] | [] | module Hacl.Blake2s_128
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2s_update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128
let blake2s_init : Impl.blake2_init_st Spec.Blake2S Core.M128 =
Impl.blake2_init #Spec.Blake2S #Core.M128
let blake2s_update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 =
Impl.blake2_update_key #Spec.Blake2S #Core.M128 blake2s_update_block | false | false | Hacl.Blake2s_128.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2s_update_multi:Impl.blake2_update_multi_st Spec.Blake2S Core.M128 | [] | Hacl.Blake2s_128.blake2s_update_multi | {
"file_name": "code/blake2/Hacl.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_update_multi_st Spec.Blake2.Blake2S Hacl.Impl.Blake2.Core.M128 | {
"end_col": 72,
"end_line": 20,
"start_col": 2,
"start_line": 20
} |
Prims.Tot | val blake2s_update:Impl.blake2_update_st Spec.Blake2S Core.M128 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let blake2s_update : Impl.blake2_update_st Spec.Blake2S Core.M128 =
Impl.blake2_update #Spec.Blake2S #Core.M128 blake2s_update_key blake2s_update_blocks | val blake2s_update:Impl.blake2_update_st Spec.Blake2S Core.M128
let blake2s_update:Impl.blake2_update_st Spec.Blake2S Core.M128 = | false | null | false | Impl.blake2_update #Spec.Blake2S #Core.M128 blake2s_update_key blake2s_update_blocks | {
"checked_file": "Hacl.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_update",
"Spec.Blake2.Blake2S",
"Hacl.Impl.Blake2.Core.M128",
"Hacl.Blake2s_128.blake2s_update_key",
"Hacl.Blake2s_128.blake2s_update_blocks"
] | [] | module Hacl.Blake2s_128
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2s_update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128
let blake2s_init : Impl.blake2_init_st Spec.Blake2S Core.M128 =
Impl.blake2_init #Spec.Blake2S #Core.M128
let blake2s_update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 =
Impl.blake2_update_key #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 =
Impl.blake2_update_multi #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 =
Impl.blake2_update_last #Spec.Blake2S #Core.M128 blake2s_update_block
[@CInline]
private
let blake2s_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 =
Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 blake2s_update_multi blake2s_update_last
[@CInline]
private | false | false | Hacl.Blake2s_128.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2s_update:Impl.blake2_update_st Spec.Blake2S Core.M128 | [] | Hacl.Blake2s_128.blake2s_update | {
"file_name": "code/blake2/Hacl.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_update_st Spec.Blake2.Blake2S Hacl.Impl.Blake2.Core.M128 | {
"end_col": 86,
"end_line": 33,
"start_col": 2,
"start_line": 33
} |
Prims.Tot | val blake2s_update_block:Impl.blake2_update_block_st Spec.Blake2S Core.M128 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let blake2s_update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128 | val blake2s_update_block:Impl.blake2_update_block_st Spec.Blake2S Core.M128
let blake2s_update_block:Impl.blake2_update_block_st Spec.Blake2S Core.M128 = | false | null | false | Impl.blake2_update_block #Spec.Blake2S #Core.M128 | {
"checked_file": "Hacl.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_update_block",
"Spec.Blake2.Blake2S",
"Hacl.Impl.Blake2.Core.M128"
] | [] | module Hacl.Blake2s_128
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private | false | false | Hacl.Blake2s_128.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2s_update_block:Impl.blake2_update_block_st Spec.Blake2S Core.M128 | [] | Hacl.Blake2s_128.blake2s_update_block | {
"file_name": "code/blake2/Hacl.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_update_block_st Spec.Blake2.Blake2S Hacl.Impl.Blake2.Core.M128 | {
"end_col": 51,
"end_line": 11,
"start_col": 2,
"start_line": 11
} |
Prims.Tot | val blake2s_update_blocks:Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let blake2s_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 =
Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 blake2s_update_multi blake2s_update_last | val blake2s_update_blocks:Impl.blake2_update_blocks_st Spec.Blake2S Core.M128
let blake2s_update_blocks:Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 = | false | null | false | Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 blake2s_update_multi blake2s_update_last | {
"checked_file": "Hacl.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_update_blocks",
"Spec.Blake2.Blake2S",
"Hacl.Impl.Blake2.Core.M128",
"Hacl.Blake2s_128.blake2s_update_multi",
"Hacl.Blake2s_128.blake2s_update_last"
] | [] | module Hacl.Blake2s_128
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2s_update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128
let blake2s_init : Impl.blake2_init_st Spec.Blake2S Core.M128 =
Impl.blake2_init #Spec.Blake2S #Core.M128
let blake2s_update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 =
Impl.blake2_update_key #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 =
Impl.blake2_update_multi #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 =
Impl.blake2_update_last #Spec.Blake2S #Core.M128 blake2s_update_block
[@CInline]
private | false | false | Hacl.Blake2s_128.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2s_update_blocks:Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 | [] | Hacl.Blake2s_128.blake2s_update_blocks | {
"file_name": "code/blake2/Hacl.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_update_blocks_st Spec.Blake2.Blake2S Hacl.Impl.Blake2.Core.M128 | {
"end_col": 93,
"end_line": 28,
"start_col": 2,
"start_line": 28
} |
Prims.Tot | val store_state128s_to_state32:Core.store_state_st Spec.Blake2S Core.M128 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let store_state128s_to_state32: Core.store_state_st Spec.Blake2S Core.M128 =
Core.store_state_to_state32 #Spec.Blake2S #Core.M128 | val store_state128s_to_state32:Core.store_state_st Spec.Blake2S Core.M128
let store_state128s_to_state32:Core.store_state_st Spec.Blake2S Core.M128 = | false | null | false | Core.store_state_to_state32 #Spec.Blake2S #Core.M128 | {
"checked_file": "Hacl.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Core.store_state_to_state32",
"Spec.Blake2.Blake2S",
"Hacl.Impl.Blake2.Core.M128"
] | [] | module Hacl.Blake2s_128
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2s_update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128
let blake2s_init : Impl.blake2_init_st Spec.Blake2S Core.M128 =
Impl.blake2_init #Spec.Blake2S #Core.M128
let blake2s_update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 =
Impl.blake2_update_key #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 =
Impl.blake2_update_multi #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 =
Impl.blake2_update_last #Spec.Blake2S #Core.M128 blake2s_update_block
[@CInline]
private
let blake2s_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 =
Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 blake2s_update_multi blake2s_update_last
[@CInline]
private
let blake2s_update : Impl.blake2_update_st Spec.Blake2S Core.M128 =
Impl.blake2_update #Spec.Blake2S #Core.M128 blake2s_update_key blake2s_update_blocks
let blake2s_finish : Impl.blake2_finish_st Spec.Blake2S Core.M128 =
Impl.blake2_finish #Spec.Blake2S #Core.M128
(* The one-shot hash *)
[@@ Comment "Write the BLAKE2s digest of message `d` using key `k` into `output`.
@param nn Length of to-be-generated digest with 1 <= `nn` <= 32.
@param output Pointer to `nn` bytes of memory where the digest is written to.
@param ll Length of the input message.
@param d Pointer to `ll` bytes of memory where the input message is read from.
@param kk Length of the key. Can be 0.
@param k Pointer to `kk` bytes of memory where the key is read from."]
let blake2s : Impl.blake2_st Spec.Blake2S Core.M128 =
Impl.blake2 #Spec.Blake2S #Core.M128 blake2s_init blake2s_update blake2s_finish | false | true | Hacl.Blake2s_128.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val store_state128s_to_state32:Core.store_state_st Spec.Blake2S Core.M128 | [] | Hacl.Blake2s_128.store_state128s_to_state32 | {
"file_name": "code/blake2/Hacl.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Core.store_state_st Spec.Blake2.Blake2S Hacl.Impl.Blake2.Core.M128 | {
"end_col": 54,
"end_line": 51,
"start_col": 2,
"start_line": 51
} |
Prims.Tot | val blake2s_update_key:Impl.blake2_update_key_st Spec.Blake2S Core.M128 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let blake2s_update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 =
Impl.blake2_update_key #Spec.Blake2S #Core.M128 blake2s_update_block | val blake2s_update_key:Impl.blake2_update_key_st Spec.Blake2S Core.M128
let blake2s_update_key:Impl.blake2_update_key_st Spec.Blake2S Core.M128 = | false | null | false | Impl.blake2_update_key #Spec.Blake2S #Core.M128 blake2s_update_block | {
"checked_file": "Hacl.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_update_key",
"Spec.Blake2.Blake2S",
"Hacl.Impl.Blake2.Core.M128",
"Hacl.Blake2s_128.blake2s_update_block"
] | [] | module Hacl.Blake2s_128
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2s_update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128
let blake2s_init : Impl.blake2_init_st Spec.Blake2S Core.M128 =
Impl.blake2_init #Spec.Blake2S #Core.M128 | false | false | Hacl.Blake2s_128.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2s_update_key:Impl.blake2_update_key_st Spec.Blake2S Core.M128 | [] | Hacl.Blake2s_128.blake2s_update_key | {
"file_name": "code/blake2/Hacl.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_update_key_st Spec.Blake2.Blake2S Hacl.Impl.Blake2.Core.M128 | {
"end_col": 70,
"end_line": 17,
"start_col": 2,
"start_line": 17
} |
Prims.Tot | val blake2s_update_last:Impl.blake2_update_last_st Spec.Blake2S Core.M128 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let blake2s_update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 =
Impl.blake2_update_last #Spec.Blake2S #Core.M128 blake2s_update_block | val blake2s_update_last:Impl.blake2_update_last_st Spec.Blake2S Core.M128
let blake2s_update_last:Impl.blake2_update_last_st Spec.Blake2S Core.M128 = | false | null | false | Impl.blake2_update_last #Spec.Blake2S #Core.M128 blake2s_update_block | {
"checked_file": "Hacl.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_update_last",
"Spec.Blake2.Blake2S",
"Hacl.Impl.Blake2.Core.M128",
"Hacl.Blake2s_128.blake2s_update_block"
] | [] | module Hacl.Blake2s_128
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2s_update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128
let blake2s_init : Impl.blake2_init_st Spec.Blake2S Core.M128 =
Impl.blake2_init #Spec.Blake2S #Core.M128
let blake2s_update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 =
Impl.blake2_update_key #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 =
Impl.blake2_update_multi #Spec.Blake2S #Core.M128 blake2s_update_block | false | false | Hacl.Blake2s_128.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2s_update_last:Impl.blake2_update_last_st Spec.Blake2S Core.M128 | [] | Hacl.Blake2s_128.blake2s_update_last | {
"file_name": "code/blake2/Hacl.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_update_last_st Spec.Blake2.Blake2S Hacl.Impl.Blake2.Core.M128 | {
"end_col": 71,
"end_line": 23,
"start_col": 2,
"start_line": 23
} |
Prims.Tot | val load_state128s_from_state32:Core.load_state_st Spec.Blake2S Core.M128 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let load_state128s_from_state32: Core.load_state_st Spec.Blake2S Core.M128 =
Core.load_state_from_state32 #Spec.Blake2S #Core.M128 | val load_state128s_from_state32:Core.load_state_st Spec.Blake2S Core.M128
let load_state128s_from_state32:Core.load_state_st Spec.Blake2S Core.M128 = | false | null | false | Core.load_state_from_state32 #Spec.Blake2S #Core.M128 | {
"checked_file": "Hacl.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Core.load_state_from_state32",
"Spec.Blake2.Blake2S",
"Hacl.Impl.Blake2.Core.M128"
] | [] | module Hacl.Blake2s_128
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2s_update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128
let blake2s_init : Impl.blake2_init_st Spec.Blake2S Core.M128 =
Impl.blake2_init #Spec.Blake2S #Core.M128
let blake2s_update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 =
Impl.blake2_update_key #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 =
Impl.blake2_update_multi #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 =
Impl.blake2_update_last #Spec.Blake2S #Core.M128 blake2s_update_block
[@CInline]
private
let blake2s_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 =
Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 blake2s_update_multi blake2s_update_last
[@CInline]
private
let blake2s_update : Impl.blake2_update_st Spec.Blake2S Core.M128 =
Impl.blake2_update #Spec.Blake2S #Core.M128 blake2s_update_key blake2s_update_blocks
let blake2s_finish : Impl.blake2_finish_st Spec.Blake2S Core.M128 =
Impl.blake2_finish #Spec.Blake2S #Core.M128
(* The one-shot hash *)
[@@ Comment "Write the BLAKE2s digest of message `d` using key `k` into `output`.
@param nn Length of to-be-generated digest with 1 <= `nn` <= 32.
@param output Pointer to `nn` bytes of memory where the digest is written to.
@param ll Length of the input message.
@param d Pointer to `ll` bytes of memory where the input message is read from.
@param kk Length of the key. Can be 0.
@param k Pointer to `kk` bytes of memory where the key is read from."]
let blake2s : Impl.blake2_st Spec.Blake2S Core.M128 =
Impl.blake2 #Spec.Blake2S #Core.M128 blake2s_init blake2s_update blake2s_finish
let store_state128s_to_state32: Core.store_state_st Spec.Blake2S Core.M128 =
Core.store_state_to_state32 #Spec.Blake2S #Core.M128 | false | true | Hacl.Blake2s_128.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val load_state128s_from_state32:Core.load_state_st Spec.Blake2S Core.M128 | [] | Hacl.Blake2s_128.load_state128s_from_state32 | {
"file_name": "code/blake2/Hacl.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Core.load_state_st Spec.Blake2.Blake2S Hacl.Impl.Blake2.Core.M128 | {
"end_col": 55,
"end_line": 53,
"start_col": 2,
"start_line": 53
} |
Prims.Tot | val blake2s_malloc:Impl.blake2_malloc_st Spec.Blake2S Core.M128 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let blake2s_malloc : Impl.blake2_malloc_st Spec.Blake2S Core.M128 =
Impl.blake2_malloc Spec.Blake2S Core.M128 | val blake2s_malloc:Impl.blake2_malloc_st Spec.Blake2S Core.M128
let blake2s_malloc:Impl.blake2_malloc_st Spec.Blake2S Core.M128 = | false | null | false | Impl.blake2_malloc Spec.Blake2S Core.M128 | {
"checked_file": "Hacl.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_malloc",
"Spec.Blake2.Blake2S",
"Hacl.Impl.Blake2.Core.M128"
] | [] | module Hacl.Blake2s_128
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2s_update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128
let blake2s_init : Impl.blake2_init_st Spec.Blake2S Core.M128 =
Impl.blake2_init #Spec.Blake2S #Core.M128
let blake2s_update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 =
Impl.blake2_update_key #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 =
Impl.blake2_update_multi #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 =
Impl.blake2_update_last #Spec.Blake2S #Core.M128 blake2s_update_block
[@CInline]
private
let blake2s_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 =
Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 blake2s_update_multi blake2s_update_last
[@CInline]
private
let blake2s_update : Impl.blake2_update_st Spec.Blake2S Core.M128 =
Impl.blake2_update #Spec.Blake2S #Core.M128 blake2s_update_key blake2s_update_blocks
let blake2s_finish : Impl.blake2_finish_st Spec.Blake2S Core.M128 =
Impl.blake2_finish #Spec.Blake2S #Core.M128
(* The one-shot hash *)
[@@ Comment "Write the BLAKE2s digest of message `d` using key `k` into `output`.
@param nn Length of to-be-generated digest with 1 <= `nn` <= 32.
@param output Pointer to `nn` bytes of memory where the digest is written to.
@param ll Length of the input message.
@param d Pointer to `ll` bytes of memory where the input message is read from.
@param kk Length of the key. Can be 0.
@param k Pointer to `kk` bytes of memory where the key is read from."]
let blake2s : Impl.blake2_st Spec.Blake2S Core.M128 =
Impl.blake2 #Spec.Blake2S #Core.M128 blake2s_init blake2s_update blake2s_finish
let store_state128s_to_state32: Core.store_state_st Spec.Blake2S Core.M128 =
Core.store_state_to_state32 #Spec.Blake2S #Core.M128
let load_state128s_from_state32: Core.load_state_st Spec.Blake2S Core.M128 =
Core.load_state_from_state32 #Spec.Blake2S #Core.M128 | false | false | Hacl.Blake2s_128.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2s_malloc:Impl.blake2_malloc_st Spec.Blake2S Core.M128 | [] | Hacl.Blake2s_128.blake2s_malloc | {
"file_name": "code/blake2/Hacl.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_malloc_st Spec.Blake2.Blake2S Hacl.Impl.Blake2.Core.M128 | {
"end_col": 43,
"end_line": 56,
"start_col": 2,
"start_line": 56
} |
Prims.Tot | val blake2s_finish:Impl.blake2_finish_st Spec.Blake2S Core.M128 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let blake2s_finish : Impl.blake2_finish_st Spec.Blake2S Core.M128 =
Impl.blake2_finish #Spec.Blake2S #Core.M128 | val blake2s_finish:Impl.blake2_finish_st Spec.Blake2S Core.M128
let blake2s_finish:Impl.blake2_finish_st Spec.Blake2S Core.M128 = | false | null | false | Impl.blake2_finish #Spec.Blake2S #Core.M128 | {
"checked_file": "Hacl.Blake2s_128.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2s_128.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_finish",
"Spec.Blake2.Blake2S",
"Hacl.Impl.Blake2.Core.M128"
] | [] | module Hacl.Blake2s_128
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2s_update_block : Impl.blake2_update_block_st Spec.Blake2S Core.M128 =
Impl.blake2_update_block #Spec.Blake2S #Core.M128
let blake2s_init : Impl.blake2_init_st Spec.Blake2S Core.M128 =
Impl.blake2_init #Spec.Blake2S #Core.M128
let blake2s_update_key : Impl.blake2_update_key_st Spec.Blake2S Core.M128 =
Impl.blake2_update_key #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_multi : Impl.blake2_update_multi_st Spec.Blake2S Core.M128 =
Impl.blake2_update_multi #Spec.Blake2S #Core.M128 blake2s_update_block
let blake2s_update_last : Impl.blake2_update_last_st Spec.Blake2S Core.M128 =
Impl.blake2_update_last #Spec.Blake2S #Core.M128 blake2s_update_block
[@CInline]
private
let blake2s_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2S Core.M128 =
Impl.blake2_update_blocks #Spec.Blake2S #Core.M128 blake2s_update_multi blake2s_update_last
[@CInline]
private
let blake2s_update : Impl.blake2_update_st Spec.Blake2S Core.M128 =
Impl.blake2_update #Spec.Blake2S #Core.M128 blake2s_update_key blake2s_update_blocks | false | false | Hacl.Blake2s_128.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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2s_finish:Impl.blake2_finish_st Spec.Blake2S Core.M128 | [] | Hacl.Blake2s_128.blake2s_finish | {
"file_name": "code/blake2/Hacl.Blake2s_128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_finish_st Spec.Blake2.Blake2S Hacl.Impl.Blake2.Core.M128 | {
"end_col": 45,
"end_line": 36,
"start_col": 2,
"start_line": 36
} |
Prims.Tot | val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_codegen_success_CreateHeaplets () =
(va_ttrue ()) | val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool
let va_codegen_success_CreateHeaplets () = | false | null | false | (va_ttrue ()) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [
"total"
] | [
"Prims.unit",
"Vale.PPC64LE.Decls.va_ttrue",
"Vale.PPC64LE.Decls.va_pbool"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"] | false | true | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_codegen_success_CreateHeaplets : va_dummy:unit -> Tot va_pbool | [] | Vale.PPC64LE.InsMem.va_codegen_success_CreateHeaplets | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool | {
"end_col": 15,
"end_line": 29,
"start_col": 2,
"start_line": 29
} |
Prims.Tot | val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_code_CreateHeaplets () =
(Ins (S.Ghost ())) | val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code
let va_code_CreateHeaplets () = | false | null | false | (Ins (S.Ghost ())) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [
"total"
] | [
"Prims.unit",
"Vale.PPC64LE.Machine_s.Ins",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Vale.PPC64LE.Semantics_s.Ghost",
"Vale.PPC64LE.Decls.va_code"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"] | false | true | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_code_CreateHeaplets : va_dummy:unit -> Tot va_code | [] | Vale.PPC64LE.InsMem.va_code_CreateHeaplets | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code | {
"end_col": 20,
"end_line": 25,
"start_col": 2,
"start_line": 25
} |
Prims.Tot | val va_code_DestroyHeaplets : va_dummy:unit -> Tot va_code | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_code_DestroyHeaplets () =
(Ins (S.Ghost ())) | val va_code_DestroyHeaplets : va_dummy:unit -> Tot va_code
let va_code_DestroyHeaplets () = | false | null | false | (Ins (S.Ghost ())) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [
"total"
] | [
"Prims.unit",
"Vale.PPC64LE.Machine_s.Ins",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Vale.PPC64LE.Semantics_s.Ghost",
"Vale.PPC64LE.Decls.va_code"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- DestroyHeaplets
[@ "opaque_to_smt"] | false | true | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_code_DestroyHeaplets : va_dummy:unit -> Tot va_code | [] | Vale.PPC64LE.InsMem.va_code_DestroyHeaplets | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code | {
"end_col": 20,
"end_line": 60,
"start_col": 2,
"start_line": 60
} |
Prims.Tot | val va_code_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr
-> offset:int -> t:taint -> Tot va_code | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_code_MemLoad64 h dst base offset t =
(Ins (S.Load64 dst base offset)) | val va_code_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr
-> offset:int -> t:taint -> Tot va_code
let va_code_MemLoad64 h dst base offset t = | false | null | false | (Ins (S.Load64 dst base offset)) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [
"total"
] | [
"Vale.PPC64LE.Decls.va_operand_heaplet",
"Vale.PPC64LE.Decls.va_operand_reg_opr",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Machine_s.Ins",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Vale.PPC64LE.Semantics_s.Load64",
"Vale.PPC64LE.Decls.va_code"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- DestroyHeaplets
[@ "opaque_to_smt"]
let va_code_DestroyHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_DestroyHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_DestroyHeaplets va_b0 va_s0 =
va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let va_sM = destroy_heaplets_this va_sM in
Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_DestroyHeaplets va_s0 va_k =
let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- MemLoad64
[@ "opaque_to_smt"] | false | true | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_code_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr -> base:va_operand_reg_opr
-> offset:int -> t:taint -> Tot va_code | [] | Vale.PPC64LE.InsMem.va_code_MemLoad64 | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
h: Vale.PPC64LE.Decls.va_operand_heaplet ->
dst: Vale.PPC64LE.Decls.va_operand_reg_opr ->
base: Vale.PPC64LE.Decls.va_operand_reg_opr ->
offset: Prims.int ->
t: Vale.Arch.HeapTypes_s.taint
-> Vale.PPC64LE.Decls.va_code | {
"end_col": 34,
"end_line": 93,
"start_col": 2,
"start_line": 93
} |
Prims.GTot | val create_heaplets_this (buffers: list buffer_info) (s: state) : GTot state | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap} | val create_heaplets_this (buffers: list buffer_info) (s: state) : GTot state
let create_heaplets_this (buffers: list buffer_info) (s: state) : GTot state = | false | null | false | { s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap } | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [
"sometrivial"
] | [
"Prims.list",
"Vale.Arch.HeapImpl.buffer_info",
"Vale.PPC64LE.State.state",
"Vale.PPC64LE.Machine_s.Mkstate",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ok",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__regs",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__vecs",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__cr0",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__xer",
"Vale.PPC64LE.Memory_Sems.create_heaplets",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stack",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stackTaint"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20" | false | false | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val create_heaplets_this (buffers: list buffer_info) (s: state) : GTot state | [] | Vale.PPC64LE.InsMem.create_heaplets_this | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | buffers: Prims.list Vale.Arch.HeapImpl.buffer_info -> s: Vale.PPC64LE.State.state
-> Prims.GTot Vale.PPC64LE.State.state | {
"end_col": 78,
"end_line": 14,
"start_col": 3,
"start_line": 14
} |
Prims.Tot | val va_code_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr
-> offset:int -> t:taint -> Tot va_code | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_code_MemStore64 h src base offset t =
(Ins (S.Store64 src base offset)) | val va_code_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr
-> offset:int -> t:taint -> Tot va_code
let va_code_MemStore64 h src base offset t = | false | null | false | (Ins (S.Store64 src base offset)) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [
"total"
] | [
"Vale.PPC64LE.Decls.va_operand_heaplet",
"Vale.PPC64LE.Decls.va_operand_reg_opr",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Machine_s.Ins",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Vale.PPC64LE.Semantics_s.Store64",
"Vale.PPC64LE.Decls.va_code"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- DestroyHeaplets
[@ "opaque_to_smt"]
let va_code_DestroyHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_DestroyHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_DestroyHeaplets va_b0 va_s0 =
va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let va_sM = destroy_heaplets_this va_sM in
Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_DestroyHeaplets va_s0 va_k =
let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- MemLoad64
[@ "opaque_to_smt"]
let va_code_MemLoad64 h dst base offset t =
(Ins (S.Load64 dst base offset))
[@ "opaque_to_smt"]
let va_codegen_success_MemLoad64 h dst base offset t =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index =
va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t);
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in
Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl
(va_sM.ms_heap)) t h;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_MemLoad64 h dst base offset t b index va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MemLoad64 (va_code_MemLoad64 h dst base offset t) va_s0 h dst base
offset t b index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));
va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- MemStore64
[@ "opaque_to_smt"] | false | true | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_code_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr -> base:va_operand_reg_opr
-> offset:int -> t:taint -> Tot va_code | [] | Vale.PPC64LE.InsMem.va_code_MemStore64 | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
h: Vale.PPC64LE.Decls.va_operand_heaplet ->
src: Vale.PPC64LE.Decls.va_operand_reg_opr ->
base: Vale.PPC64LE.Decls.va_operand_reg_opr ->
offset: Prims.int ->
t: Vale.Arch.HeapTypes_s.taint
-> Vale.PPC64LE.Decls.va_code | {
"end_col": 35,
"end_line": 125,
"start_col": 2,
"start_line": 125
} |
Prims.Tot | val va_codegen_success_DestroyHeaplets : va_dummy:unit -> Tot va_pbool | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_codegen_success_DestroyHeaplets () =
(va_ttrue ()) | val va_codegen_success_DestroyHeaplets : va_dummy:unit -> Tot va_pbool
let va_codegen_success_DestroyHeaplets () = | false | null | false | (va_ttrue ()) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [
"total"
] | [
"Prims.unit",
"Vale.PPC64LE.Decls.va_ttrue",
"Vale.PPC64LE.Decls.va_pbool"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- DestroyHeaplets
[@ "opaque_to_smt"]
let va_code_DestroyHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"] | false | true | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_codegen_success_DestroyHeaplets : va_dummy:unit -> Tot va_pbool | [] | Vale.PPC64LE.InsMem.va_codegen_success_DestroyHeaplets | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool | {
"end_col": 15,
"end_line": 64,
"start_col": 2,
"start_line": 64
} |
Prims.Tot | val va_codegen_success_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr ->
base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_codegen_success_MemLoad64 h dst base offset t =
(va_ttrue ()) | val va_codegen_success_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr ->
base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool
let va_codegen_success_MemLoad64 h dst base offset t = | false | null | false | (va_ttrue ()) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [
"total"
] | [
"Vale.PPC64LE.Decls.va_operand_heaplet",
"Vale.PPC64LE.Decls.va_operand_reg_opr",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Decls.va_ttrue",
"Vale.PPC64LE.Decls.va_pbool"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- DestroyHeaplets
[@ "opaque_to_smt"]
let va_code_DestroyHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_DestroyHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_DestroyHeaplets va_b0 va_s0 =
va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let va_sM = destroy_heaplets_this va_sM in
Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_DestroyHeaplets va_s0 va_k =
let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- MemLoad64
[@ "opaque_to_smt"]
let va_code_MemLoad64 h dst base offset t =
(Ins (S.Load64 dst base offset))
[@ "opaque_to_smt"] | false | true | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_codegen_success_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr ->
base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool | [] | Vale.PPC64LE.InsMem.va_codegen_success_MemLoad64 | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
h: Vale.PPC64LE.Decls.va_operand_heaplet ->
dst: Vale.PPC64LE.Decls.va_operand_reg_opr ->
base: Vale.PPC64LE.Decls.va_operand_reg_opr ->
offset: Prims.int ->
t: Vale.Arch.HeapTypes_s.taint
-> Vale.PPC64LE.Decls.va_pbool | {
"end_col": 15,
"end_line": 97,
"start_col": 2,
"start_line": 97
} |
Prims.Tot | val va_codegen_success_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr ->
base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_codegen_success_MemStore64 h src base offset t =
(va_ttrue ()) | val va_codegen_success_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr ->
base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool
let va_codegen_success_MemStore64 h src base offset t = | false | null | false | (va_ttrue ()) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [
"total"
] | [
"Vale.PPC64LE.Decls.va_operand_heaplet",
"Vale.PPC64LE.Decls.va_operand_reg_opr",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Decls.va_ttrue",
"Vale.PPC64LE.Decls.va_pbool"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- DestroyHeaplets
[@ "opaque_to_smt"]
let va_code_DestroyHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_DestroyHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_DestroyHeaplets va_b0 va_s0 =
va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let va_sM = destroy_heaplets_this va_sM in
Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_DestroyHeaplets va_s0 va_k =
let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- MemLoad64
[@ "opaque_to_smt"]
let va_code_MemLoad64 h dst base offset t =
(Ins (S.Load64 dst base offset))
[@ "opaque_to_smt"]
let va_codegen_success_MemLoad64 h dst base offset t =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index =
va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t);
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in
Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl
(va_sM.ms_heap)) t h;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_MemLoad64 h dst base offset t b index va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MemLoad64 (va_code_MemLoad64 h dst base offset t) va_s0 h dst base
offset t b index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));
va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- MemStore64
[@ "opaque_to_smt"]
let va_code_MemStore64 h src base offset t =
(Ins (S.Store64 src base offset))
[@ "opaque_to_smt"] | false | true | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_codegen_success_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr ->
base:va_operand_reg_opr -> offset:int -> t:taint -> Tot va_pbool | [] | Vale.PPC64LE.InsMem.va_codegen_success_MemStore64 | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
h: Vale.PPC64LE.Decls.va_operand_heaplet ->
src: Vale.PPC64LE.Decls.va_operand_reg_opr ->
base: Vale.PPC64LE.Decls.va_operand_reg_opr ->
offset: Prims.int ->
t: Vale.Arch.HeapTypes_s.taint
-> Vale.PPC64LE.Decls.va_pbool | {
"end_col": 15,
"end_line": 129,
"start_col": 2,
"start_line": 129
} |
Prims.Ghost | val destroy_heaplets_this (s: state) : Ghost state (requires state_inv s) (ensures fun _ -> True) | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap} | val destroy_heaplets_this (s: state) : Ghost state (requires state_inv s) (ensures fun _ -> True)
let destroy_heaplets_this (s: state) : Ghost state (requires state_inv s) (ensures fun _ -> True) = | false | null | false | { s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap } | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [] | [
"Vale.PPC64LE.State.state",
"Vale.PPC64LE.Machine_s.Mkstate",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ok",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__regs",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__vecs",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__cr0",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__xer",
"Vale.PPC64LE.Memory_Sems.destroy_heaplets",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stack",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_stackTaint",
"Vale.PPC64LE.Decls.state_inv",
"Prims.l_True"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True) | false | false | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val destroy_heaplets_this (s: state) : Ghost state (requires state_inv s) (ensures fun _ -> True) | [] | Vale.PPC64LE.InsMem.destroy_heaplets_this | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: Vale.PPC64LE.State.state -> Prims.Ghost Vale.PPC64LE.State.state | {
"end_col": 71,
"end_line": 20,
"start_col": 3,
"start_line": 20
} |
Prims.Ghost | val va_wpProof_CreateHeaplets : buffers:(list buffer_info) -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_CreateHeaplets buffers va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_CreateHeaplets ())
([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | val va_wpProof_CreateHeaplets : buffers:(list buffer_info) -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_CreateHeaplets buffers va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_CreateHeaplets ())
([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_CreateHeaplets buffers va_s0 va_k = | false | null | false | let va_sM, va_f0 = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [] | [
"Prims.list",
"Vale.Arch.HeapImpl.buffer_info",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_mem_layout",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_mem_layout",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.InsMem.va_lemma_CreateHeaplets",
"Vale.PPC64LE.InsMem.va_code_CreateHeaplets"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM) | false | false | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wpProof_CreateHeaplets : buffers:(list buffer_info) -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_CreateHeaplets buffers va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_CreateHeaplets ())
([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) | [] | Vale.PPC64LE.InsMem.va_wpProof_CreateHeaplets | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
buffers: Prims.list Vale.Arch.HeapImpl.buffer_info ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | {
"end_col": 22,
"end_line": 53,
"start_col": 50,
"start_line": 47
} |
Prims.Ghost | val va_wpProof_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr ->
base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MemLoad64 h dst base offset t b index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemLoad64 h dst base offset t)
([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_wpProof_MemLoad64 h dst base offset t b index va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MemLoad64 (va_code_MemLoad64 h dst base offset t) va_s0 h dst base
offset t b index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));
va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | val va_wpProof_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr ->
base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MemLoad64 h dst base offset t b index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemLoad64 h dst base offset t)
([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_MemLoad64 h dst base offset t b index va_s0 va_k = | false | null | false | let va_sM, va_f0 =
va_lemma_MemLoad64 (va_code_MemLoad64 h dst base offset t) va_s0 h dst base offset t b index
in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));
va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [] | [
"Vale.PPC64LE.Decls.va_operand_heaplet",
"Vale.PPC64LE.Decls.va_operand_reg_opr",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Memory.buffer64",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_mod_reg_opr",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_update_operand_reg_opr",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.InsMem.va_lemma_MemLoad64",
"Vale.PPC64LE.InsMem.va_code_MemLoad64"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- DestroyHeaplets
[@ "opaque_to_smt"]
let va_code_DestroyHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_DestroyHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_DestroyHeaplets va_b0 va_s0 =
va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let va_sM = destroy_heaplets_this va_sM in
Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_DestroyHeaplets va_s0 va_k =
let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- MemLoad64
[@ "opaque_to_smt"]
let va_code_MemLoad64 h dst base offset t =
(Ins (S.Load64 dst base offset))
[@ "opaque_to_smt"]
let va_codegen_success_MemLoad64 h dst base offset t =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index =
va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t);
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in
Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl
(va_sM.ms_heap)) t h;
(va_sM, va_fM) | false | false | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wpProof_MemLoad64 : h:va_operand_heaplet -> dst:va_operand_reg_opr ->
base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MemLoad64 h dst base offset t b index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemLoad64 h dst base offset t)
([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) | [] | Vale.PPC64LE.InsMem.va_wpProof_MemLoad64 | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
h: Vale.PPC64LE.Decls.va_operand_heaplet ->
dst: Vale.PPC64LE.Decls.va_operand_reg_opr ->
base: Vale.PPC64LE.Decls.va_operand_reg_opr ->
offset: Prims.int ->
t: Vale.Arch.HeapTypes_s.taint ->
b: Vale.PPC64LE.Memory.buffer64 ->
index: Prims.int ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | {
"end_col": 22,
"end_line": 118,
"start_col": 65,
"start_line": 111
} |
Prims.Ghost | val va_wpProof_DestroyHeaplets : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_DestroyHeaplets va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_DestroyHeaplets ())
([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_wpProof_DestroyHeaplets va_s0 va_k =
let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | val va_wpProof_DestroyHeaplets : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_DestroyHeaplets va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_DestroyHeaplets ())
([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_DestroyHeaplets va_s0 va_k = | false | null | false | let va_sM, va_f0 = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [] | [
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_mem_layout",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_mem_layout",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.InsMem.va_lemma_DestroyHeaplets",
"Vale.PPC64LE.InsMem.va_code_DestroyHeaplets"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- DestroyHeaplets
[@ "opaque_to_smt"]
let va_code_DestroyHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_DestroyHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_DestroyHeaplets va_b0 va_s0 =
va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let va_sM = destroy_heaplets_this va_sM in
Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM) | false | false | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wpProof_DestroyHeaplets : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_DestroyHeaplets va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_DestroyHeaplets ())
([va_Mod_mem_layout]) va_s0 va_k ((va_sM, va_f0, va_g)))) | [] | Vale.PPC64LE.InsMem.va_wpProof_DestroyHeaplets | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | {
"end_col": 22,
"end_line": 86,
"start_col": 43,
"start_line": 80
} |
Prims.Ghost | val va_wpProof_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr ->
base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MemStore64 h src base offset t b index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemStore64 h src base offset t)
([va_Mod_mem; va_mod_heaplet h]) va_s0 va_k ((va_sM, va_f0, va_g)))) | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_wpProof_MemStore64 h src base offset t b index va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MemStore64 (va_code_MemStore64 h src base offset t) va_s0 h src
base offset t b index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem va_sM (va_update_ok va_sM (va_update_operand_heaplet h
va_sM va_s0))));
va_lemma_norm_mods ([va_Mod_mem; va_mod_heaplet h]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | val va_wpProof_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr ->
base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MemStore64 h src base offset t b index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemStore64 h src base offset t)
([va_Mod_mem; va_mod_heaplet h]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_MemStore64 h src base offset t b index va_s0 va_k = | false | null | false | let va_sM, va_f0 =
va_lemma_MemStore64 (va_code_MemStore64 h src base offset t) va_s0 h src base offset t b index
in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_mem va_sM (va_update_ok va_sM (va_update_operand_heaplet h va_sM va_s0))));
va_lemma_norm_mods ([va_Mod_mem; va_mod_heaplet h]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [] | [
"Vale.PPC64LE.Decls.va_operand_heaplet",
"Vale.PPC64LE.Decls.va_operand_reg_opr",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Memory.buffer64",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_mem",
"Vale.PPC64LE.QuickCode.va_mod_heaplet",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_mem",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_update_operand_heaplet",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.InsMem.va_lemma_MemStore64",
"Vale.PPC64LE.InsMem.va_code_MemStore64"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- DestroyHeaplets
[@ "opaque_to_smt"]
let va_code_DestroyHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_DestroyHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_DestroyHeaplets va_b0 va_s0 =
va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let va_sM = destroy_heaplets_this va_sM in
Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_DestroyHeaplets va_s0 va_k =
let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- MemLoad64
[@ "opaque_to_smt"]
let va_code_MemLoad64 h dst base offset t =
(Ins (S.Load64 dst base offset))
[@ "opaque_to_smt"]
let va_codegen_success_MemLoad64 h dst base offset t =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index =
va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t);
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in
Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl
(va_sM.ms_heap)) t h;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_MemLoad64 h dst base offset t b index va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MemLoad64 (va_code_MemLoad64 h dst base offset t) va_s0 h dst base
offset t b index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));
va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- MemStore64
[@ "opaque_to_smt"]
let va_code_MemStore64 h src base offset t =
(Ins (S.Store64 src base offset))
[@ "opaque_to_smt"]
let va_codegen_success_MemStore64 h src base offset t =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_MemStore64 va_b0 va_s0 h src base offset t b index =
va_reveal_opaque (`%va_code_MemStore64) (va_code_MemStore64 h src base offset t);
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Store64 src base offset)) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Store64 src base offset)) va_s0 in
Vale.PPC64LE.Memory_Sems.low_lemma_store_mem64_full b index (va_eval_reg_opr va_old_s src)
(Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)) t h;
(va_sM, va_fM) | false | false | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wpProof_MemStore64 : h:va_operand_heaplet -> src:va_operand_reg_opr ->
base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 -> index:int -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_MemStore64 h src base offset t b index va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MemStore64 h src base offset t)
([va_Mod_mem; va_mod_heaplet h]) va_s0 va_k ((va_sM, va_f0, va_g)))) | [] | Vale.PPC64LE.InsMem.va_wpProof_MemStore64 | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
h: Vale.PPC64LE.Decls.va_operand_heaplet ->
src: Vale.PPC64LE.Decls.va_operand_reg_opr ->
base: Vale.PPC64LE.Decls.va_operand_reg_opr ->
offset: Prims.int ->
t: Vale.Arch.HeapTypes_s.taint ->
b: Vale.PPC64LE.Memory.buffer64 ->
index: Prims.int ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | {
"end_col": 22,
"end_line": 151,
"start_col": 66,
"start_line": 143
} |
Prims.Ghost | val va_lemma_DestroyHeaplets : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_DestroyHeaplets ()) va_s0 /\ va_get_ok va_s0 /\
Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout
va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner))
(va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint
/\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) .
{:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==>
Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout
va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM)
(Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ va_state_eq va_sM (va_update_mem_layout
va_sM (va_update_ok va_sM va_s0)))) | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_lemma_DestroyHeaplets va_b0 va_s0 =
va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let va_sM = destroy_heaplets_this va_sM in
Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM) | val va_lemma_DestroyHeaplets : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_DestroyHeaplets ()) va_s0 /\ va_get_ok va_s0 /\
Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout
va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner))
(va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint
/\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) .
{:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==>
Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout
va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM)
(Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ va_state_eq va_sM (va_update_mem_layout
va_sM (va_update_ok va_sM va_s0))))
let va_lemma_DestroyHeaplets va_b0 va_s0 = | false | null | false | va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ());
let va_old_s:va_state = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let va_sM, va_fM = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let va_sM = destroy_heaplets_this va_sM in
Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap
));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Vale.PPC64LE.State.state",
"Vale.PPC64LE.Lemmas.fuel",
"FStar.Pervasives.Native.Mktuple2",
"Vale.PPC64LE.Decls.va_fuel",
"Prims.unit",
"Vale.PPC64LE.State.use_machine_state_equal",
"Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets",
"Vale.PPC64LE.Decls.from_heap_impl",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.InsMem.destroy_heaplets_this",
"FStar.Pervasives.Native.tuple2",
"Prims.nat",
"Vale.PPC64LE.Decls.va_eval_ins",
"Vale.PPC64LE.Machine_s.Ins",
"Vale.PPC64LE.Semantics_s.ins",
"Vale.PPC64LE.Semantics_s.ocmp",
"Vale.PPC64LE.Semantics_s.Ghost",
"Vale.PPC64LE.Decls.va_ins_lemma",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Vale.PPC64LE.Decls.va_reveal_opaque",
"Vale.PPC64LE.InsMem.va_code_DestroyHeaplets"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- DestroyHeaplets
[@ "opaque_to_smt"]
let va_code_DestroyHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_DestroyHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"] | false | false | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_lemma_DestroyHeaplets : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_DestroyHeaplets ()) va_s0 /\ va_get_ok va_s0 /\
Vale.PPC64LE.Memory.layout_heaplets_initialized ((va_get_mem_layout va_s0).vl_inner)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout
va_s0).vl_inner)) (Vale.PPC64LE.Memory.layout_old_heap ((va_get_mem_layout va_s0).vl_inner))
(va_get_mem va_sM) /\ (va_get_mem_layout va_sM).vl_taint == (va_get_mem_layout va_s0).vl_taint
/\ heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) .
{:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==>
Vale.PPC64LE.Memory.heaps_match (Vale.PPC64LE.Memory.layout_buffers ((va_get_mem_layout
va_s0).vl_inner)) ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM)
(Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h) /\ va_state_eq va_sM (va_update_mem_layout
va_sM (va_update_ok va_sM va_s0)))) | [] | Vale.PPC64LE.InsMem.va_lemma_DestroyHeaplets | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | va_b0: Vale.PPC64LE.Decls.va_code -> va_s0: Vale.PPC64LE.Decls.va_state
-> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) | {
"end_col": 16,
"end_line": 76,
"start_col": 2,
"start_line": 68
} |
Prims.Ghost | val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let
(bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list
(Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==>
Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\
Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc
(Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap
((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers
((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized
((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint ==
(va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\
heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) .
{:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some
(Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs
((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet
h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length
#buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index
#Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout
va_sM (va_update_ok va_sM va_s0)))) | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM) | val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let
(bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list
(Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==>
Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\
Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc
(Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap
((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers
((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized
((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint ==
(va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\
heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) .
{:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some
(Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs
((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet
h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length
#buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index
#Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout
va_sM (va_update_ok va_sM va_s0))))
let va_lemma_CreateHeaplets va_b0 va_s0 buffers = | false | null | false | va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let va_old_s:va_state = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let va_sM, va_fM = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let bs:(FStar.Seq.Base.seq buffer_info) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers
(Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Prims.list",
"Vale.Arch.HeapImpl.buffer_info",
"Vale.PPC64LE.State.state",
"Vale.PPC64LE.Lemmas.fuel",
"FStar.Pervasives.Native.Mktuple2",
"Vale.PPC64LE.Decls.va_fuel",
"Prims.unit",
"Vale.PPC64LE.State.use_machine_state_equal",
"Vale.PPC64LE.Memory_Sems.lemma_create_heaplets",
"Vale.PPC64LE.Decls.from_heap_impl",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.InsMem.create_heaplets_this",
"Vale.Lib.Seqs.lemma_list_to_seq",
"FStar.Seq.Base.seq",
"Vale.Lib.Seqs.list_to_seq",
"FStar.Pervasives.Native.tuple2",
"Prims.nat",
"Vale.PPC64LE.Decls.va_eval_ins",
"Vale.PPC64LE.Machine_s.Ins",
"Vale.PPC64LE.Semantics_s.ins",
"Vale.PPC64LE.Semantics_s.ocmp",
"Vale.PPC64LE.Semantics_s.Ghost",
"Vale.PPC64LE.Decls.va_ins_lemma",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Vale.PPC64LE.Decls.va_reveal_opaque",
"Vale.PPC64LE.InsMem.va_code_CreateHeaplets"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"] | false | false | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let
(bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list
(Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==>
Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\
Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc
(Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap
((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers
((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized
((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint ==
(va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\
heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) .
{:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some
(Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs
((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet
h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length
#buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index
#Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout
va_sM (va_update_ok va_sM va_s0)))) | [] | Vale.PPC64LE.InsMem.va_lemma_CreateHeaplets | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
va_b0: Vale.PPC64LE.Decls.va_code ->
va_s0: Vale.PPC64LE.Decls.va_state ->
buffers: Prims.list Vale.Arch.HeapImpl.buffer_info
-> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) | {
"end_col": 16,
"end_line": 43,
"start_col": 2,
"start_line": 33
} |
Prims.Ghost | val va_lemma_MemStore64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet ->
src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 ->
index:int
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MemStore64 h src base offset t) va_s0 /\
va_is_dst_heaplet h va_s0 /\ va_is_src_reg_opr src va_s0 /\ va_is_src_reg_opr base va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\
Vale.PPC64LE.Decls.valid_dst_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b
index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b
(va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) true /\
Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout
va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr
#Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_heaplet va_sM h == buffer64_write b index (va_eval_reg_opr va_s0 src) (va_eval_heaplet
va_s0 h) /\ va_state_eq va_sM (va_update_mem va_sM (va_update_ok va_sM
(va_update_operand_heaplet h va_sM va_s0))))) | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_lemma_MemStore64 va_b0 va_s0 h src base offset t b index =
va_reveal_opaque (`%va_code_MemStore64) (va_code_MemStore64 h src base offset t);
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Store64 src base offset)) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Store64 src base offset)) va_s0 in
Vale.PPC64LE.Memory_Sems.low_lemma_store_mem64_full b index (va_eval_reg_opr va_old_s src)
(Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap)) t h;
(va_sM, va_fM) | val va_lemma_MemStore64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet ->
src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 ->
index:int
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MemStore64 h src base offset t) va_s0 /\
va_is_dst_heaplet h va_s0 /\ va_is_src_reg_opr src va_s0 /\ va_is_src_reg_opr base va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\
Vale.PPC64LE.Decls.valid_dst_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b
index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b
(va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) true /\
Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout
va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr
#Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_heaplet va_sM h == buffer64_write b index (va_eval_reg_opr va_s0 src) (va_eval_heaplet
va_s0 h) /\ va_state_eq va_sM (va_update_mem va_sM (va_update_ok va_sM
(va_update_operand_heaplet h va_sM va_s0)))))
let va_lemma_MemStore64 va_b0 va_s0 h src base offset t b index = | false | null | false | va_reveal_opaque (`%va_code_MemStore64) (va_code_MemStore64 h src base offset t);
let va_old_s:va_state = va_s0 in
va_ins_lemma (Ins (S.Store64 src base offset)) va_s0;
let va_sM, va_fM = va_eval_ins (Ins (S.Store64 src base offset)) va_s0 in
Vale.PPC64LE.Memory_Sems.low_lemma_store_mem64_full b
index
(va_eval_reg_opr va_old_s src)
(Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap))
t
h;
(va_sM, va_fM) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Vale.PPC64LE.Decls.va_operand_heaplet",
"Vale.PPC64LE.Decls.va_operand_reg_opr",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Memory.buffer64",
"Vale.PPC64LE.State.state",
"Vale.PPC64LE.Lemmas.fuel",
"FStar.Pervasives.Native.Mktuple2",
"Vale.PPC64LE.Decls.va_fuel",
"Prims.unit",
"Vale.PPC64LE.Memory_Sems.low_lemma_store_mem64_full",
"Vale.PPC64LE.Decls.va_eval_reg_opr",
"Vale.PPC64LE.Decls.from_heap_impl",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Prims.nat",
"Vale.PPC64LE.Decls.va_eval_ins",
"Vale.PPC64LE.Machine_s.Ins",
"Vale.PPC64LE.Semantics_s.ins",
"Vale.PPC64LE.Semantics_s.ocmp",
"Vale.PPC64LE.Semantics_s.Store64",
"Vale.PPC64LE.Decls.va_ins_lemma",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Vale.PPC64LE.Decls.va_reveal_opaque",
"Vale.PPC64LE.InsMem.va_code_MemStore64"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- DestroyHeaplets
[@ "opaque_to_smt"]
let va_code_DestroyHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_DestroyHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_DestroyHeaplets va_b0 va_s0 =
va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let va_sM = destroy_heaplets_this va_sM in
Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_DestroyHeaplets va_s0 va_k =
let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- MemLoad64
[@ "opaque_to_smt"]
let va_code_MemLoad64 h dst base offset t =
(Ins (S.Load64 dst base offset))
[@ "opaque_to_smt"]
let va_codegen_success_MemLoad64 h dst base offset t =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index =
va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t);
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in
Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl
(va_sM.ms_heap)) t h;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_MemLoad64 h dst base offset t b index va_s0 va_k =
let (va_sM, va_f0) = va_lemma_MemLoad64 (va_code_MemLoad64 h dst base offset t) va_s0 h dst base
offset t b index in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));
va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- MemStore64
[@ "opaque_to_smt"]
let va_code_MemStore64 h src base offset t =
(Ins (S.Store64 src base offset))
[@ "opaque_to_smt"]
let va_codegen_success_MemStore64 h src base offset t =
(va_ttrue ())
[@"opaque_to_smt"] | false | false | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_lemma_MemStore64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet ->
src:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 ->
index:int
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MemStore64 h src base offset t) va_s0 /\
va_is_dst_heaplet h va_s0 /\ va_is_src_reg_opr src va_s0 /\ va_is_src_reg_opr base va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\
Vale.PPC64LE.Decls.valid_dst_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b
index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b
(va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) true /\
Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout
va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr
#Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_heaplet va_sM h == buffer64_write b index (va_eval_reg_opr va_s0 src) (va_eval_heaplet
va_s0 h) /\ va_state_eq va_sM (va_update_mem va_sM (va_update_ok va_sM
(va_update_operand_heaplet h va_sM va_s0))))) | [] | Vale.PPC64LE.InsMem.va_lemma_MemStore64 | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
va_b0: Vale.PPC64LE.Decls.va_code ->
va_s0: Vale.PPC64LE.Decls.va_state ->
h: Vale.PPC64LE.Decls.va_operand_heaplet ->
src: Vale.PPC64LE.Decls.va_operand_reg_opr ->
base: Vale.PPC64LE.Decls.va_operand_reg_opr ->
offset: Prims.int ->
t: Vale.Arch.HeapTypes_s.taint ->
b: Vale.PPC64LE.Memory.buffer64 ->
index: Prims.int
-> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) | {
"end_col": 16,
"end_line": 139,
"start_col": 2,
"start_line": 133
} |
Prims.Ghost | val va_lemma_MemLoad64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet ->
dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 ->
index:int
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MemLoad64 h dst base offset t) va_s0 /\
va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\
Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b
index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b
(va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\
Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout
va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr
#Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h)
/\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)))) | [
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index =
va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t);
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in
Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b index (Vale.PPC64LE.Decls.from_heap_impl
(va_sM.ms_heap)) t h;
(va_sM, va_fM) | val va_lemma_MemLoad64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet ->
dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 ->
index:int
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MemLoad64 h dst base offset t) va_s0 /\
va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\
Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b
index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b
(va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\
Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout
va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr
#Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h)
/\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))))
let va_lemma_MemLoad64 va_b0 va_s0 h dst base offset t b index = | false | null | false | va_reveal_opaque (`%va_code_MemLoad64) (va_code_MemLoad64 h dst base offset t);
let va_old_s:va_state = va_s0 in
va_ins_lemma (Ins (S.Load64 dst base offset)) va_s0;
let va_sM, va_fM = va_eval_ins (Ins (S.Load64 dst base offset)) va_s0 in
Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full b
index
(Vale.PPC64LE.Decls.from_heap_impl (va_sM.ms_heap))
t
h;
(va_sM, va_fM) | {
"checked_file": "Vale.PPC64LE.InsMem.fst.checked",
"dependencies": [
"Vale.PPC64LE.StateLemmas.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.PPC64LE.Memory_Sems.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.PPC64LE.Decls.fst.checked",
"Vale.Lib.Seqs.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.InsMem.fst"
} | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Vale.PPC64LE.Decls.va_operand_heaplet",
"Vale.PPC64LE.Decls.va_operand_reg_opr",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Memory.buffer64",
"Vale.PPC64LE.State.state",
"Vale.PPC64LE.Lemmas.fuel",
"FStar.Pervasives.Native.Mktuple2",
"Vale.PPC64LE.Decls.va_fuel",
"Prims.unit",
"Vale.PPC64LE.Memory_Sems.low_lemma_load_mem64_full",
"Vale.PPC64LE.Decls.from_heap_impl",
"Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Prims.nat",
"Vale.PPC64LE.Decls.va_eval_ins",
"Vale.PPC64LE.Machine_s.Ins",
"Vale.PPC64LE.Semantics_s.ins",
"Vale.PPC64LE.Semantics_s.ocmp",
"Vale.PPC64LE.Semantics_s.Load64",
"Vale.PPC64LE.Decls.va_ins_lemma",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Vale.PPC64LE.Decls.va_reveal_opaque",
"Vale.PPC64LE.InsMem.va_code_MemLoad64"
] | [] | module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s
friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
{s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}
let destroy_heaplets_this (s:state) : Ghost state
(requires state_inv s)
(ensures fun _ -> True)
=
{s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets
[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_CreateHeaplets buffers va_s0 va_k =
let (va_sM, va_f0) = va_lemma_CreateHeaplets (va_code_CreateHeaplets ()) va_s0 buffers in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- DestroyHeaplets
[@ "opaque_to_smt"]
let va_code_DestroyHeaplets () =
(Ins (S.Ghost ()))
[@ "opaque_to_smt"]
let va_codegen_success_DestroyHeaplets () =
(va_ttrue ())
[@"opaque_to_smt"]
let va_lemma_DestroyHeaplets va_b0 va_s0 =
va_reveal_opaque (`%va_code_DestroyHeaplets) (va_code_DestroyHeaplets ());
let (va_old_s:va_state) = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let va_sM = destroy_heaplets_this va_sM in
Vale.PPC64LE.Memory_Sems.lemma_destroy_heaplets (Vale.PPC64LE.Decls.from_heap_impl
(va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_DestroyHeaplets va_s0 va_k =
let (va_sM, va_f0) = va_lemma_DestroyHeaplets (va_code_DestroyHeaplets ()) va_s0 in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_ok va_sM va_s0)));
va_lemma_norm_mods ([va_Mod_mem_layout]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- MemLoad64
[@ "opaque_to_smt"]
let va_code_MemLoad64 h dst base offset t =
(Ins (S.Load64 dst base offset))
[@ "opaque_to_smt"]
let va_codegen_success_MemLoad64 h dst base offset t =
(va_ttrue ())
[@"opaque_to_smt"] | false | false | Vale.PPC64LE.InsMem.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_lemma_MemLoad64 : va_b0:va_code -> va_s0:va_state -> h:va_operand_heaplet ->
dst:va_operand_reg_opr -> base:va_operand_reg_opr -> offset:int -> t:taint -> b:buffer64 ->
index:int
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_MemLoad64 h dst base offset t) va_s0 /\
va_is_src_heaplet h va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_is_src_reg_opr base va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\
Vale.PPC64LE.Decls.valid_src_addr #Vale.PPC64LE.Memory.vuint64 (va_eval_heaplet va_s0 h) b
index /\ Vale.PPC64LE.Memory.valid_layout_buffer #Vale.PPC64LE.Memory.vuint64 b
(va_get_mem_layout va_s0) (va_eval_heaplet va_s0 h) false /\
Vale.PPC64LE.Memory.valid_taint_buf64 b (va_eval_heaplet va_s0 h) ((va_get_mem_layout
va_s0).vl_taint) t /\ va_eval_reg_opr va_s0 base + offset == Vale.PPC64LE.Memory.buffer_addr
#Vale.PPC64LE.Memory.vuint64 b (va_eval_heaplet va_s0 h) + 8 `op_Multiply` index))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_reg_opr va_sM dst == Vale.PPC64LE.Decls.buffer64_read b index (va_eval_heaplet va_sM h)
/\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)))) | [] | Vale.PPC64LE.InsMem.va_lemma_MemLoad64 | {
"file_name": "obj/Vale.PPC64LE.InsMem.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
va_b0: Vale.PPC64LE.Decls.va_code ->
va_s0: Vale.PPC64LE.Decls.va_state ->
h: Vale.PPC64LE.Decls.va_operand_heaplet ->
dst: Vale.PPC64LE.Decls.va_operand_reg_opr ->
base: Vale.PPC64LE.Decls.va_operand_reg_opr ->
offset: Prims.int ->
t: Vale.Arch.HeapTypes_s.taint ->
b: Vale.PPC64LE.Memory.buffer64 ->
index: Prims.int
-> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) | {
"end_col": 16,
"end_line": 107,
"start_col": 2,
"start_line": 101
} |
Prims.Tot | val gf128_of_quad32 (q: quad32) : poly | [
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gf128_of_quad32 (q:quad32) : poly = reverse (of_quad32 q) 127 | val gf128_of_quad32 (q: quad32) : poly
let gf128_of_quad32 (q: quad32) : poly = | false | null | false | reverse (of_quad32 q) 127 | {
"checked_file": "Vale.AES.GF128_s.fsti.checked",
"dependencies": [
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GF128_s.fsti"
} | [
"total"
] | [
"Vale.Def.Types_s.quad32",
"Vale.Math.Poly2_s.reverse",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.Math.Poly2_s.poly"
] | [] | module Vale.AES.GF128_s
open FStar.Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2.Bits_s
open FStar.Seq
open Vale.Def.Types_s
// x^7 + x^2 + x + 1
let gf128_modulus_low_terms : poly = of_fun 8 (fun (i:nat) -> i = 0 || i = 1 || i = 2 || i = 7)
// x^128 + x^7 + x^2 + x + 1
let gf128_modulus : poly = add (monomial 128) gf128_modulus_low_terms
let gf128_add (a b:poly) : poly = add a b
let gf128_mul (a b:poly) : poly = mod (mul a b) gf128_modulus | false | true | Vale.AES.GF128_s.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 gf128_of_quad32 (q: quad32) : poly | [] | Vale.AES.GF128_s.gf128_of_quad32 | {
"file_name": "vale/specs/crypto/Vale.AES.GF128_s.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | q: Vale.Def.Types_s.quad32 -> Vale.Math.Poly2_s.poly | {
"end_col": 65,
"end_line": 18,
"start_col": 40,
"start_line": 18
} |
Prims.Tot | val gf128_mul (a b: poly) : poly | [
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gf128_mul (a b:poly) : poly = mod (mul a b) gf128_modulus | val gf128_mul (a b: poly) : poly
let gf128_mul (a b: poly) : poly = | false | null | false | mod (mul a b) gf128_modulus | {
"checked_file": "Vale.AES.GF128_s.fsti.checked",
"dependencies": [
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GF128_s.fsti"
} | [
"total"
] | [
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2_s.mod",
"Vale.Math.Poly2_s.mul",
"Vale.AES.GF128_s.gf128_modulus"
] | [] | module Vale.AES.GF128_s
open FStar.Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2.Bits_s
open FStar.Seq
open Vale.Def.Types_s
// x^7 + x^2 + x + 1
let gf128_modulus_low_terms : poly = of_fun 8 (fun (i:nat) -> i = 0 || i = 1 || i = 2 || i = 7)
// x^128 + x^7 + x^2 + x + 1
let gf128_modulus : poly = add (monomial 128) gf128_modulus_low_terms | false | true | Vale.AES.GF128_s.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 gf128_mul (a b: poly) : poly | [] | Vale.AES.GF128_s.gf128_mul | {
"file_name": "vale/specs/crypto/Vale.AES.GF128_s.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2_s.poly -> b: Vale.Math.Poly2_s.poly -> Vale.Math.Poly2_s.poly | {
"end_col": 61,
"end_line": 15,
"start_col": 34,
"start_line": 15
} |
Prims.Tot | val gf128_modulus:poly | [
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gf128_modulus : poly = add (monomial 128) gf128_modulus_low_terms | val gf128_modulus:poly
let gf128_modulus:poly = | false | null | false | add (monomial 128) gf128_modulus_low_terms | {
"checked_file": "Vale.AES.GF128_s.fsti.checked",
"dependencies": [
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GF128_s.fsti"
} | [
"total"
] | [
"Vale.Math.Poly2_s.add",
"Vale.Math.Poly2_s.monomial",
"Vale.AES.GF128_s.gf128_modulus_low_terms"
] | [] | module Vale.AES.GF128_s
open FStar.Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2.Bits_s
open FStar.Seq
open Vale.Def.Types_s
// x^7 + x^2 + x + 1
let gf128_modulus_low_terms : poly = of_fun 8 (fun (i:nat) -> i = 0 || i = 1 || i = 2 || i = 7) | false | true | Vale.AES.GF128_s.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 gf128_modulus:poly | [] | Vale.AES.GF128_s.gf128_modulus | {
"file_name": "vale/specs/crypto/Vale.AES.GF128_s.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Math.Poly2_s.poly | {
"end_col": 69,
"end_line": 12,
"start_col": 27,
"start_line": 12
} |
Prims.Tot | val gf128_to_quad32 (a: poly) : quad32 | [
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gf128_to_quad32 (a:poly) : quad32 = to_quad32 (reverse a 127) | val gf128_to_quad32 (a: poly) : quad32
let gf128_to_quad32 (a: poly) : quad32 = | false | null | false | to_quad32 (reverse a 127) | {
"checked_file": "Vale.AES.GF128_s.fsti.checked",
"dependencies": [
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GF128_s.fsti"
} | [
"total"
] | [
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2.Bits_s.to_quad32",
"Vale.Math.Poly2_s.reverse",
"Vale.Def.Types_s.quad32"
] | [] | module Vale.AES.GF128_s
open FStar.Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2.Bits_s
open FStar.Seq
open Vale.Def.Types_s
// x^7 + x^2 + x + 1
let gf128_modulus_low_terms : poly = of_fun 8 (fun (i:nat) -> i = 0 || i = 1 || i = 2 || i = 7)
// x^128 + x^7 + x^2 + x + 1
let gf128_modulus : poly = add (monomial 128) gf128_modulus_low_terms
let gf128_add (a b:poly) : poly = add a b
let gf128_mul (a b:poly) : poly = mod (mul a b) gf128_modulus | false | true | Vale.AES.GF128_s.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 gf128_to_quad32 (a: poly) : quad32 | [] | Vale.AES.GF128_s.gf128_to_quad32 | {
"file_name": "vale/specs/crypto/Vale.AES.GF128_s.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2_s.poly -> Vale.Def.Types_s.quad32 | {
"end_col": 65,
"end_line": 17,
"start_col": 40,
"start_line": 17
} |
Prims.Tot | val gf128_add (a b: poly) : poly | [
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gf128_add (a b:poly) : poly = add a b | val gf128_add (a b: poly) : poly
let gf128_add (a b: poly) : poly = | false | null | false | add a b | {
"checked_file": "Vale.AES.GF128_s.fsti.checked",
"dependencies": [
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GF128_s.fsti"
} | [
"total"
] | [
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2_s.add"
] | [] | module Vale.AES.GF128_s
open FStar.Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2.Bits_s
open FStar.Seq
open Vale.Def.Types_s
// x^7 + x^2 + x + 1
let gf128_modulus_low_terms : poly = of_fun 8 (fun (i:nat) -> i = 0 || i = 1 || i = 2 || i = 7)
// x^128 + x^7 + x^2 + x + 1
let gf128_modulus : poly = add (monomial 128) gf128_modulus_low_terms | false | true | Vale.AES.GF128_s.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 gf128_add (a b: poly) : poly | [] | Vale.AES.GF128_s.gf128_add | {
"file_name": "vale/specs/crypto/Vale.AES.GF128_s.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2_s.poly -> b: Vale.Math.Poly2_s.poly -> Vale.Math.Poly2_s.poly | {
"end_col": 41,
"end_line": 14,
"start_col": 34,
"start_line": 14
} |
Prims.Tot | val gf128_modulus_low_terms:poly | [
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gf128_modulus_low_terms : poly = of_fun 8 (fun (i:nat) -> i = 0 || i = 1 || i = 2 || i = 7) | val gf128_modulus_low_terms:poly
let gf128_modulus_low_terms:poly = | false | null | false | of_fun 8 (fun (i: nat) -> i = 0 || i = 1 || i = 2 || i = 7) | {
"checked_file": "Vale.AES.GF128_s.fsti.checked",
"dependencies": [
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GF128_s.fsti"
} | [
"total"
] | [
"Vale.Math.Poly2_s.of_fun",
"Prims.nat",
"Prims.op_BarBar",
"Prims.op_Equality",
"Prims.int",
"Prims.bool"
] | [] | module Vale.AES.GF128_s
open FStar.Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2.Bits_s
open FStar.Seq
open Vale.Def.Types_s | false | true | Vale.AES.GF128_s.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 gf128_modulus_low_terms:poly | [] | Vale.AES.GF128_s.gf128_modulus_low_terms | {
"file_name": "vale/specs/crypto/Vale.AES.GF128_s.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Math.Poly2_s.poly | {
"end_col": 95,
"end_line": 9,
"start_col": 37,
"start_line": 9
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let arg_list = l:list arg{List.Tot.length l <= 20} | let arg_list = | false | null | false | l: list arg {List.Tot.length l <= 20} | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Prims.list",
"Vale.Interop.Base.arg",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.List.Tot.Base.length"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed. | false | true | Vale.Interop.X64.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 arg_list : Type0 | [] | Vale.Interop.X64.arg_list | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 50,
"end_line": 40,
"start_col": 15,
"start_line": 40
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let arg_list_sb = l:list arg{List.Tot.length l <= 21} | let arg_list_sb = | false | null | false | l: list arg {List.Tot.length l <= 21} | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Prims.list",
"Vale.Interop.Base.arg",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.List.Tot.Base.length"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*) | false | true | Vale.Interop.X64.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 arg_list_sb : Type0 | [] | Vale.Interop.X64.arg_list_sb | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 53,
"end_line": 41,
"start_col": 18,
"start_line": 41
} |
|
Prims.Tot | val init_taint:taint_map | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let init_taint : taint_map = fun r -> Public | val init_taint:taint_map
let init_taint:taint_map = | false | null | false | fun r -> Public | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.Interop.Types.b8",
"Vale.Arch.HeapTypes_s.Public",
"Vale.Arch.HeapTypes_s.taint"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm | false | true | Vale.Interop.X64.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 init_taint:taint_map | [] | Vale.Interop.X64.init_taint | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.X64.taint_map | {
"end_col": 44,
"end_line": 157,
"start_col": 29,
"start_line": 157
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop | let prediction_pre_rel_t (c: BS.code) (args: arg_list) = | false | null | false | h0: mem_roots args -> prop | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.code",
"Vale.Interop.X64.arg_list",
"Vale.Interop.Base.mem_roots",
"Prims.prop"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
//////////////////////////////////////////////////////////////////////////////// | false | true | Vale.Interop.X64.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 prediction_pre_rel_t : c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> Type | [] | Vale.Interop.X64.prediction_pre_rel_t | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> Type | {
"end_col": 8,
"end_line": 247,
"start_col": 4,
"start_line": 246
} |
|
Prims.GTot | val update_regs (n: nat) (arg_reg: arg_reg_relation n) (x: arg) (i: reg_nat n) (regs: registers)
: GTot registers | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x) | val update_regs (n: nat) (arg_reg: arg_reg_relation n) (x: arg) (i: reg_nat n) (regs: registers)
: GTot registers
let update_regs (n: nat) (arg_reg: arg_reg_relation n) (x: arg) (i: reg_nat n) (regs: registers)
: GTot registers = | false | null | false | upd_reg n arg_reg regs i (arg_as_nat64 x) | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"sometrivial"
] | [
"Prims.nat",
"Vale.Interop.X64.arg_reg_relation",
"Vale.Interop.Base.arg",
"Vale.Interop.X64.reg_nat",
"Vale.Interop.X64.registers",
"Vale.Interop.X64.upd_reg",
"Vale.Interop.X64.arg_as_nat64"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers) | false | false | Vale.Interop.X64.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 update_regs (n: nat) (arg_reg: arg_reg_relation n) (x: arg) (i: reg_nat n) (regs: registers)
: GTot registers | [] | Vale.Interop.X64.update_regs | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
n: Prims.nat ->
arg_reg: Vale.Interop.X64.arg_reg_relation n ->
x: Vale.Interop.Base.arg ->
i: Vale.Interop.X64.reg_nat n ->
regs: Vale.Interop.X64.registers
-> Prims.GTot Vale.Interop.X64.registers | {
"end_col": 45,
"end_line": 98,
"start_col": 4,
"start_line": 98
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y | let injective f = | false | null | false | forall x y. {:pattern f x; f y} f x == f y ==> x == y | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Prims.l_Forall",
"Prims.l_imp",
"Prims.eq2",
"Prims.logical"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21} | false | false | Vale.Interop.X64.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 injective : f: (_: _ -> _) -> Prims.logical | [] | Vale.Interop.X64.injective | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | f: (_: _ -> _) -> Prims.logical | {
"end_col": 70,
"end_line": 44,
"start_col": 18,
"start_line": 44
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1)) | let as_lowstar_sig_post_weak
(n: nat)
(arg_reg: arg_reg_relation n)
(regs_modified: (MS.reg_64 -> bool))
(xmms_modified: (MS.reg_xmm -> bool))
(c: BS.code)
(args: arg_list)
(h0: mem_roots args)
(#pre_rel #post_rel: _)
(predict: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret: als_ret)
(h1: HS.mem)
= | false | null | false | let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\ n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel final_mem s1.
h1 == hs_of_mem final_mem /\ rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1)) | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Prims.nat",
"Vale.Interop.X64.arg_reg_relation",
"Vale.X64.Machine_s.reg_64",
"Prims.bool",
"Vale.X64.Machine_s.reg_xmm",
"Vale.X64.Machine_Semantics_s.code",
"Vale.Interop.X64.arg_list",
"Vale.Interop.Base.mem_roots",
"Vale.Interop.X64.prediction_pre_rel_t",
"Vale.Interop.X64.prediction_post_rel_t",
"Vale.Interop.X64.prediction",
"Vale.Interop.X64.als_ret",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Prims.eq2",
"Vale.Interop.X64.__proj__As_lowstar_sig_ret__item__args",
"Vale.Interop.X64.__proj__As_lowstar_sig_ret__item__n",
"Prims.l_Exists",
"Vale.Interop.Heap_s.interop_heap",
"Vale.X64.Machine_Semantics_s.machine_state",
"Vale.Interop.Heap_s.hs_of_mem",
"FStar.UInt64.t",
"Vale.Interop.X64.return_val",
"FStar.Pervasives.Native.Mktuple3",
"FStar.Pervasives.Native.fst",
"Vale.Interop.X64.create_initial_trusted_state",
"Vale.Interop.X64.__proj__As_lowstar_sig_ret__item__final_mem",
"Vale.Interop.X64.__proj__As_lowstar_sig_ret__item__fuel",
"Vale.Interop.X64.as_lowstar_sig_ret",
"FStar.Ghost.reveal",
"FStar.Pervasives.Native.snd",
"FStar.Ghost.erased",
"Prims.logical"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel) | false | false | Vale.Interop.X64.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 as_lowstar_sig_post_weak : n: Prims.nat ->
arg_reg: Vale.Interop.X64.arg_reg_relation n ->
regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) ->
xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool) ->
c: Vale.X64.Machine_Semantics_s.code ->
args: Vale.Interop.X64.arg_list ->
h0: Vale.Interop.Base.mem_roots args ->
predict:
Vale.Interop.X64.prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
ret: Vale.Interop.X64.als_ret ->
h1: FStar.Monotonic.HyperStack.mem
-> Prims.logical | [] | Vale.Interop.X64.as_lowstar_sig_post_weak | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
n: Prims.nat ->
arg_reg: Vale.Interop.X64.arg_reg_relation n ->
regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) ->
xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool) ->
c: Vale.X64.Machine_Semantics_s.code ->
args: Vale.Interop.X64.arg_list ->
h0: Vale.Interop.Base.mem_roots args ->
predict:
Vale.Interop.X64.prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
ret: Vale.Interop.X64.als_ret ->
h1: FStar.Monotonic.HyperStack.mem
-> Prims.logical | {
"end_col": 57,
"end_line": 378,
"start_col": 17,
"start_line": 364
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let arity_ok n 'a = l:list 'a { List.Tot.length l <= n } | let arity_ok n 'a = | false | null | false | l: list 'a {List.Tot.length l <= n} | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Prims.int",
"Prims.list",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.List.Tot.Base.length"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
) | false | true | Vale.Interop.X64.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 arity_ok : n: Prims.int -> 'a: Type -> Type | [] | Vale.Interop.X64.arity_ok | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Prims.int -> 'a: Type -> Type | {
"end_col": 56,
"end_line": 34,
"start_col": 20,
"start_line": 34
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let reg_nat (n:nat) = i:nat{i < n} | let reg_nat (n: nat) = | false | null | false | i: nat{i < n} | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
) | false | true | Vale.Interop.X64.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 reg_nat : n: Prims.nat -> Type0 | [] | Vale.Interop.X64.reg_nat | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Prims.nat -> Type0 | {
"end_col": 34,
"end_line": 33,
"start_col": 22,
"start_line": 33
} |
|
Prims.GTot | val mk_taint (args: arg_list_sb) (tm: taint_map) : GTot taint_map | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint | val mk_taint (args: arg_list_sb) (tm: taint_map) : GTot taint_map
let mk_taint (args: arg_list_sb) (tm: taint_map) : GTot taint_map = | false | null | false | List.fold_right_gtot args upd_taint_map_arg init_taint | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"sometrivial"
] | [
"Vale.Interop.X64.arg_list_sb",
"Vale.Interop.X64.taint_map",
"FStar.List.Tot.Base.fold_right_gtot",
"Vale.Interop.Base.arg",
"Vale.Interop.X64.upd_taint_map_arg",
"Vale.Interop.X64.init_taint"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__] | false | false | Vale.Interop.X64.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 mk_taint (args: arg_list_sb) (tm: taint_map) : GTot taint_map | [] | Vale.Interop.X64.mk_taint | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | args: Vale.Interop.X64.arg_list_sb -> tm: Vale.Interop.X64.taint_map
-> Prims.GTot Vale.Interop.X64.taint_map | {
"end_col": 56,
"end_line": 161,
"start_col": 2,
"start_line": 161
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0) | let prediction
(n: nat)
(arg_reg: arg_reg_relation n)
(regs_modified: (MS.reg_64 -> bool))
(xmms_modified: (MS.reg_xmm -> bool))
(c: BS.code)
(args: arg_list)
(pre_rel: prediction_pre_rel_t c args)
(post_rel: prediction_post_rel_t c args)
= | false | null | false | h0: mem_roots args {pre_rel h0} -> s0: BS.machine_state
-> Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0) | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Prims.nat",
"Vale.Interop.X64.arg_reg_relation",
"Vale.X64.Machine_s.reg_64",
"Prims.bool",
"Vale.X64.Machine_s.reg_xmm",
"Vale.X64.Machine_Semantics_s.code",
"Vale.Interop.X64.arg_list",
"Vale.Interop.X64.prediction_pre_rel_t",
"Vale.Interop.X64.prediction_post_rel_t",
"Vale.Interop.Base.mem_roots",
"Vale.X64.Machine_Semantics_s.machine_state",
"FStar.Pervasives.Native.tuple3",
"FStar.UInt64.t",
"Vale.Interop.Heap_s.interop_heap",
"Vale.Interop.X64.prediction_pre",
"Vale.Interop.X64.prediction_post"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args) | false | false | Vale.Interop.X64.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 prediction : n: Prims.nat ->
arg_reg: Vale.Interop.X64.arg_reg_relation n ->
regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) ->
xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool) ->
c: Vale.X64.Machine_Semantics_s.code ->
args: Vale.Interop.X64.arg_list ->
pre_rel: Vale.Interop.X64.prediction_pre_rel_t c args ->
post_rel: Vale.Interop.X64.prediction_post_rel_t c args
-> Type | [] | Vale.Interop.X64.prediction | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
n: Prims.nat ->
arg_reg: Vale.Interop.X64.arg_reg_relation n ->
regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) ->
xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool) ->
c: Vale.X64.Machine_Semantics_s.code ->
args: Vale.Interop.X64.arg_list ->
pre_rel: Vale.Interop.X64.prediction_pre_rel_t c args ->
post_rel: Vale.Interop.X64.prediction_post_rel_t c args
-> Type | {
"end_col": 81,
"end_line": 310,
"start_col": 2,
"start_line": 306
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None | let taint_of_arg (a: arg) = | false | null | false | let (| tag , x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 { taint = tnt }
| TD_ImmBuffer _ TUInt128 { taint = tnt }
| TD_Buffer _ TUInt64 { taint = tnt }
| TD_Buffer _ TUInt128 { taint = tnt } -> Some tnt
| _ -> None | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.Interop.Base.arg",
"Vale.Interop.Base.td",
"Vale.Interop.Base.td_as_type",
"Vale.Arch.HeapTypes_s.base_typ",
"Prims.bool",
"Vale.Arch.HeapTypes_s.taint",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint | false | true | Vale.Interop.X64.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 taint_of_arg : a: Vale.Interop.Base.arg -> FStar.Pervasives.Native.option Vale.Arch.HeapTypes_s.taint | [] | Vale.Interop.X64.taint_of_arg | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Interop.Base.arg -> FStar.Pervasives.Native.option Vale.Arch.HeapTypes_s.taint | {
"end_col": 13,
"end_line": 170,
"start_col": 26,
"start_line": 163
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let taint_map = b8 -> GTot taint | let taint_map = | false | null | false | b8 -> GTot taint | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.Interop.Types.b8",
"Vale.Arch.HeapTypes_s.taint"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1 | false | true | Vale.Interop.X64.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 taint_map : Type0 | [] | Vale.Interop.X64.taint_map | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 32,
"end_line": 139,
"start_col": 16,
"start_line": 139
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom | let state_builder_t (max_arity: nat) (args: arg_list) (codom: Type) = | false | null | false | h0: HS.mem{mem_roots_p h0 args} -> GTot codom | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Prims.nat",
"Vale.Interop.X64.arg_list",
"FStar.Monotonic.HyperStack.mem",
"Vale.Interop.Base.mem_roots_p"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
//////////////////////////////////////////////////////////////////////////////// | false | true | Vale.Interop.X64.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 state_builder_t : max_arity: Prims.nat -> args: Vale.Interop.X64.arg_list -> codom: Type -> Type | [] | Vale.Interop.X64.state_builder_t | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | max_arity: Prims.nat -> args: Vale.Interop.X64.arg_list -> codom: Type -> Type | {
"end_col": 14,
"end_line": 206,
"start_col": 4,
"start_line": 205
} |
|
Prims.Tot | val xmms_modified_stdcall: MS.reg_xmm -> bool | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let xmms_modified_stdcall:MS.reg_xmm -> bool = fun (x:MS.reg_xmm) ->
let open MS in
if IA.win then (
// These xmms are callee-saved on Windows
if x = 6 || x = 7 || x = 8 || x = 9 || x = 10 || x = 11 || x = 12 || x = 13 || x = 14 || x = 15 then false
else true
) else
// No xmm needs to be callee-saved on Linux
true | val xmms_modified_stdcall: MS.reg_xmm -> bool
let xmms_modified_stdcall: MS.reg_xmm -> bool = | false | null | false | fun (x: MS.reg_xmm) ->
let open MS in
if IA.win
then
(if x = 6 || x = 7 || x = 8 || x = 9 || x = 10 || x = 11 || x = 12 || x = 13 || x = 14 || x = 15
then false
else true)
else true | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.X64.Machine_s.reg_xmm",
"Vale.Interop.Assumptions.win",
"Prims.op_BarBar",
"Prims.op_Equality",
"Prims.int",
"Prims.bool"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c
[@__reduce__]
let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args
[@__reduce__]
let rec rel_gen_t
(c:BS.code)
(td:list td)
(args:arg_list{List.length args + List.length td <= 20})
(f: arg_list -> Type) =
match td with
| [] -> f args
| hd::tl ->
x:td_as_type hd ->
rel_gen_t c tl (x++args) f
[@__reduce__]
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f)
: f args
= x
[@__reduce__]
let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f)
: (x:td_as_type hd ->
rel_gen_t c tl (x++args) f)
= p
let rec prediction_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length dom + List.length args <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
=
match dom with
| [] ->
prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
| hd::tl ->
x:td_as_type hd ->
prediction_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
[@__reduce__]
let elim_predict_t_nil
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(#args:arg_list)
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
= p
[@__reduce__]
let elim_predict_t_cons
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(hd:td)
(tl:list td)
(#args:arg_list{List.length args + List.length tl <= 19})
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel)
: x:td_as_type hd ->
prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
= p
[@__reduce__]
let rec as_lowstar_sig_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
[@__reduce__]
private
let rec as_lowstar_sig_t_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t_weak'
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
(* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *)
[@__reduce__]
let as_lowstar_sig_t_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= n})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict
val wrap_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:arity_ok n td)
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 =
let open MS in
if IA.win then
match i with
| 0 -> rRcx
| 1 -> rRdx
| 2 -> rR8
| 3 -> rR9
else
match i with
| 0 -> rRdi
| 1 -> rRsi
| 2 -> rRdx
| 3 -> rRcx
| 4 -> rR8
| 5 -> rR9
//A partial inverse of the above function
[@__reduce__]
let arg_of_register (r:MS.reg_64)
: option (reg_nat (if IA.win then 4 else 6))
= let open MS in
if IA.win then
match r with
| 2 -> Some 0 // rcx
| 3 -> Some 1 // rdx
| 8 -> Some 2 // r8
| 9 -> Some 3 // r9
| _ -> None
else
match r with
| 5 -> Some 0 // rdi
| 4 -> Some 1 // rsi
| 3 -> Some 2 // rdx
| 2 -> Some 3 // rcx
| 8 -> Some 4 // r8
| 9 -> Some 5 // r9
| _ -> None
let max_stdcall : nat = if IA.win then 4 else 6
let arity_ok_stdcall = arity_ok max_stdcall
let arg_reg_stdcall : arg_reg_relation max_stdcall =
Rel arg_of_register register_of_arg_i
let regs_modified_stdcall:MS.reg_64 -> bool = fun (r:MS.reg_64) ->
let open MS in
if IA.win then (
// These registers are callee-saved on Windows
if r = rRbx || r = rRbp || r = rRdi || r = rRsi || r = rRsp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false
// All the other ones may be modified
else true
) else (
// These registers are callee-saved on Linux
if r = rRbx || r = rRbp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false
// All the other ones may be modified
else true
) | false | true | Vale.Interop.X64.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 xmms_modified_stdcall: MS.reg_xmm -> bool | [] | Vale.Interop.X64.xmms_modified_stdcall | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.X64.Machine_s.reg_xmm -> Prims.bool | {
"end_col": 8,
"end_line": 676,
"start_col": 47,
"start_line": 668
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop | let prediction_post_rel_t (c: BS.code) (args: arg_list) = | false | null | false |
h0: mem_roots args ->
s0: BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn: BS.machine_state
-> prop | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.code",
"Vale.Interop.X64.arg_list",
"Vale.Interop.Base.mem_roots",
"Vale.X64.Machine_Semantics_s.machine_state",
"FStar.Pervasives.Native.tuple3",
"FStar.UInt64.t",
"Prims.nat",
"Vale.Interop.Heap_s.interop_heap",
"Prims.prop"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn) | false | true | Vale.Interop.X64.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 prediction_post_rel_t : c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> Type | [] | Vale.Interop.X64.prediction_post_rel_t | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | c: Vale.X64.Machine_Semantics_s.code -> args: Vale.Interop.X64.arg_list -> Type | {
"end_col": 8,
"end_line": 258,
"start_col": 4,
"start_line": 254
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0) | let prediction_pre
(n: nat)
(arg_reg: arg_reg_relation n)
(c: BS.code)
(args: arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0: mem_roots args)
(s0: BS.machine_state)
= | false | null | false | pre_rel h0 /\ s0 == fst (create_initial_trusted_state n arg_reg args h0) | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Prims.nat",
"Vale.Interop.X64.arg_reg_relation",
"Vale.X64.Machine_Semantics_s.code",
"Vale.Interop.X64.arg_list",
"Vale.Interop.X64.prediction_pre_rel_t",
"Vale.Interop.Base.mem_roots",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.l_and",
"Prims.eq2",
"FStar.Pervasives.Native.fst",
"Vale.Interop.Heap_s.interop_heap",
"Vale.Interop.X64.create_initial_trusted_state",
"Prims.logical"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state) | false | false | Vale.Interop.X64.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 prediction_pre : n: Prims.nat ->
arg_reg: Vale.Interop.X64.arg_reg_relation n ->
c: Vale.X64.Machine_Semantics_s.code ->
args: Vale.Interop.X64.arg_list ->
pre_rel: Vale.Interop.X64.prediction_pre_rel_t c args ->
h0: Vale.Interop.Base.mem_roots args ->
s0: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.Interop.X64.prediction_pre | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
n: Prims.nat ->
arg_reg: Vale.Interop.X64.arg_reg_relation n ->
c: Vale.X64.Machine_Semantics_s.code ->
args: Vale.Interop.X64.arg_list ->
pre_rel: Vale.Interop.X64.prediction_pre_rel_t c args ->
h0: Vale.Interop.Base.mem_roots args ->
s0: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 60,
"end_line": 271,
"start_col": 2,
"start_line": 270
} |
|
Prims.Tot | val upd_taint_map_b8 (tm: taint_map) (x: b8) (tnt: taint) : taint_map | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y | val upd_taint_map_b8 (tm: taint_map) (x: b8) (tnt: taint) : taint_map
let upd_taint_map_b8 (tm: taint_map) (x: b8) (tnt: taint) : taint_map = | false | null | false | fun (y: b8) -> if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then tnt else tm y | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.Interop.X64.taint_map",
"Vale.Interop.Types.b8",
"Vale.Arch.HeapTypes_s.taint",
"FStar.StrongExcludedMiddle.strong_excluded_middle",
"Prims.eq2",
"Prims.bool"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint | false | true | Vale.Interop.X64.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 upd_taint_map_b8 (tm: taint_map) (x: b8) (tnt: taint) : taint_map | [] | Vale.Interop.X64.upd_taint_map_b8 | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | tm: Vale.Interop.X64.taint_map -> x: Vale.Interop.Types.b8 -> tnt: Vale.Arch.HeapTypes_s.taint
-> Vale.Interop.X64.taint_map | {
"end_col": 14,
"end_line": 145,
"start_col": 3,
"start_line": 142
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let arity_ok_stdcall = arity_ok max_stdcall | let arity_ok_stdcall = | false | null | false | arity_ok max_stdcall | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.Interop.X64.arity_ok",
"Vale.Interop.X64.max_stdcall"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c
[@__reduce__]
let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args
[@__reduce__]
let rec rel_gen_t
(c:BS.code)
(td:list td)
(args:arg_list{List.length args + List.length td <= 20})
(f: arg_list -> Type) =
match td with
| [] -> f args
| hd::tl ->
x:td_as_type hd ->
rel_gen_t c tl (x++args) f
[@__reduce__]
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f)
: f args
= x
[@__reduce__]
let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f)
: (x:td_as_type hd ->
rel_gen_t c tl (x++args) f)
= p
let rec prediction_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length dom + List.length args <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
=
match dom with
| [] ->
prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
| hd::tl ->
x:td_as_type hd ->
prediction_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
[@__reduce__]
let elim_predict_t_nil
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(#args:arg_list)
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
= p
[@__reduce__]
let elim_predict_t_cons
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(hd:td)
(tl:list td)
(#args:arg_list{List.length args + List.length tl <= 19})
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel)
: x:td_as_type hd ->
prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
= p
[@__reduce__]
let rec as_lowstar_sig_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
[@__reduce__]
private
let rec as_lowstar_sig_t_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t_weak'
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
(* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *)
[@__reduce__]
let as_lowstar_sig_t_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= n})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict
val wrap_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:arity_ok n td)
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 =
let open MS in
if IA.win then
match i with
| 0 -> rRcx
| 1 -> rRdx
| 2 -> rR8
| 3 -> rR9
else
match i with
| 0 -> rRdi
| 1 -> rRsi
| 2 -> rRdx
| 3 -> rRcx
| 4 -> rR8
| 5 -> rR9
//A partial inverse of the above function
[@__reduce__]
let arg_of_register (r:MS.reg_64)
: option (reg_nat (if IA.win then 4 else 6))
= let open MS in
if IA.win then
match r with
| 2 -> Some 0 // rcx
| 3 -> Some 1 // rdx
| 8 -> Some 2 // r8
| 9 -> Some 3 // r9
| _ -> None
else
match r with
| 5 -> Some 0 // rdi
| 4 -> Some 1 // rsi
| 3 -> Some 2 // rdx
| 2 -> Some 3 // rcx
| 8 -> Some 4 // r8
| 9 -> Some 5 // r9
| _ -> None | false | true | Vale.Interop.X64.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 arity_ok_stdcall : 'a: Type -> Type | [] | Vale.Interop.X64.arity_ok_stdcall | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | 'a: Type -> Type | {
"end_col": 43,
"end_line": 649,
"start_col": 23,
"start_line": 649
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret | let als_ret = | false | null | false | UInt64.t & Ghost.erased as_lowstar_sig_ret | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"FStar.Pervasives.Native.tuple2",
"FStar.UInt64.t",
"FStar.Ghost.erased",
"Vale.Interop.X64.as_lowstar_sig_ret"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret | false | true | Vale.Interop.X64.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 als_ret : Type | [] | Vale.Interop.X64.als_ret | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type | {
"end_col": 56,
"end_line": 321,
"start_col": 14,
"start_line": 321
} |
|
Prims.Tot | val max_stdcall:nat | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let max_stdcall : nat = if IA.win then 4 else 6 | val max_stdcall:nat
let max_stdcall:nat = | false | null | false | if IA.win then 4 else 6 | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.Interop.Assumptions.win",
"Prims.bool",
"Prims.nat"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c
[@__reduce__]
let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args
[@__reduce__]
let rec rel_gen_t
(c:BS.code)
(td:list td)
(args:arg_list{List.length args + List.length td <= 20})
(f: arg_list -> Type) =
match td with
| [] -> f args
| hd::tl ->
x:td_as_type hd ->
rel_gen_t c tl (x++args) f
[@__reduce__]
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f)
: f args
= x
[@__reduce__]
let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f)
: (x:td_as_type hd ->
rel_gen_t c tl (x++args) f)
= p
let rec prediction_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length dom + List.length args <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
=
match dom with
| [] ->
prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
| hd::tl ->
x:td_as_type hd ->
prediction_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
[@__reduce__]
let elim_predict_t_nil
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(#args:arg_list)
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
= p
[@__reduce__]
let elim_predict_t_cons
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(hd:td)
(tl:list td)
(#args:arg_list{List.length args + List.length tl <= 19})
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel)
: x:td_as_type hd ->
prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
= p
[@__reduce__]
let rec as_lowstar_sig_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
[@__reduce__]
private
let rec as_lowstar_sig_t_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t_weak'
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
(* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *)
[@__reduce__]
let as_lowstar_sig_t_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= n})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict
val wrap_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:arity_ok n td)
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 =
let open MS in
if IA.win then
match i with
| 0 -> rRcx
| 1 -> rRdx
| 2 -> rR8
| 3 -> rR9
else
match i with
| 0 -> rRdi
| 1 -> rRsi
| 2 -> rRdx
| 3 -> rRcx
| 4 -> rR8
| 5 -> rR9
//A partial inverse of the above function
[@__reduce__]
let arg_of_register (r:MS.reg_64)
: option (reg_nat (if IA.win then 4 else 6))
= let open MS in
if IA.win then
match r with
| 2 -> Some 0 // rcx
| 3 -> Some 1 // rdx
| 8 -> Some 2 // r8
| 9 -> Some 3 // r9
| _ -> None
else
match r with
| 5 -> Some 0 // rdi
| 4 -> Some 1 // rsi
| 3 -> Some 2 // rdx
| 2 -> Some 3 // rcx
| 8 -> Some 4 // r8
| 9 -> Some 5 // r9
| _ -> None | false | true | Vale.Interop.X64.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 max_stdcall:nat | [] | Vale.Interop.X64.max_stdcall | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.nat | {
"end_col": 47,
"end_line": 648,
"start_col": 24,
"start_line": 648
} |
Prims.Tot | val elim_rel_gen_t_nil (#c #args #f: _) (x: rel_gen_t c [] args f) : f args | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f)
: f args
= x | val elim_rel_gen_t_nil (#c #args #f: _) (x: rel_gen_t c [] args f) : f args
let elim_rel_gen_t_nil #c #args #f (x: rel_gen_t c [] args f) : f args = | false | null | false | x | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.code",
"Vale.Interop.X64.arg_list",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.arg",
"Vale.Interop.Base.td",
"Prims.Nil",
"Vale.Interop.X64.rel_gen_t"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c
[@__reduce__]
let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args
[@__reduce__]
let rec rel_gen_t
(c:BS.code)
(td:list td)
(args:arg_list{List.length args + List.length td <= 20})
(f: arg_list -> Type) =
match td with
| [] -> f args
| hd::tl ->
x:td_as_type hd ->
rel_gen_t c tl (x++args) f
[@__reduce__]
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f) | false | false | Vale.Interop.X64.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 elim_rel_gen_t_nil (#c #args #f: _) (x: rel_gen_t c [] args f) : f args | [] | Vale.Interop.X64.elim_rel_gen_t_nil | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Interop.X64.rel_gen_t c [] args f -> f args | {
"end_col": 5,
"end_line": 414,
"start_col": 4,
"start_line": 414
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let as_lowstar_sig_t_weak_stdcall = as_lowstar_sig_t_weak' max_stdcall arg_reg_stdcall regs_modified_stdcall xmms_modified_stdcall | let as_lowstar_sig_t_weak_stdcall = | false | null | false | as_lowstar_sig_t_weak' max_stdcall arg_reg_stdcall regs_modified_stdcall xmms_modified_stdcall | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.Interop.X64.as_lowstar_sig_t_weak'",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c
[@__reduce__]
let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args
[@__reduce__]
let rec rel_gen_t
(c:BS.code)
(td:list td)
(args:arg_list{List.length args + List.length td <= 20})
(f: arg_list -> Type) =
match td with
| [] -> f args
| hd::tl ->
x:td_as_type hd ->
rel_gen_t c tl (x++args) f
[@__reduce__]
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f)
: f args
= x
[@__reduce__]
let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f)
: (x:td_as_type hd ->
rel_gen_t c tl (x++args) f)
= p
let rec prediction_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length dom + List.length args <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
=
match dom with
| [] ->
prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
| hd::tl ->
x:td_as_type hd ->
prediction_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
[@__reduce__]
let elim_predict_t_nil
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(#args:arg_list)
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
= p
[@__reduce__]
let elim_predict_t_cons
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(hd:td)
(tl:list td)
(#args:arg_list{List.length args + List.length tl <= 19})
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel)
: x:td_as_type hd ->
prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
= p
[@__reduce__]
let rec as_lowstar_sig_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
[@__reduce__]
private
let rec as_lowstar_sig_t_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t_weak'
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
(* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *)
[@__reduce__]
let as_lowstar_sig_t_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= n})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict
val wrap_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:arity_ok n td)
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 =
let open MS in
if IA.win then
match i with
| 0 -> rRcx
| 1 -> rRdx
| 2 -> rR8
| 3 -> rR9
else
match i with
| 0 -> rRdi
| 1 -> rRsi
| 2 -> rRdx
| 3 -> rRcx
| 4 -> rR8
| 5 -> rR9
//A partial inverse of the above function
[@__reduce__]
let arg_of_register (r:MS.reg_64)
: option (reg_nat (if IA.win then 4 else 6))
= let open MS in
if IA.win then
match r with
| 2 -> Some 0 // rcx
| 3 -> Some 1 // rdx
| 8 -> Some 2 // r8
| 9 -> Some 3 // r9
| _ -> None
else
match r with
| 5 -> Some 0 // rdi
| 4 -> Some 1 // rsi
| 3 -> Some 2 // rdx
| 2 -> Some 3 // rcx
| 8 -> Some 4 // r8
| 9 -> Some 5 // r9
| _ -> None
let max_stdcall : nat = if IA.win then 4 else 6
let arity_ok_stdcall = arity_ok max_stdcall
let arg_reg_stdcall : arg_reg_relation max_stdcall =
Rel arg_of_register register_of_arg_i
let regs_modified_stdcall:MS.reg_64 -> bool = fun (r:MS.reg_64) ->
let open MS in
if IA.win then (
// These registers are callee-saved on Windows
if r = rRbx || r = rRbp || r = rRdi || r = rRsi || r = rRsp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false
// All the other ones may be modified
else true
) else (
// These registers are callee-saved on Linux
if r = rRbx || r = rRbp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false
// All the other ones may be modified
else true
)
let xmms_modified_stdcall:MS.reg_xmm -> bool = fun (x:MS.reg_xmm) ->
let open MS in
if IA.win then (
// These xmms are callee-saved on Windows
if x = 6 || x = 7 || x = 8 || x = 9 || x = 10 || x = 11 || x = 12 || x = 13 || x = 14 || x = 15 then false
else true
) else
// No xmm needs to be callee-saved on Linux
true
// For stdcalls, we do not have the arity_ok restriction: We can pass as many arguments as we want, the extra arguments will be passed on the stack | false | false | Vale.Interop.X64.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 as_lowstar_sig_t_weak_stdcall : c: Vale.X64.Machine_Semantics_s.code ->
dom: Prims.list Vale.Interop.Base.td ->
args:
Prims.list Vale.Interop.Base.arg
{FStar.List.Tot.Base.length args + FStar.List.Tot.Base.length dom <= 20} ->
pre_rel: Vale.Interop.X64.rel_gen_t c dom args (Vale.Interop.X64.prediction_pre_rel_t c) ->
post_rel: Vale.Interop.X64.rel_gen_t c dom args (Vale.Interop.X64.prediction_post_rel_t c) ->
predict:
Vale.Interop.X64.prediction_t Vale.Interop.X64.max_stdcall
Vale.Interop.X64.arg_reg_stdcall
Vale.Interop.X64.regs_modified_stdcall
Vale.Interop.X64.xmms_modified_stdcall
c
dom
args
pre_rel
post_rel
-> Type0 | [] | Vale.Interop.X64.as_lowstar_sig_t_weak_stdcall | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
c: Vale.X64.Machine_Semantics_s.code ->
dom: Prims.list Vale.Interop.Base.td ->
args:
Prims.list Vale.Interop.Base.arg
{FStar.List.Tot.Base.length args + FStar.List.Tot.Base.length dom <= 20} ->
pre_rel: Vale.Interop.X64.rel_gen_t c dom args (Vale.Interop.X64.prediction_pre_rel_t c) ->
post_rel: Vale.Interop.X64.rel_gen_t c dom args (Vale.Interop.X64.prediction_post_rel_t c) ->
predict:
Vale.Interop.X64.prediction_t Vale.Interop.X64.max_stdcall
Vale.Interop.X64.arg_reg_stdcall
Vale.Interop.X64.regs_modified_stdcall
Vale.Interop.X64.xmms_modified_stdcall
c
dom
args
pre_rel
post_rel
-> Type0 | {
"end_col": 130,
"end_line": 680,
"start_col": 36,
"start_line": 680
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args | let op_Plus_Plus (#t: td) (x: td_as_type t) (args: list arg) = | false | null | false | (| t, x |) :: args | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.Interop.Base.td",
"Vale.Interop.Base.td_as_type",
"Prims.list",
"Vale.Interop.Base.arg",
"Prims.Cons",
"Prims.Mkdtuple2"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c | false | false | Vale.Interop.X64.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 op_Plus_Plus : x: Vale.Interop.Base.td_as_type t -> args: Prims.list Vale.Interop.Base.arg
-> Prims.list Vale.Interop.Base.arg | [] | Vale.Interop.X64.op_Plus_Plus | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Interop.Base.td_as_type t -> args: Prims.list Vale.Interop.Base.arg
-> Prims.list Vale.Interop.Base.arg | {
"end_col": 70,
"end_line": 397,
"start_col": 52,
"start_line": 397
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let registers = MS.reg_64 -> MS.nat64 | let registers = | false | null | false | MS.reg_64 -> MS.nat64 | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.nat64"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r}) | false | true | Vale.Interop.X64.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 registers : Type0 | [] | Vale.Interop.X64.registers | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 37,
"end_line": 64,
"start_col": 16,
"start_line": 64
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let wrap_weak_stdcall = wrap_weak' max_stdcall arg_reg_stdcall regs_modified_stdcall xmms_modified_stdcall | let wrap_weak_stdcall = | false | null | false | wrap_weak' max_stdcall arg_reg_stdcall regs_modified_stdcall xmms_modified_stdcall | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.Interop.X64.wrap_weak'",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c
[@__reduce__]
let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args
[@__reduce__]
let rec rel_gen_t
(c:BS.code)
(td:list td)
(args:arg_list{List.length args + List.length td <= 20})
(f: arg_list -> Type) =
match td with
| [] -> f args
| hd::tl ->
x:td_as_type hd ->
rel_gen_t c tl (x++args) f
[@__reduce__]
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f)
: f args
= x
[@__reduce__]
let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f)
: (x:td_as_type hd ->
rel_gen_t c tl (x++args) f)
= p
let rec prediction_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length dom + List.length args <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
=
match dom with
| [] ->
prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
| hd::tl ->
x:td_as_type hd ->
prediction_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
[@__reduce__]
let elim_predict_t_nil
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(#args:arg_list)
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
= p
[@__reduce__]
let elim_predict_t_cons
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(hd:td)
(tl:list td)
(#args:arg_list{List.length args + List.length tl <= 19})
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel)
: x:td_as_type hd ->
prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
= p
[@__reduce__]
let rec as_lowstar_sig_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
[@__reduce__]
private
let rec as_lowstar_sig_t_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t_weak'
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
(* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *)
[@__reduce__]
let as_lowstar_sig_t_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= n})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict
val wrap_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:arity_ok n td)
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 =
let open MS in
if IA.win then
match i with
| 0 -> rRcx
| 1 -> rRdx
| 2 -> rR8
| 3 -> rR9
else
match i with
| 0 -> rRdi
| 1 -> rRsi
| 2 -> rRdx
| 3 -> rRcx
| 4 -> rR8
| 5 -> rR9
//A partial inverse of the above function
[@__reduce__]
let arg_of_register (r:MS.reg_64)
: option (reg_nat (if IA.win then 4 else 6))
= let open MS in
if IA.win then
match r with
| 2 -> Some 0 // rcx
| 3 -> Some 1 // rdx
| 8 -> Some 2 // r8
| 9 -> Some 3 // r9
| _ -> None
else
match r with
| 5 -> Some 0 // rdi
| 4 -> Some 1 // rsi
| 3 -> Some 2 // rdx
| 2 -> Some 3 // rcx
| 8 -> Some 4 // r8
| 9 -> Some 5 // r9
| _ -> None
let max_stdcall : nat = if IA.win then 4 else 6
let arity_ok_stdcall = arity_ok max_stdcall
let arg_reg_stdcall : arg_reg_relation max_stdcall =
Rel arg_of_register register_of_arg_i
let regs_modified_stdcall:MS.reg_64 -> bool = fun (r:MS.reg_64) ->
let open MS in
if IA.win then (
// These registers are callee-saved on Windows
if r = rRbx || r = rRbp || r = rRdi || r = rRsi || r = rRsp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false
// All the other ones may be modified
else true
) else (
// These registers are callee-saved on Linux
if r = rRbx || r = rRbp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false
// All the other ones may be modified
else true
)
let xmms_modified_stdcall:MS.reg_xmm -> bool = fun (x:MS.reg_xmm) ->
let open MS in
if IA.win then (
// These xmms are callee-saved on Windows
if x = 6 || x = 7 || x = 8 || x = 9 || x = 10 || x = 11 || x = 12 || x = 13 || x = 14 || x = 15 then false
else true
) else
// No xmm needs to be callee-saved on Linux
true
// For stdcalls, we do not have the arity_ok restriction: We can pass as many arguments as we want, the extra arguments will be passed on the stack
[@__reduce__]
let as_lowstar_sig_t_weak_stdcall = as_lowstar_sig_t_weak' max_stdcall arg_reg_stdcall regs_modified_stdcall xmms_modified_stdcall | false | false | Vale.Interop.X64.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 wrap_weak_stdcall : c: Vale.X64.Machine_Semantics_s.code ->
dom: Prims.list Vale.Interop.Base.td {FStar.List.Tot.Base.length dom <= 20} ->
predict:
Vale.Interop.X64.prediction_t Vale.Interop.X64.max_stdcall
Vale.Interop.X64.arg_reg_stdcall
Vale.Interop.X64.regs_modified_stdcall
Vale.Interop.X64.xmms_modified_stdcall
c
dom
[]
pre_rel
post_rel
-> Vale.Interop.X64.as_lowstar_sig_t_weak' Vale.Interop.X64.max_stdcall
Vale.Interop.X64.arg_reg_stdcall Vale.Interop.X64.regs_modified_stdcall
Vale.Interop.X64.xmms_modified_stdcall c dom [] pre_rel post_rel predict | [] | Vale.Interop.X64.wrap_weak_stdcall | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
c: Vale.X64.Machine_Semantics_s.code ->
dom: Prims.list Vale.Interop.Base.td {FStar.List.Tot.Base.length dom <= 20} ->
predict:
Vale.Interop.X64.prediction_t Vale.Interop.X64.max_stdcall
Vale.Interop.X64.arg_reg_stdcall
Vale.Interop.X64.regs_modified_stdcall
Vale.Interop.X64.xmms_modified_stdcall
c
dom
[]
pre_rel
post_rel
-> Vale.Interop.X64.as_lowstar_sig_t_weak' Vale.Interop.X64.max_stdcall
Vale.Interop.X64.arg_reg_stdcall Vale.Interop.X64.regs_modified_stdcall
Vale.Interop.X64.xmms_modified_stdcall c dom [] pre_rel post_rel predict | {
"end_col": 106,
"end_line": 682,
"start_col": 24,
"start_line": 682
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
) | let prediction_post
(n: nat)
(regs_modified: (MS.reg_64 -> bool))
(xmms_modified: (MS.reg_xmm -> bool))
(c: BS.code)
(args: arg_list)
(post_rel: prediction_post_rel_t c args)
(h0: mem_roots args)
(s0: BS.machine_state)
(rax_fuel_mem: (UInt64.t & nat & interop_heap))
= | false | null | false | let rax, fuel, final_mem = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\
(let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\ B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\ heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\ rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1) | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Prims.nat",
"Vale.X64.Machine_s.reg_64",
"Prims.bool",
"Vale.X64.Machine_s.reg_xmm",
"Vale.X64.Machine_Semantics_s.code",
"Vale.Interop.X64.arg_list",
"Vale.Interop.X64.prediction_post_rel_t",
"Vale.Interop.Base.mem_roots",
"Vale.X64.Machine_Semantics_s.machine_state",
"FStar.Pervasives.Native.tuple3",
"FStar.UInt64.t",
"Vale.Interop.Heap_s.interop_heap",
"Prims.l_and",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_Some",
"Vale.X64.Machine_Semantics_s.machine_eval_code",
"FStar.HyperStack.ST.equal_domains",
"LowStar.Monotonic.Buffer.modifies",
"Vale.Interop.Base.loc_modified_args",
"Vale.Interop.Base.mem_roots_p",
"Prims.eq2",
"Vale.Arch.MachineHeap_s.machine_heap",
"Vale.Arch.Heap.heap_create_machine",
"Vale.Interop.Base.mk_mem",
"Vale.Arch.Heap.heap_get",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_heap",
"Vale.Interop.X64.calling_conventions",
"Vale.Interop.X64.return_val",
"FStar.Monotonic.HyperStack.mem",
"Vale.Interop.Heap_s.hs_of_mem",
"FStar.Pervasives.Native.__proj__Some__item__v",
"Prims.logical"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args) | false | false | Vale.Interop.X64.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 prediction_post : n: Prims.nat ->
regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) ->
xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool) ->
c: Vale.X64.Machine_Semantics_s.code ->
args: Vale.Interop.X64.arg_list ->
post_rel: Vale.Interop.X64.prediction_post_rel_t c args ->
h0: Vale.Interop.Base.mem_roots args ->
s0: Vale.X64.Machine_Semantics_s.machine_state ->
rax_fuel_mem: ((FStar.UInt64.t * Prims.nat) * Vale.Interop.Heap_s.interop_heap)
-> Prims.logical | [] | Vale.Interop.X64.prediction_post | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
n: Prims.nat ->
regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) ->
xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool) ->
c: Vale.X64.Machine_Semantics_s.code ->
args: Vale.Interop.X64.arg_list ->
post_rel: Vale.Interop.X64.prediction_post_rel_t c args ->
h0: Vale.Interop.Base.mem_roots args ->
s0: Vale.X64.Machine_Semantics_s.machine_state ->
rax_fuel_mem: ((FStar.UInt64.t * Prims.nat) * Vale.Interop.Heap_s.interop_heap)
-> Prims.logical | {
"end_col": 3,
"end_line": 295,
"start_col": 52,
"start_line": 283
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} | let return_val_t (sn: BS.machine_state) = | false | null | false | r: UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.machine_state",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"FStar.UInt.size",
"FStar.UInt64.n",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"Prims.op_LessThan",
"Vale.Def.Words_s.pow2_64",
"FStar.UInt64.v",
"Vale.X64.Machine_Semantics_s.eval_reg_64",
"Vale.X64.Machine_s.rRax"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop | false | true | Vale.Interop.X64.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 return_val_t : sn: Vale.X64.Machine_Semantics_s.machine_state -> Type0 | [] | Vale.Interop.X64.return_val_t | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | sn: Vale.X64.Machine_Semantics_s.machine_state -> Type0 | {
"end_col": 92,
"end_line": 249,
"start_col": 41,
"start_line": 249
} |
|
Prims.GTot | val taint_arg_b8 (a: arg{Some? (taint_of_arg a)}) : GTot b8 | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x | val taint_arg_b8 (a: arg{Some? (taint_of_arg a)}) : GTot b8
let taint_arg_b8 (a: arg{Some? (taint_of_arg a)}) : GTot b8 = | false | null | false | let (| tag , x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"sometrivial"
] | [
"Vale.Interop.Base.arg",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_Some",
"Vale.Arch.HeapTypes_s.taint",
"Vale.Interop.X64.taint_of_arg",
"Vale.Interop.Base.td",
"Vale.Interop.Base.td_as_type",
"Vale.Arch.HeapTypes_s.base_typ",
"Vale.Interop.Base.buffer_qualifiers",
"Vale.Interop.Types.Buffer",
"LowStar.Buffer.buffer",
"Vale.Interop.Types.base_typ_as_type",
"Vale.Interop.Base.imm_to_b8",
"Vale.Interop.Types.b8"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None | false | false | Vale.Interop.X64.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 taint_arg_b8 (a: arg{Some? (taint_of_arg a)}) : GTot b8 | [] | Vale.Interop.X64.taint_arg_b8 | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Interop.Base.arg{Some? (Vale.Interop.X64.taint_of_arg a)}
-> Prims.GTot Vale.Interop.Types.b8 | {
"end_col": 43,
"end_line": 176,
"start_col": 60,
"start_line": 172
} |
Prims.Tot | val return_val (sn: BS.machine_state) : return_val_t sn | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn) | val return_val (sn: BS.machine_state) : return_val_t sn
let return_val (sn: BS.machine_state) : return_val_t sn = | false | null | false | UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn) | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.machine_state",
"FStar.UInt64.uint_to_t",
"Vale.X64.Machine_Semantics_s.eval_reg_64",
"Vale.X64.Machine_s.rRax",
"Vale.Interop.X64.return_val_t"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn} | false | false | Vale.Interop.X64.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 return_val (sn: BS.machine_state) : return_val_t sn | [] | Vale.Interop.X64.return_val | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | sn: Vale.X64.Machine_Semantics_s.machine_state -> Vale.Interop.X64.return_val_t sn | {
"end_col": 46,
"end_line": 251,
"start_col": 2,
"start_line": 251
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
) | let calling_conventions
(s0 s1: BS.machine_state)
(regs_modified: (MS.reg_64 -> bool))
(xmms_modified: (MS.reg_xmm -> bool))
= | false | null | false | let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\ s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r: MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r ->
not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r ->
not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)) | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.machine_state",
"Vale.X64.Machine_s.reg_64",
"Prims.bool",
"Vale.X64.Machine_s.reg_xmm",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_ok",
"Prims.eq2",
"Vale.X64.Machine_s.t_reg",
"Vale.X64.Machine_s.reg_Rsp",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_regs",
"Prims.l_Forall",
"Vale.X64.Machine_s.reg",
"Vale.X64.Machine_s.reg_id",
"Prims.l_imp",
"Prims.op_Negation",
"Vale.X64.Machine_s.Reg",
"Prims.logical"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state) | false | true | Vale.Interop.X64.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 calling_conventions : s0: Vale.X64.Machine_Semantics_s.machine_state ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) ->
xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool)
-> Prims.logical | [] | Vale.Interop.X64.calling_conventions | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
s0: Vale.X64.Machine_Semantics_s.machine_state ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
regs_modified: (_: Vale.X64.Machine_s.reg_64 -> Prims.bool) ->
xmms_modified: (_: Vale.X64.Machine_s.reg_xmm -> Prims.bool)
-> Prims.logical | {
"end_col": 3,
"end_line": 31,
"start_col": 39,
"start_line": 22
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1) | let as_lowstar_sig (c: BS.code) = | false | null | false |
n: nat ->
arg_reg: arg_reg_relation n ->
regs_modified: (MS.reg_64 -> bool) ->
xmms_modified: (MS.reg_xmm -> bool) ->
args: arg_list ->
#pre_rel: _ ->
#post_rel: _ ->
predict: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
-> FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures
fun h0 ret h1 ->
as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1) | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.code",
"Prims.nat",
"Vale.Interop.X64.arg_reg_relation",
"Vale.X64.Machine_s.reg_64",
"Prims.bool",
"Vale.X64.Machine_s.reg_xmm",
"Vale.Interop.X64.arg_list",
"Vale.Interop.X64.prediction_pre_rel_t",
"Vale.Interop.X64.prediction_post_rel_t",
"Vale.Interop.X64.prediction",
"Vale.Interop.X64.als_ret",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Vale.Interop.Base.mem_roots_p",
"Vale.Interop.X64.as_lowstar_sig_post"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__] | false | true | Vale.Interop.X64.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 as_lowstar_sig : c: Vale.X64.Machine_Semantics_s.code -> Type | [] | Vale.Interop.X64.as_lowstar_sig | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | c: Vale.X64.Machine_Semantics_s.code -> Type | {
"end_col": 117,
"end_line": 392,
"start_col": 4,
"start_line": 382
} |
|
Prims.Tot | val create_initial_trusted_state
(max_arity: nat)
(arg_reg: arg_reg_relation max_arity)
(args: arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem) | val create_initial_trusted_state
(max_arity: nat)
(arg_reg: arg_reg_relation max_arity)
(args: arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap)
let create_initial_trusted_state
(max_arity: nat)
(arg_reg: arg_reg_relation max_arity)
(args: arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) = | false | null | false | fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs =
FunctionalExtensionality.on_dom reg
#t_reg
(function
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
let stack = Map.const_on Set.empty 0 in
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let s0:BS.machine_state =
{
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = []
}
in
(s0, mem) | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Prims.nat",
"Vale.Interop.X64.arg_reg_relation",
"Vale.Interop.X64.arg_list",
"FStar.Monotonic.HyperStack.mem",
"Vale.Interop.Base.mem_roots_p",
"FStar.Pervasives.Native.Mktuple2",
"Vale.X64.Machine_Semantics_s.machine_state",
"Vale.Interop.Heap_s.interop_heap",
"Vale.X64.Machine_Semantics_s.Mkmachine_state",
"Vale.Arch.Heap.heap_create_impl",
"Vale.X64.Machine_Semantics_s.Machine_stack",
"FStar.Map.const",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.Arch.HeapTypes_s.Public",
"Prims.Nil",
"Vale.X64.Machine_s.observation",
"Vale.Arch.HeapTypes_s.memTaint_t",
"Vale.Interop.Base.create_memtaint",
"Vale.Interop.Base.args_b8",
"Vale.Interop.X64.mk_taint",
"Vale.Interop.X64.init_taint",
"Vale.Interop.Base.mk_mem",
"FStar.Map.t",
"Vale.Def.Words_s.nat8",
"Vale.Interop.X64.stack_of_args",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.arg",
"FStar.Map.const_on",
"FStar.Set.empty",
"FStar.FunctionalExtensionality.restricted_t",
"Vale.X64.Machine_s.reg",
"Vale.X64.Machine_s.t_reg",
"FStar.FunctionalExtensionality.on_dom",
"Vale.X64.Machine_s.reg_id",
"Vale.Def.Words_s.nat64",
"Vale.X64.Machine_s.rRsp",
"Vale.X64.Machine_s.flag",
"FStar.Pervasives.Native.option",
"Prims.bool",
"FStar.FunctionalExtensionality.on",
"Vale.X64.Machine_Semantics_s.flag_val_t",
"Vale.Interop.Assumptions.init_flags",
"Vale.X64.Machine_s.reg_xmm",
"Vale.Def.Types_s.quad32",
"Vale.Interop.Assumptions.init_xmms",
"Vale.Interop.X64.registers",
"Prims.eq2",
"Vale.Interop.Assumptions.init_regs",
"Vale.Interop.X64.register_of_args",
"FStar.Pervasives.Native.tuple2",
"Vale.Interop.X64.state_builder_t"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list) | false | false | Vale.Interop.X64.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 create_initial_trusted_state
(max_arity: nat)
(arg_reg: arg_reg_relation max_arity)
(args: arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) | [] | Vale.Interop.X64.create_initial_trusted_state | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
max_arity: Prims.nat ->
arg_reg: Vale.Interop.X64.arg_reg_relation max_arity ->
args: Vale.Interop.X64.arg_list
-> Vale.Interop.X64.state_builder_t max_arity
args
(Vale.X64.Machine_Semantics_s.machine_state * Vale.Interop.Heap_s.interop_heap) | {
"end_col": 13,
"end_line": 242,
"start_col": 2,
"start_line": 216
} |
Prims.Tot | val arg_reg_stdcall:arg_reg_relation max_stdcall | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let arg_reg_stdcall : arg_reg_relation max_stdcall =
Rel arg_of_register register_of_arg_i | val arg_reg_stdcall:arg_reg_relation max_stdcall
let arg_reg_stdcall:arg_reg_relation max_stdcall = | false | null | false | Rel arg_of_register register_of_arg_i | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.Interop.X64.Rel",
"Vale.Interop.Assumptions.win",
"Prims.bool",
"Prims.nat",
"Vale.Interop.X64.arg_of_register",
"Vale.Interop.X64.register_of_arg_i"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c
[@__reduce__]
let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args
[@__reduce__]
let rec rel_gen_t
(c:BS.code)
(td:list td)
(args:arg_list{List.length args + List.length td <= 20})
(f: arg_list -> Type) =
match td with
| [] -> f args
| hd::tl ->
x:td_as_type hd ->
rel_gen_t c tl (x++args) f
[@__reduce__]
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f)
: f args
= x
[@__reduce__]
let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f)
: (x:td_as_type hd ->
rel_gen_t c tl (x++args) f)
= p
let rec prediction_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length dom + List.length args <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
=
match dom with
| [] ->
prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
| hd::tl ->
x:td_as_type hd ->
prediction_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
[@__reduce__]
let elim_predict_t_nil
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(#args:arg_list)
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
= p
[@__reduce__]
let elim_predict_t_cons
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(hd:td)
(tl:list td)
(#args:arg_list{List.length args + List.length tl <= 19})
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel)
: x:td_as_type hd ->
prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
= p
[@__reduce__]
let rec as_lowstar_sig_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
[@__reduce__]
private
let rec as_lowstar_sig_t_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t_weak'
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
(* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *)
[@__reduce__]
let as_lowstar_sig_t_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= n})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict
val wrap_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:arity_ok n td)
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 =
let open MS in
if IA.win then
match i with
| 0 -> rRcx
| 1 -> rRdx
| 2 -> rR8
| 3 -> rR9
else
match i with
| 0 -> rRdi
| 1 -> rRsi
| 2 -> rRdx
| 3 -> rRcx
| 4 -> rR8
| 5 -> rR9
//A partial inverse of the above function
[@__reduce__]
let arg_of_register (r:MS.reg_64)
: option (reg_nat (if IA.win then 4 else 6))
= let open MS in
if IA.win then
match r with
| 2 -> Some 0 // rcx
| 3 -> Some 1 // rdx
| 8 -> Some 2 // r8
| 9 -> Some 3 // r9
| _ -> None
else
match r with
| 5 -> Some 0 // rdi
| 4 -> Some 1 // rsi
| 3 -> Some 2 // rdx
| 2 -> Some 3 // rcx
| 8 -> Some 4 // r8
| 9 -> Some 5 // r9
| _ -> None
let max_stdcall : nat = if IA.win then 4 else 6
let arity_ok_stdcall = arity_ok max_stdcall | false | false | Vale.Interop.X64.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 arg_reg_stdcall:arg_reg_relation max_stdcall | [] | Vale.Interop.X64.arg_reg_stdcall | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | v:
Vale.Interop.X64.arg_reg_relation' Vale.Interop.X64.max_stdcall
{ forall (r: Vale.X64.Machine_s.reg_64). {:pattern Rel?.of_reg v r}
Some? (Rel?.of_reg v r) ==> Rel?.of_arg v (Some?.v (Rel?.of_reg v r)) = r } | {
"end_col": 39,
"end_line": 652,
"start_col": 2,
"start_line": 652
} |
Prims.Tot | val regs_modified_stdcall: MS.reg_64 -> bool | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let regs_modified_stdcall:MS.reg_64 -> bool = fun (r:MS.reg_64) ->
let open MS in
if IA.win then (
// These registers are callee-saved on Windows
if r = rRbx || r = rRbp || r = rRdi || r = rRsi || r = rRsp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false
// All the other ones may be modified
else true
) else (
// These registers are callee-saved on Linux
if r = rRbx || r = rRbp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false
// All the other ones may be modified
else true
) | val regs_modified_stdcall: MS.reg_64 -> bool
let regs_modified_stdcall: MS.reg_64 -> bool = | false | null | false | fun (r: MS.reg_64) ->
let open MS in
if IA.win
then
(if
r = rRbx || r = rRbp || r = rRdi || r = rRsi || r = rRsp || r = rR12 || r = rR13 || r = rR14 ||
r = rR15
then false
else true)
else
(if r = rRbx || r = rRbp || r = rR12 || r = rR13 || r = rR14 || r = rR15 then false else true) | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.X64.Machine_s.reg_64",
"Vale.Interop.Assumptions.win",
"Prims.op_BarBar",
"Prims.op_Equality",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRbp",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Machine_s.rRsi",
"Vale.X64.Machine_s.rRsp",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rR13",
"Vale.X64.Machine_s.rR14",
"Vale.X64.Machine_s.rR15",
"Prims.bool"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c
[@__reduce__]
let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args
[@__reduce__]
let rec rel_gen_t
(c:BS.code)
(td:list td)
(args:arg_list{List.length args + List.length td <= 20})
(f: arg_list -> Type) =
match td with
| [] -> f args
| hd::tl ->
x:td_as_type hd ->
rel_gen_t c tl (x++args) f
[@__reduce__]
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f)
: f args
= x
[@__reduce__]
let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f)
: (x:td_as_type hd ->
rel_gen_t c tl (x++args) f)
= p
let rec prediction_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length dom + List.length args <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
=
match dom with
| [] ->
prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
| hd::tl ->
x:td_as_type hd ->
prediction_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
[@__reduce__]
let elim_predict_t_nil
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(#args:arg_list)
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
= p
[@__reduce__]
let elim_predict_t_cons
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(hd:td)
(tl:list td)
(#args:arg_list{List.length args + List.length tl <= 19})
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel)
: x:td_as_type hd ->
prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
= p
[@__reduce__]
let rec as_lowstar_sig_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
[@__reduce__]
private
let rec as_lowstar_sig_t_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t_weak'
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
(* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *)
[@__reduce__]
let as_lowstar_sig_t_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= n})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict
val wrap_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:arity_ok n td)
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 =
let open MS in
if IA.win then
match i with
| 0 -> rRcx
| 1 -> rRdx
| 2 -> rR8
| 3 -> rR9
else
match i with
| 0 -> rRdi
| 1 -> rRsi
| 2 -> rRdx
| 3 -> rRcx
| 4 -> rR8
| 5 -> rR9
//A partial inverse of the above function
[@__reduce__]
let arg_of_register (r:MS.reg_64)
: option (reg_nat (if IA.win then 4 else 6))
= let open MS in
if IA.win then
match r with
| 2 -> Some 0 // rcx
| 3 -> Some 1 // rdx
| 8 -> Some 2 // r8
| 9 -> Some 3 // r9
| _ -> None
else
match r with
| 5 -> Some 0 // rdi
| 4 -> Some 1 // rsi
| 3 -> Some 2 // rdx
| 2 -> Some 3 // rcx
| 8 -> Some 4 // r8
| 9 -> Some 5 // r9
| _ -> None
let max_stdcall : nat = if IA.win then 4 else 6
let arity_ok_stdcall = arity_ok max_stdcall
let arg_reg_stdcall : arg_reg_relation max_stdcall =
Rel arg_of_register register_of_arg_i | false | true | Vale.Interop.X64.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 regs_modified_stdcall: MS.reg_64 -> bool | [] | Vale.Interop.X64.regs_modified_stdcall | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | r: Vale.X64.Machine_s.reg_64 -> Prims.bool | {
"end_col": 3,
"end_line": 666,
"start_col": 46,
"start_line": 654
} |
Prims.Tot | val register_of_arg_i (i: reg_nat (if IA.win then 4 else 6)) : MS.reg_64 | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 =
let open MS in
if IA.win then
match i with
| 0 -> rRcx
| 1 -> rRdx
| 2 -> rR8
| 3 -> rR9
else
match i with
| 0 -> rRdi
| 1 -> rRsi
| 2 -> rRdx
| 3 -> rRcx
| 4 -> rR8
| 5 -> rR9 | val register_of_arg_i (i: reg_nat (if IA.win then 4 else 6)) : MS.reg_64
let register_of_arg_i (i: reg_nat (if IA.win then 4 else 6)) : MS.reg_64 = | false | null | false | let open MS in
if IA.win
then
match i with
| 0 -> rRcx
| 1 -> rRdx
| 2 -> rR8
| 3 -> rR9
else
match i with
| 0 -> rRdi
| 1 -> rRsi
| 2 -> rRdx
| 3 -> rRcx
| 4 -> rR8
| 5 -> rR9 | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.Interop.X64.reg_nat",
"Vale.Interop.Assumptions.win",
"Prims.bool",
"Prims.nat",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rR8",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Machine_s.rRsi"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c
[@__reduce__]
let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args
[@__reduce__]
let rec rel_gen_t
(c:BS.code)
(td:list td)
(args:arg_list{List.length args + List.length td <= 20})
(f: arg_list -> Type) =
match td with
| [] -> f args
| hd::tl ->
x:td_as_type hd ->
rel_gen_t c tl (x++args) f
[@__reduce__]
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f)
: f args
= x
[@__reduce__]
let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f)
: (x:td_as_type hd ->
rel_gen_t c tl (x++args) f)
= p
let rec prediction_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length dom + List.length args <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
=
match dom with
| [] ->
prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
| hd::tl ->
x:td_as_type hd ->
prediction_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
[@__reduce__]
let elim_predict_t_nil
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(#args:arg_list)
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
= p
[@__reduce__]
let elim_predict_t_cons
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(hd:td)
(tl:list td)
(#args:arg_list{List.length args + List.length tl <= 19})
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel)
: x:td_as_type hd ->
prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
= p
[@__reduce__]
let rec as_lowstar_sig_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
[@__reduce__]
private
let rec as_lowstar_sig_t_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t_weak'
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
(* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *)
[@__reduce__]
let as_lowstar_sig_t_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= n})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict
val wrap_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:arity_ok n td)
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict | false | false | Vale.Interop.X64.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 register_of_arg_i (i: reg_nat (if IA.win then 4 else 6)) : MS.reg_64 | [] | Vale.Interop.X64.register_of_arg_i | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
i:
Vale.Interop.X64.reg_nat (match Vale.Interop.Assumptions.win with
| true -> 4
| _ -> 6)
-> Vale.X64.Machine_s.reg_64 | {
"end_col": 14,
"end_line": 624,
"start_col": 2,
"start_line": 610
} |
Prims.Tot | val arg_of_register (r: MS.reg_64) : option (reg_nat (if IA.win then 4 else 6)) | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let arg_of_register (r:MS.reg_64)
: option (reg_nat (if IA.win then 4 else 6))
= let open MS in
if IA.win then
match r with
| 2 -> Some 0 // rcx
| 3 -> Some 1 // rdx
| 8 -> Some 2 // r8
| 9 -> Some 3 // r9
| _ -> None
else
match r with
| 5 -> Some 0 // rdi
| 4 -> Some 1 // rsi
| 3 -> Some 2 // rdx
| 2 -> Some 3 // rcx
| 8 -> Some 4 // r8
| 9 -> Some 5 // r9
| _ -> None | val arg_of_register (r: MS.reg_64) : option (reg_nat (if IA.win then 4 else 6))
let arg_of_register (r: MS.reg_64) : option (reg_nat (if IA.win then 4 else 6)) = | false | null | false | let open MS in
if IA.win
then
match r with
| 2 -> Some 0
| 3 -> Some 1
| 8 -> Some 2
| 9 -> Some 3
| _ -> None
else
match r with
| 5 -> Some 0
| 4 -> Some 1
| 3 -> Some 2
| 2 -> Some 3
| 8 -> Some 4
| 9 -> Some 5
| _ -> None | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.X64.Machine_s.reg_64",
"Vale.Interop.Assumptions.win",
"FStar.Pervasives.Native.Some",
"Vale.Interop.X64.reg_nat",
"Prims.bool",
"Prims.nat",
"Prims.int",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c
[@__reduce__]
let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args
[@__reduce__]
let rec rel_gen_t
(c:BS.code)
(td:list td)
(args:arg_list{List.length args + List.length td <= 20})
(f: arg_list -> Type) =
match td with
| [] -> f args
| hd::tl ->
x:td_as_type hd ->
rel_gen_t c tl (x++args) f
[@__reduce__]
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f)
: f args
= x
[@__reduce__]
let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f)
: (x:td_as_type hd ->
rel_gen_t c tl (x++args) f)
= p
let rec prediction_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length dom + List.length args <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
=
match dom with
| [] ->
prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
| hd::tl ->
x:td_as_type hd ->
prediction_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
[@__reduce__]
let elim_predict_t_nil
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(#args:arg_list)
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
= p
[@__reduce__]
let elim_predict_t_cons
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(hd:td)
(tl:list td)
(#args:arg_list{List.length args + List.length tl <= 19})
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel)
: x:td_as_type hd ->
prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
= p
[@__reduce__]
let rec as_lowstar_sig_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
[@__reduce__]
private
let rec as_lowstar_sig_t_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
match dom with
| [] ->
(unit ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 ->
mem_roots_p h0 args /\
elim_rel_gen_t_nil pre_rel h0))
(ensures fun h0 ret h1 ->
as_lowstar_sig_post_weak n arg_reg regs_modified xmms_modified c args h0
#pre_rel #post_rel (elim_predict_t_nil predict) ret h1))
| hd::tl ->
x:td_as_type hd ->
as_lowstar_sig_t_weak'
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
(elim_predict_t_cons hd tl predict x)
private
val wrap_weak'
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td{List.length dom <= 20})
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
(* These two functions are the ones that are available from outside the module. The arity_ok restriction ensures that all arguments are passed in registers for inline assembly *)
[@__reduce__]
let as_lowstar_sig_t_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:list arg{List.length args + List.length dom <= n})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel) =
as_lowstar_sig_t_weak' n arg_reg regs_modified xmms_modified c dom args pre_rel post_rel predict
val wrap_weak
(n:nat{n <= 20})
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:arity_ok n td)
(#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))
(#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))
(predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)
: as_lowstar_sig_t_weak n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict
let register_of_arg_i (i:reg_nat (if IA.win then 4 else 6)) : MS.reg_64 =
let open MS in
if IA.win then
match i with
| 0 -> rRcx
| 1 -> rRdx
| 2 -> rR8
| 3 -> rR9
else
match i with
| 0 -> rRdi
| 1 -> rRsi
| 2 -> rRdx
| 3 -> rRcx
| 4 -> rR8
| 5 -> rR9
//A partial inverse of the above function
[@__reduce__]
let arg_of_register (r:MS.reg_64) | false | false | Vale.Interop.X64.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 arg_of_register (r: MS.reg_64) : option (reg_nat (if IA.win then 4 else 6)) | [] | Vale.Interop.X64.arg_of_register | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | r: Vale.X64.Machine_s.reg_64
-> FStar.Pervasives.Native.option (Vale.Interop.X64.reg_nat (match
Vale.Interop.Assumptions.win
with
| true -> 4
| _ -> 6)) | {
"end_col": 18,
"end_line": 646,
"start_col": 4,
"start_line": 630
} |
Prims.Tot | val elim_rel_gen_t_cons (#c hd tl #args #f: _) (p: rel_gen_t c (hd :: tl) args f)
: (x: td_as_type hd -> rel_gen_t c tl (x ++ args) f) | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f)
: (x:td_as_type hd ->
rel_gen_t c tl (x++args) f)
= p | val elim_rel_gen_t_cons (#c hd tl #args #f: _) (p: rel_gen_t c (hd :: tl) args f)
: (x: td_as_type hd -> rel_gen_t c tl (x ++ args) f)
let elim_rel_gen_t_cons #c hd tl #args #f (p: rel_gen_t c (hd :: tl) args f)
: (x: td_as_type hd -> rel_gen_t c tl (x ++ args) f) = | false | null | false | p | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.code",
"Vale.Interop.Base.td",
"Prims.list",
"Vale.Interop.X64.arg_list",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.arg",
"Prims.Cons",
"Vale.Interop.X64.rel_gen_t",
"Vale.Interop.Base.td_as_type",
"Vale.Interop.X64.op_Plus_Plus"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c
[@__reduce__]
let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args
[@__reduce__]
let rec rel_gen_t
(c:BS.code)
(td:list td)
(args:arg_list{List.length args + List.length td <= 20})
(f: arg_list -> Type) =
match td with
| [] -> f args
| hd::tl ->
x:td_as_type hd ->
rel_gen_t c tl (x++args) f
[@__reduce__]
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f)
: f args
= x
[@__reduce__]
let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f)
: (x:td_as_type hd -> | false | false | Vale.Interop.X64.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 elim_rel_gen_t_cons (#c hd tl #args #f: _) (p: rel_gen_t c (hd :: tl) args f)
: (x: td_as_type hd -> rel_gen_t c tl (x ++ args) f) | [] | Vale.Interop.X64.elim_rel_gen_t_cons | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
hd: Vale.Interop.Base.td ->
tl: Prims.list Vale.Interop.Base.td ->
p: Vale.Interop.X64.rel_gen_t c (hd :: tl) args f ->
x: Vale.Interop.Base.td_as_type hd
-> Vale.Interop.X64.rel_gen_t c tl (x ++ args) f | {
"end_col": 5,
"end_line": 420,
"start_col": 4,
"start_line": 420
} |
Prims.Tot | val elim_predict_t_nil
(#n: nat)
(#arg_reg: arg_reg_relation n)
(#regs_modified: (MS.reg_64 -> bool))
(#xmms_modified: (MS.reg_xmm -> bool))
(#c: BS.code)
(#args: arg_list)
(#pre_rel #post_rel: _)
(p: prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let elim_predict_t_nil
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(#args:arg_list)
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
= p | val elim_predict_t_nil
(#n: nat)
(#arg_reg: arg_reg_relation n)
(#regs_modified: (MS.reg_64 -> bool))
(#xmms_modified: (MS.reg_xmm -> bool))
(#c: BS.code)
(#args: arg_list)
(#pre_rel #post_rel: _)
(p: prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
let elim_predict_t_nil
(#n: nat)
(#arg_reg: arg_reg_relation n)
(#regs_modified: (MS.reg_64 -> bool))
(#xmms_modified: (MS.reg_xmm -> bool))
(#c: BS.code)
(#args: arg_list)
(#pre_rel #post_rel: _)
(p: prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel = | false | null | false | p | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"total"
] | [
"Prims.nat",
"Vale.Interop.X64.arg_reg_relation",
"Vale.X64.Machine_s.reg_64",
"Prims.bool",
"Vale.X64.Machine_s.reg_xmm",
"Vale.X64.Machine_Semantics_s.code",
"Vale.Interop.X64.arg_list",
"Vale.Interop.X64.rel_gen_t",
"Prims.Nil",
"Vale.Interop.Base.td",
"Vale.Interop.X64.prediction_pre_rel_t",
"Vale.Interop.X64.prediction_post_rel_t",
"Vale.Interop.X64.prediction_t",
"Vale.Interop.X64.prediction"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__]
let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm
let init_taint : taint_map = fun r -> Public
[@__reduce__]
let mk_taint (args:arg_list_sb) (tm:taint_map) : GTot taint_map =
List.fold_right_gtot args upd_taint_map_arg init_taint
let taint_of_arg (a:arg) =
let (| tag, x |) = a in
match tag with
| TD_ImmBuffer _ TUInt64 {taint=tnt}
| TD_ImmBuffer _ TUInt128 {taint=tnt}
| TD_Buffer _ TUInt64 {taint=tnt}
| TD_Buffer _ TUInt128 {taint=tnt} -> Some tnt
| _ -> None
let taint_arg_b8 (a:arg{Some? (taint_of_arg a)}) : GTot b8 =
let (| tag, x |) = a in
match tag with
| TD_Buffer src _ _ -> Buffer true (x <: B.buffer (base_typ_as_type src))
| TD_ImmBuffer src _ _ -> imm_to_b8 src x
let rec taint_arg_args_b8_mem (args:arg_list) (a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
List.memP (taint_arg_b8 a) (args_b8 args))
= match args with
| [] -> ()
| hd::tl ->
taint_arg_args_b8_mem tl a
let rec mk_taint_equiv
(args:arg_list_sb{disjoint_or_eq args})
(a:arg)
: Lemma (List.memP a args /\ Some? (taint_of_arg a) ==>
Some?.v (taint_of_arg a) == (mk_taint args init_taint) (taint_arg_b8 a))
= match args with
| [] -> ()
| hd::tl ->
mk_taint_equiv tl a;
let (| tag, x |) = hd in
match tag with
| TD_Base _ -> ()
| TD_Buffer _ _ _ | TD_ImmBuffer _ _ _ ->
disjoint_or_eq_cons hd tl;
BigOps.big_and'_forall (disjoint_or_eq_1 hd) tl
////////////////////////////////////////////////////////////////////////////////
let state_builder_t (max_arity:nat) (args:arg_list) (codom:Type) =
h0:HS.mem{mem_roots_p h0 args} ->
GTot codom
// Splitting the construction of the initial state into two functions
// one that creates the initial trusted state (i.e., part of our TCB)
// and another that just creates the vale state, a view upon the trusted one
let create_initial_trusted_state
(max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(args:arg_list)
: state_builder_t max_arity args (BS.machine_state & interop_heap) =
fun h0 ->
let open MS in
let regs_64 = register_of_args max_arity arg_reg (List.Tot.length args) args IA.init_regs in
let xmms = IA.init_xmms in
let flags = FunctionalExtensionality.on flag IA.init_flags in
let init_rsp = regs_64 rRsp in
let regs = FunctionalExtensionality.on_dom reg #t_reg (fun r ->
match r with
| Reg 0 r -> regs_64 r
| Reg 1 r -> xmms r)
in
// Create an initial empty stack
let stack = Map.const_on Set.empty 0 in
// Spill additional arguments on the stack
let stack = stack_of_args max_arity (List.Tot.length args) init_rsp args stack in
let mem:interop_heap = mk_mem args h0 in
let memTaint = create_memtaint mem (args_b8 args) (mk_taint args init_taint) in
let (s0:BS.machine_state) = {
BS.ms_ok = true;
BS.ms_regs = regs;
BS.ms_flags = flags;
BS.ms_heap = heap_create_impl mem memTaint;
BS.ms_stack = BS.Machine_stack init_rsp stack;
BS.ms_stackTaint = Map.const Public;
BS.ms_trace = [];
} in
(s0, mem)
////////////////////////////////////////////////////////////////////////////////
let prediction_pre_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
prop
let return_val_t (sn:BS.machine_state) = r:UInt64.t{UInt64.v r == BS.eval_reg_64 MS.rRax sn}
let return_val (sn:BS.machine_state) : return_val_t sn =
UInt64.uint_to_t (BS.eval_reg_64 MS.rRax sn)
let prediction_post_rel_t (c:BS.code) (args:arg_list) =
h0:mem_roots args ->
s0:BS.machine_state ->
(UInt64.t & nat & interop_heap) ->
sn:BS.machine_state ->
prop
[@__reduce__]
let prediction_pre
(n:nat)
(arg_reg:arg_reg_relation n)
(c:BS.code)
(args:arg_list)
(pre_rel: prediction_pre_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
=
pre_rel h0 /\
s0 == fst (create_initial_trusted_state n arg_reg args h0)
[@__reduce__]
let prediction_post
(n:nat)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(post_rel: prediction_post_rel_t c args)
(h0:mem_roots args)
(s0:BS.machine_state)
(rax_fuel_mem:(UInt64.t & nat & interop_heap)) =
let (rax, fuel, final_mem) = rax_fuel_mem in
Some? (BS.machine_eval_code c fuel s0) /\ (
let s1 = Some?.v (BS.machine_eval_code c fuel s0) in
let h1 = hs_of_mem final_mem in
FStar.HyperStack.ST.equal_domains h0 h1 /\
B.modifies (loc_modified_args args) h0 h1 /\
mem_roots_p h1 args /\
heap_create_machine (mk_mem args h1) == heap_get s1.BS.ms_heap /\
calling_conventions s0 s1 regs_modified xmms_modified /\
rax == return_val s1 /\
post_rel h0 s0 rax_fuel_mem s1
)
let prediction
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(pre_rel:prediction_pre_rel_t c args)
(post_rel:prediction_post_rel_t c args) =
h0:mem_roots args{pre_rel h0} ->
s0:BS.machine_state ->
Ghost (UInt64.t & nat & interop_heap)
(requires prediction_pre n arg_reg c args pre_rel h0 s0)
(ensures prediction_post n regs_modified xmms_modified c args post_rel h0 s0)
noeq
type as_lowstar_sig_ret =
| As_lowstar_sig_ret :
n:nat ->
args:arg_list ->
fuel:nat ->
final_mem:interop_heap ->
as_lowstar_sig_ret
let als_ret = UInt64.t & Ghost.erased as_lowstar_sig_ret
[@__reduce__]
let as_lowstar_sig_post
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
h1 == hs_of_mem final_mem /\
prediction_pre n arg_reg c args pre_rel h0 s0 /\
(rax, fuel, final_mem) == predict h0 s0 /\
prediction_post n regs_modified xmms_modified c args post_rel h0 s0 (rax, fuel, final_mem) /\
FStar.HyperStack.ST.equal_domains h0 h1)
[@__reduce__]
let as_lowstar_sig_post_weak
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(args:arg_list)
(h0:mem_roots args)
(#pre_rel:_)
(#post_rel: _)
(predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel)
(ret:als_ret)
(h1:HS.mem) =
(* write it this way to be reduction friendly *)
let rax = fst ret in
let ret = Ghost.reveal (snd ret) in
args == As_lowstar_sig_ret?.args ret /\
n == As_lowstar_sig_ret?.n ret /\
(let fuel = As_lowstar_sig_ret?.fuel ret in
let final_mem = As_lowstar_sig_ret?.final_mem ret in
let s0 = fst (create_initial_trusted_state n arg_reg args h0) in
(exists fuel
final_mem
s1.
h1 == hs_of_mem final_mem /\
rax == return_val s1 /\
post_rel h0 s0 (return_val s1, fuel, final_mem) s1))
[@__reduce__]
let as_lowstar_sig (c:BS.code) =
n:nat ->
arg_reg:arg_reg_relation n ->
regs_modified:(MS.reg_64 -> bool) ->
xmms_modified:(MS.reg_xmm -> bool) ->
args:arg_list ->
#pre_rel:_ ->
#post_rel:_ ->
predict:prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel ->
FStar.HyperStack.ST.Stack als_ret
(requires (fun h0 -> mem_roots_p h0 args /\ pre_rel h0))
(ensures fun h0 ret h1 -> as_lowstar_sig_post n arg_reg regs_modified xmms_modified c args h0 predict ret h1)
val wrap_variadic (c:BS.code) : as_lowstar_sig c
[@__reduce__]
let (++) (#t:td) (x:td_as_type t) (args:list arg) = (| t, x |) :: args
[@__reduce__]
let rec rel_gen_t
(c:BS.code)
(td:list td)
(args:arg_list{List.length args + List.length td <= 20})
(f: arg_list -> Type) =
match td with
| [] -> f args
| hd::tl ->
x:td_as_type hd ->
rel_gen_t c tl (x++args) f
[@__reduce__]
let elim_rel_gen_t_nil #c #args #f (x:rel_gen_t c [] args f)
: f args
= x
[@__reduce__]
let elim_rel_gen_t_cons #c hd tl #args #f (p:rel_gen_t c (hd::tl) args f)
: (x:td_as_type hd ->
rel_gen_t c tl (x++args) f)
= p
let rec prediction_t
(n:nat)
(arg_reg:arg_reg_relation n)
(regs_modified:MS.reg_64 -> bool)
(xmms_modified:MS.reg_xmm -> bool)
(c:BS.code)
(dom:list td)
(args:arg_list{List.length dom + List.length args <= 20})
(pre_rel:rel_gen_t c dom args (prediction_pre_rel_t c))
(post_rel:rel_gen_t c dom args (prediction_post_rel_t c))
=
match dom with
| [] ->
prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel
| hd::tl ->
x:td_as_type hd ->
prediction_t
n
arg_reg
regs_modified
xmms_modified
c
tl
(x ++ args)
(elim_rel_gen_t_cons hd tl pre_rel x)
(elim_rel_gen_t_cons hd tl post_rel x)
[@__reduce__]
let elim_predict_t_nil
(#n:nat)
(#arg_reg:arg_reg_relation n)
(#regs_modified:MS.reg_64 -> bool)
(#xmms_modified:MS.reg_xmm -> bool)
(#c:BS.code)
(#args:arg_list)
(#pre_rel:_)
(#post_rel:_)
(p:prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel) | false | false | Vale.Interop.X64.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 elim_predict_t_nil
(#n: nat)
(#arg_reg: arg_reg_relation n)
(#regs_modified: (MS.reg_64 -> bool))
(#xmms_modified: (MS.reg_xmm -> bool))
(#c: BS.code)
(#args: arg_list)
(#pre_rel #post_rel: _)
(p: prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel)
: prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel | [] | Vale.Interop.X64.elim_predict_t_nil | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | p: Vale.Interop.X64.prediction_t n arg_reg regs_modified xmms_modified c [] args pre_rel post_rel
-> Vale.Interop.X64.prediction n arg_reg regs_modified xmms_modified c args pre_rel post_rel | {
"end_col": 6,
"end_line": 462,
"start_col": 5,
"start_line": 462
} |
Prims.GTot | val upd_taint_map_arg (a: arg) (tm: taint_map) : GTot taint_map | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "List"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Interop",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let upd_taint_map_arg (a:arg) (tm:taint_map) : GTot taint_map =
match a with
| (| TD_Buffer _ _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ {taint=tnt}, x |) ->
upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _, _ |) ->
tm | val upd_taint_map_arg (a: arg) (tm: taint_map) : GTot taint_map
let upd_taint_map_arg (a: arg) (tm: taint_map) : GTot taint_map = | false | null | false | match a with
| (| TD_Buffer _ _ { taint = tnt } , x |) -> upd_taint_map_b8 tm (Buffer true x) tnt
| (| TD_ImmBuffer src _ { taint = tnt } , x |) -> upd_taint_map_b8 tm (imm_to_b8 src x) tnt
| (| TD_Base _ , _ |) -> tm | {
"checked_file": "Vale.Interop.X64.fsti.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.StrongExcludedMiddle.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Interop.X64.fsti"
} | [
"sometrivial"
] | [
"Vale.Interop.Base.arg",
"Vale.Interop.X64.taint_map",
"Vale.Arch.HeapTypes_s.base_typ",
"Prims.bool",
"Vale.Arch.HeapTypes_s.taint",
"Vale.Interop.Base.td_as_type",
"Vale.Interop.Base.TD_Buffer",
"Vale.Interop.Base.Mkbuffer_qualifiers",
"Vale.Interop.X64.upd_taint_map_b8",
"Vale.Interop.Types.Buffer",
"Vale.Interop.Base.TD_ImmBuffer",
"Vale.Interop.Base.imm_to_b8",
"Vale.Interop.Base.valid_base_type",
"Vale.Interop.Base.TD_Base"
] | [] | module Vale.Interop.X64
open FStar.Mul
open Vale.Interop.Base
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
module B = LowStar.Buffer
module BS = Vale.X64.Machine_Semantics_s
module UV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
module HS = FStar.HyperStack
module MS = Vale.X64.Machine_s
module IA = Vale.Interop.Assumptions
module List = FStar.List.Tot
////////////////////////////////////////////////////////////////////////////////
//The calling convention w.r.t the register mapping
////////////////////////////////////////////////////////////////////////////////
let calling_conventions
(s0 s1:BS.machine_state)
(regs_modified: MS.reg_64 -> bool)
(xmms_modified: MS.reg_xmm -> bool) =
let s0 = s0 in
let s1 = s1 in
s1.BS.ms_ok /\
s0.BS.ms_regs MS.reg_Rsp == s1.BS.ms_regs MS.reg_Rsp /\
(forall (r:MS.reg). {:pattern (s0.BS.ms_regs r)}
match r with
| MS.Reg 0 r -> not (regs_modified r) ==> s0.BS.ms_regs (MS.Reg 0 r) == s1.BS.ms_regs (MS.Reg 0 r)
| MS.Reg 1 r -> not (xmms_modified r) ==> s0.BS.ms_regs (MS.Reg 1 r) == s1.BS.ms_regs (MS.Reg 1 r)
)
let reg_nat (n:nat) = i:nat{i < n}
let arity_ok n 'a = l:list 'a { List.Tot.length l <= n }
(* We limit the number of args we can pass through the interop wrappers to an arbitrary 20.
This ensures first that the addr_map axiom is sound: Since the length of buffers is limited to 2^32, we can prove that addr_map is inhabited.
for extra arguments + the extra slots needed.
Note that this number can be increased if needed*)
let arg_list = l:list arg{List.Tot.length l <= 20}
let arg_list_sb = l:list arg{List.Tot.length l <= 21}
unfold
let injective f = forall x y.{:pattern f x; f y} f x == f y ==> x == y
noeq
type arg_reg_relation' (n:nat) =
| Rel: of_reg:(MS.reg_64 -> option (reg_nat n)) ->
of_arg:(reg_nat n -> MS.reg_64){
// This function should be injective
injective of_arg /\
// rRsp is not a valid register to store paramters
(forall (i:reg_nat n).{:pattern of_arg i} of_arg i <> MS.rRsp) /\
// of_reg should always return Some when the register corresponds to an of_arg
(forall (i:reg_nat n).{:pattern of_arg i}
Some? (of_reg (of_arg i)) /\ Some?.v (of_reg (of_arg i)) = i)} ->
arg_reg_relation' n
unfold
let arg_reg_relation (n:nat) = (v:arg_reg_relation' n{
// of_reg is a partial inverse of of_arg
forall (r:MS.reg_64).{:pattern v.of_reg r} Some? (v.of_reg r) ==> v.of_arg (Some?.v (v.of_reg r)) = r})
let registers = MS.reg_64 -> MS.nat64
let upd_reg (n:nat) (arg_reg:arg_reg_relation n) (regs:registers) (i:nat) (v:_) : registers =
fun (r:MS.reg_64) ->
match arg_reg.of_reg r with
| Some j ->
if i = j then v
else regs r
| _ -> regs r
[@__reduce__]
let arg_as_nat64 (a:arg) : GTot MS.nat64 =
let (| tag, x |) = a in
match tag with
| TD_Base TUInt8 ->
UInt8.v x
| TD_Base TUInt16 ->
UInt16.v x
| TD_Base TUInt32 ->
UInt32.v x
| TD_Base TUInt64 ->
UInt64.v x
| TD_Buffer src _ _ ->
let b:b8 = Buffer true (x <: B.buffer (base_typ_as_type src)) in
global_addrs_map b
| TD_ImmBuffer src _ _ -> global_addrs_map (imm_to_b8 src x)
[@__reduce__]
let update_regs (n:nat)
(arg_reg:arg_reg_relation n)
(x:arg)
(i:reg_nat n)
(regs:registers)
: GTot registers
= upd_reg n arg_reg regs i (arg_as_nat64 x)
[@__reduce__]
let rec register_of_args (max_arity:nat)
(arg_reg:arg_reg_relation max_arity)
(n:nat)
(args:arg_list{List.Tot.length args = n})
(regs:registers) : GTot (regs':registers{regs MS.rRsp == regs' MS.rRsp}) =
match args with
| [] -> regs
| hd::tl ->
if n > max_arity then
// This arguments will be passed on the stack
register_of_args max_arity arg_reg (n-1) tl regs
else
update_regs max_arity arg_reg hd (n - 1) (register_of_args max_arity arg_reg (n - 1) tl regs)
// Pass extra arguments on the stack. The arity_ok condition on inline wrappers ensures that
// this only happens for stdcalls
[@__reduce__]
let rec stack_of_args (max_arity:nat)
(n:nat)
(rsp:int)
(args:arg_list{List.Tot.length args = n})
(st:Map.t int Vale.Def.Words_s.nat8)
: GTot (Map.t int Vale.Def.Words_s.nat8) =
match args with
| [] -> st
| hd::tl ->
if n <= max_arity then st // We can pass the remaining args in registers
else
let ptr = ((n - max_arity) - 1) * 8 // Arguments on the stack are pushed from right to left
+ (if IA.win then 32 else 0) // The shadow space on Windows comes next
+ 8 // The return address is then pushed on the stack
+ rsp // And we then have all the extra slots required for the Vale procedure
in
let st1 = stack_of_args max_arity (n-1) rsp tl st in
let v = arg_as_nat64 hd in // We will store the arg hd
BS.update_heap64 ptr v st1
////////////////////////////////////////////////////////////////////////////////
let taint_map = b8 -> GTot taint
let upd_taint_map_b8 (tm:taint_map) (x:b8) (tnt:taint) : taint_map =
fun (y:b8) ->
if StrongExcludedMiddle.strong_excluded_middle ((x <: b8) == y) then
tnt
else tm y
[@__reduce__] | false | false | Vale.Interop.X64.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 upd_taint_map_arg (a: arg) (tm: taint_map) : GTot taint_map | [] | Vale.Interop.X64.upd_taint_map_arg | {
"file_name": "vale/specs/interop/Vale.Interop.X64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Interop.Base.arg -> tm: Vale.Interop.X64.taint_map -> Prims.GTot Vale.Interop.X64.taint_map | {
"end_col": 8,
"end_line": 155,
"start_col": 4,
"start_line": 149
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.