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": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64
let va_is_src_shift_amt64 (o: operand64) (s: va_state) =
false
null
false
valid_operand o s /\ (va_eval_shift_amt64 s o) < 64
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.operand64", "Vale.X64.Decls.va_state", "Prims.l_and", "Vale.X64.Decls.valid_operand", "Prims.b2t", "Prims.op_LessThan", "Vale.X64.Decls.va_eval_shift_amt64", "Prims.logical" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_is_src_shift_amt64 : o: Vale.X64.Machine_s.operand64 -> s: Vale.X64.Decls.va_state -> Prims.logical
[]
Vale.X64.Decls.va_is_src_shift_amt64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
o: Vale.X64.Machine_s.operand64 -> s: Vale.X64.Decls.va_state -> Prims.logical
{ "end_col": 125, "end_line": 239, "start_col": 74, "start_line": 239 }
Prims.GTot
val buffer128_read (b: M.buffer128) (i: int) (h: vale_heap) : GTot quad32
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h
val buffer128_read (b: M.buffer128) (i: int) (h: vale_heap) : GTot quad32 let buffer128_read (b: M.buffer128) (i: int) (h: vale_heap) : GTot quad32 =
false
null
false
M.buffer_read b i h
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Memory.buffer128", "Prims.int", "Vale.X64.Decls.vale_heap", "Vale.X64.Memory.buffer_read", "Vale.X64.Memory.vuint128", "Vale.X64.Decls.quad32" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i
false
false
Vale.X64.Decls.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 buffer128_read (b: M.buffer128) (i: int) (h: vale_heap) : GTot quad32
[]
Vale.X64.Decls.buffer128_read
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b: Vale.X64.Memory.buffer128 -> i: Prims.int -> h: Vale.X64.Decls.vale_heap -> Prims.GTot Vale.X64.Decls.quad32
{ "end_col": 99, "end_line": 116, "start_col": 80, "start_line": 116 }
Prims.Tot
val upd_register (r: reg) (v: t_reg r) (s: vale_state) : vale_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s
val upd_register (r: reg) (v: t_reg r) (s: vale_state) : vale_state let upd_register (r: reg) (v: t_reg r) (s: vale_state) : vale_state =
false
null
false
update_reg r v s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.reg", "Vale.X64.Machine_s.t_reg", "Vale.X64.State.vale_state", "Vale.X64.State.update_reg" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok }
false
false
Vale.X64.Decls.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_register (r: reg) (v: t_reg r) (s: vale_state) : vale_state
[]
Vale.X64.Decls.upd_register
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
r: Vale.X64.Machine_s.reg -> v: Vale.X64.Machine_s.t_reg r -> s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
{ "end_col": 95, "end_line": 214, "start_col": 79, "start_line": 214 }
Prims.GTot
val va_eval_opr64 (s: va_state) (o: operand64) : GTot nat64
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s
val va_eval_opr64 (s: va_state) (o: operand64) : GTot nat64 let va_eval_opr64 (s: va_state) (o: operand64) : GTot nat64 =
false
null
false
eval_operand o s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.Machine_s.operand64", "Vale.X64.State.eval_operand", "Vale.Def.Types_s.nat64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint }
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_eval_opr64 (s: va_state) (o: operand64) : GTot nat64
[]
Vale.X64.Decls.va_eval_opr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> o: Vale.X64.Machine_s.operand64 -> Prims.GTot Vale.Def.Types_s.nat64
{ "end_col": 106, "end_line": 225, "start_col": 90, "start_line": 225 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_is_src_xmm (x:reg_xmm) (s:va_state) = True
let va_is_src_xmm (x: reg_xmm) (s: va_state) =
false
null
false
True
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.reg_xmm", "Vale.X64.Decls.va_state", "Prims.l_True", "Prims.logical" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_is_src_xmm : x: Vale.X64.Machine_s.reg_xmm -> s: Vale.X64.Decls.va_state -> Prims.logical
[]
Vale.X64.Decls.va_is_src_xmm
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.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 -> s: Vale.X64.Decls.va_state -> Prims.logical
{ "end_col": 68, "end_line": 242, "start_col": 64, "start_line": 242 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let modifies_buffer_2 (b1 b2:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2
let modifies_buffer_2 (b1 b2: M.buffer64) (h1 h2: vale_heap) =
false
null
false
modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Memory.buffer64", "Vale.X64.Decls.vale_heap", "Vale.X64.Decls.modifies_mem", "Vale.X64.Memory.loc_union", "Vale.X64.Decls.loc_buffer", "Vale.X64.Memory.vuint64", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s [@va_qattr] unfold let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s let va_lemma_upd_update (sM:vale_state) : Lemma ( (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_dst_opr64 o sM sK)} va_is_dst_dst_opr64 o sK ==> va_update_operand_dst_opr64 o sM sK == va_upd_operand_dst_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_reg_opr64 o sM sK)} va_is_dst_reg_opr64 o sK ==> va_update_operand_reg_opr64 o sM sK == va_upd_operand_reg_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (x:reg_xmm).{:pattern (va_update_operand_xmm x sM sK)} va_update_operand_xmm x sM sK == va_upd_operand_xmm x (eval_reg_xmm x sM) sK) ) = () (** Constructors for va_codes *) [@va_qattr] unfold let va_CNil () : va_codes = [] [@va_qattr] unfold let va_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl (** Constructors for va_code *) unfold let va_Block (block:va_codes) : va_code = Block block unfold let va_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse unfold let va_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp unfold let va_get_block (c:va_code{Block? c}) : va_codes = Block?.block c unfold let va_get_ifCond (c:va_code{IfElse? c}) : ocmp = IfElse?.ifCond c unfold let va_get_ifTrue (c:va_code{IfElse? c}) : va_code = IfElse?.ifTrue c unfold let va_get_ifFalse (c:va_code{IfElse? c}) : va_code = IfElse?.ifFalse c unfold let va_get_whileCond (c:va_code{While? c}) : ocmp = While?.whileCond c unfold let va_get_whileBody (c:va_code{While? c}) : va_code = While?.whileBody c (** Map syntax **) //unfold let (.[]) (m:vale_heap) (b:M.buffer64) = fun index -> buffer64_read b index m // syntax for map accesses, m.[key] and m.[key] <- value (* type map (key:eqtype) (value:Type) = Map.t key value unfold let (.[]) = Map.sel unfold let (.[]<-) = Map.upd *) (** Memory framing **) (* unfold let in_mem (addr:int) (m:mem) : bool = m `Map.contains` addr let disjoint (ptr1:int) (num_bytes1:int) (ptr2:int) (num_bytes2:int) = ptr1 + num_bytes1 <= ptr2 \/ ptr2 + num_bytes2 <= ptr1 let validSrcAddrs (mem:mem) (addr:int) (size:int) (num_bytes:int) = size == 64 /\ (forall (a:int) . {:pattern (mem `Map.contains` a)} addr <= a && a < addr+num_bytes && (a - addr) % 8 = 0 ==> mem `Map.contains` a) let memModified (old_mem:mem) (new_mem:mem) (ptr:int) (num_bytes) = (forall (a:int) . {:pattern (new_mem `Map.contains` a)} old_mem `Map.contains` a <==> new_mem `Map.contains` a) /\ (forall (a:int) . {:pattern (new_mem.[a]) \/ Map.sel new_mem a} a < ptr || a >= ptr + num_bytes ==> old_mem.[a] == new_mem.[ a]) *) (** Convenient memory-related functions **) let rec buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l) = match l with | [] -> True | b :: l' -> buffer_readable h b /\ buffers_readable h l' unfold let modifies_buffer (b:M.buffer64) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2
false
true
Vale.X64.Decls.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 modifies_buffer_2 : b1: Vale.X64.Memory.buffer64 -> b2: Vale.X64.Memory.buffer64 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> Vale.Def.Prop_s.prop0
[]
Vale.X64.Decls.modifies_buffer_2
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b1: Vale.X64.Memory.buffer64 -> b2: Vale.X64.Memory.buffer64 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> Vale.Def.Prop_s.prop0
{ "end_col": 66, "end_line": 392, "start_col": 2, "start_line": 392 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_value_reg_opr64 = nat64
let va_value_reg_opr64 =
false
null
false
nat64
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.Def.Types_s.nat64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_value_reg_opr64 : Type0
[]
Vale.X64.Decls.va_value_reg_opr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 37, "end_line": 299, "start_col": 32, "start_line": 299 }
Prims.Tot
val va_update_stack (sM sK: va_state) : va_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK
val va_update_stack (sM sK: va_state) : va_state let va_update_stack (sM sK: va_state) : va_state =
false
null
false
va_upd_stack sM.vs_stack sK
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.Decls.va_upd_stack", "Vale.X64.State.__proj__Mkvale_state__item__vs_stack" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state =
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_update_stack (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_stack
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 107, "end_line": 262, "start_col": 80, "start_line": 262 }
Prims.Tot
val va_upd_operand_heaplet (h: heaplet_id) (v: vale_heap) (s: va_state) : va_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s
val va_upd_operand_heaplet (h: heaplet_id) (v: vale_heap) (s: va_state) : va_state let va_upd_operand_heaplet (h: heaplet_id) (v: vale_heap) (s: va_state) : va_state =
false
null
false
va_upd_mem_heaplet h v s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.heaplet_id", "Vale.X64.Decls.vale_heap", "Vale.X64.Decls.va_state", "Vale.X64.Decls.va_upd_mem_heaplet" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_upd_operand_heaplet (h: heaplet_id) (v: vale_heap) (s: va_state) : va_state
[]
Vale.X64.Decls.va_upd_operand_heaplet
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
h: Vale.X64.Decls.heaplet_id -> v: Vale.X64.Decls.vale_heap -> s: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 113, "end_line": 324, "start_col": 89, "start_line": 324 }
Prims.GTot
val va_eval_opr128 (s: va_state) (o: operand128) : GTot quad32
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s
val va_eval_opr128 (s: va_state) (o: operand128) : GTot quad32 let va_eval_opr128 (s: va_state) (o: operand128) : GTot quad32 =
false
null
false
eval_operand128 o s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.Machine_s.operand128", "Vale.X64.State.eval_operand128", "Vale.X64.Decls.quad32" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_eval_opr128 (s: va_state) (o: operand128) : GTot quad32
[]
Vale.X64.Decls.va_eval_opr128
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> o: Vale.X64.Machine_s.operand128 -> Prims.GTot Vale.X64.Decls.quad32
{ "end_col": 108, "end_line": 232, "start_col": 89, "start_line": 232 }
Prims.Tot
val va_get_ifCond (c: va_code{IfElse? c}) : ocmp
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_get_ifCond (c:va_code{IfElse? c}) : ocmp = IfElse?.ifCond c
val va_get_ifCond (c: va_code{IfElse? c}) : ocmp let va_get_ifCond (c: va_code{IfElse? c}) : ocmp =
false
null
false
IfElse?.ifCond c
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_code", "Prims.b2t", "Vale.X64.Machine_s.uu___is_IfElse", "Vale.X64.Decls.ins", "Vale.X64.Decls.ocmp", "Vale.X64.Machine_s.__proj__IfElse__item__ifCond" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s [@va_qattr] unfold let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s let va_lemma_upd_update (sM:vale_state) : Lemma ( (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_dst_opr64 o sM sK)} va_is_dst_dst_opr64 o sK ==> va_update_operand_dst_opr64 o sM sK == va_upd_operand_dst_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_reg_opr64 o sM sK)} va_is_dst_reg_opr64 o sK ==> va_update_operand_reg_opr64 o sM sK == va_upd_operand_reg_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (x:reg_xmm).{:pattern (va_update_operand_xmm x sM sK)} va_update_operand_xmm x sM sK == va_upd_operand_xmm x (eval_reg_xmm x sM) sK) ) = () (** Constructors for va_codes *) [@va_qattr] unfold let va_CNil () : va_codes = [] [@va_qattr] unfold let va_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl (** Constructors for va_code *) unfold let va_Block (block:va_codes) : va_code = Block block unfold let va_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse unfold let va_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_get_ifCond (c: va_code{IfElse? c}) : ocmp
[]
Vale.X64.Decls.va_get_ifCond
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
c: Vale.X64.Decls.va_code{IfElse? c} -> Vale.X64.Decls.ocmp
{ "end_col": 73, "end_line": 351, "start_col": 57, "start_line": 351 }
Prims.Tot
val va_update_ok (sM sK: va_state) : va_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK
val va_update_ok (sM sK: va_state) : va_state let va_update_ok (sM sK: va_state) : va_state =
false
null
false
va_upd_ok sM.vs_ok sK
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.Decls.va_upd_ok", "Vale.X64.State.__proj__Mkvale_state__item__vs_ok" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_update_ok (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_ok
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 98, "end_line": 250, "start_col": 77, "start_line": 250 }
Prims.Tot
val va_upd_stackTaint (stackTaint: M.memtaint) (s: vale_state) : vale_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint }
val va_upd_stackTaint (stackTaint: M.memtaint) (s: vale_state) : vale_state let va_upd_stackTaint (stackTaint: M.memtaint) (s: vale_state) : vale_state =
false
null
false
{ s with vs_stackTaint = stackTaint }
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Memory.memtaint", "Vale.X64.State.vale_state", "Vale.X64.State.Mkvale_state", "Vale.X64.State.__proj__Mkvale_state__item__vs_ok", "Vale.X64.State.__proj__Mkvale_state__item__vs_regs", "Vale.X64.State.__proj__Mkvale_state__item__vs_flags", "Vale.X64.State.__proj__Mkvale_state__item__vs_heap", "Vale.X64.State.__proj__Mkvale_state__item__vs_stack" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } }
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_upd_stackTaint (stackTaint: M.memtaint) (s: vale_state) : vale_state
[]
Vale.X64.Decls.va_upd_stackTaint
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
stackTaint: Vale.X64.Memory.memtaint -> s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
{ "end_col": 123, "end_line": 222, "start_col": 90, "start_line": 222 }
Prims.Tot
val va_update_stackTaint (sM sK: va_state) : va_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK
val va_update_stackTaint (sM sK: va_state) : va_state let va_update_stackTaint (sM sK: va_state) : va_state =
false
null
false
va_upd_stackTaint sM.vs_stackTaint sK
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.Decls.va_upd_stackTaint", "Vale.X64.State.__proj__Mkvale_state__item__vs_stackTaint" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_update_stackTaint (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_stackTaint
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 122, "end_line": 263, "start_col": 85, "start_line": 263 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let buffers_disjoint128 (b1 b2:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2]
let buffers_disjoint128 (b1 b2: M.buffer128) =
false
null
false
locs_disjoint [loc_buffer b1; loc_buffer b2]
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Memory.buffer128", "Vale.X64.Decls.locs_disjoint", "Prims.Cons", "Vale.X64.Memory.loc", "Vale.X64.Decls.loc_buffer", "Vale.X64.Memory.vuint128", "Prims.Nil", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s [@va_qattr] unfold let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s let va_lemma_upd_update (sM:vale_state) : Lemma ( (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_dst_opr64 o sM sK)} va_is_dst_dst_opr64 o sK ==> va_update_operand_dst_opr64 o sM sK == va_upd_operand_dst_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_reg_opr64 o sM sK)} va_is_dst_reg_opr64 o sK ==> va_update_operand_reg_opr64 o sM sK == va_upd_operand_reg_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (x:reg_xmm).{:pattern (va_update_operand_xmm x sM sK)} va_update_operand_xmm x sM sK == va_upd_operand_xmm x (eval_reg_xmm x sM) sK) ) = () (** Constructors for va_codes *) [@va_qattr] unfold let va_CNil () : va_codes = [] [@va_qattr] unfold let va_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl (** Constructors for va_code *) unfold let va_Block (block:va_codes) : va_code = Block block unfold let va_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse unfold let va_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp unfold let va_get_block (c:va_code{Block? c}) : va_codes = Block?.block c unfold let va_get_ifCond (c:va_code{IfElse? c}) : ocmp = IfElse?.ifCond c unfold let va_get_ifTrue (c:va_code{IfElse? c}) : va_code = IfElse?.ifTrue c unfold let va_get_ifFalse (c:va_code{IfElse? c}) : va_code = IfElse?.ifFalse c unfold let va_get_whileCond (c:va_code{While? c}) : ocmp = While?.whileCond c unfold let va_get_whileBody (c:va_code{While? c}) : va_code = While?.whileBody c (** Map syntax **) //unfold let (.[]) (m:vale_heap) (b:M.buffer64) = fun index -> buffer64_read b index m // syntax for map accesses, m.[key] and m.[key] <- value (* type map (key:eqtype) (value:Type) = Map.t key value unfold let (.[]) = Map.sel unfold let (.[]<-) = Map.upd *) (** Memory framing **) (* unfold let in_mem (addr:int) (m:mem) : bool = m `Map.contains` addr let disjoint (ptr1:int) (num_bytes1:int) (ptr2:int) (num_bytes2:int) = ptr1 + num_bytes1 <= ptr2 \/ ptr2 + num_bytes2 <= ptr1 let validSrcAddrs (mem:mem) (addr:int) (size:int) (num_bytes:int) = size == 64 /\ (forall (a:int) . {:pattern (mem `Map.contains` a)} addr <= a && a < addr+num_bytes && (a - addr) % 8 = 0 ==> mem `Map.contains` a) let memModified (old_mem:mem) (new_mem:mem) (ptr:int) (num_bytes) = (forall (a:int) . {:pattern (new_mem `Map.contains` a)} old_mem `Map.contains` a <==> new_mem `Map.contains` a) /\ (forall (a:int) . {:pattern (new_mem.[a]) \/ Map.sel new_mem a} a < ptr || a >= ptr + num_bytes ==> old_mem.[a] == new_mem.[ a]) *) (** Convenient memory-related functions **) let rec buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l) = match l with | [] -> True | b :: l' -> buffer_readable h b /\ buffers_readable h l' unfold let modifies_buffer (b:M.buffer64) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer_2 (b1 b2:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer_3 (b1 b2 b3:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 unfold let modifies_buffer128 (b:M.buffer128) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer128_2 (b1 b2:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer128_3 (b1 b2 b3:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 let validSrcAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = buffer_readable h b /\ len <= buffer_length b /\ M.buffer_addr b h == addr /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) false /\ M.valid_taint_buf b h layout.vl_taint tn let validDstAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) true /\ buffer_writeable b let validSrcAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h (addr - 16 * offset) b (len + offset) layout tn let validDstAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h (addr - 16 * offset) b (len + offset) layout tn let modifies_buffer_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer128 b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let buffer_modifies_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let modifies_buffer_specific (b:M.buffer64) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer64_read b i h1 == buffer64_read b i h2) unfold let buffers_disjoint (b1 b2:M.buffer64) = locs_disjoint [loc_buffer b1; loc_buffer b2]
false
true
Vale.X64.Decls.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 buffers_disjoint128 : b1: Vale.X64.Memory.buffer128 -> b2: Vale.X64.Memory.buffer128 -> Vale.Def.Prop_s.prop0
[]
Vale.X64.Decls.buffers_disjoint128
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b1: Vale.X64.Memory.buffer128 -> b2: Vale.X64.Memory.buffer128 -> Vale.Def.Prop_s.prop0
{ "end_col": 48, "end_line": 461, "start_col": 4, "start_line": 461 }
Prims.Tot
val va_ensure_total (c0: va_code) (s0 s1: va_state) (f1: va_fuel) : prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_ensure_total (c0:va_code) (s0:va_state) (s1:va_state) (f1:va_fuel) : prop0 = eval_code c0 s0 f1 s1 /\ state_inv s1
val va_ensure_total (c0: va_code) (s0 s1: va_state) (f1: va_fuel) : prop0 let va_ensure_total (c0: va_code) (s0 s1: va_state) (f1: va_fuel) : prop0 =
false
null
false
eval_code c0 s0 f1 s1 /\ state_inv s1
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_code", "Vale.X64.Decls.va_state", "Vale.X64.Decls.va_fuel", "Prims.l_and", "Vale.X64.Decls.eval_code", "Vale.X64.Decls.state_inv", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s [@va_qattr] unfold let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s let va_lemma_upd_update (sM:vale_state) : Lemma ( (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_dst_opr64 o sM sK)} va_is_dst_dst_opr64 o sK ==> va_update_operand_dst_opr64 o sM sK == va_upd_operand_dst_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_reg_opr64 o sM sK)} va_is_dst_reg_opr64 o sK ==> va_update_operand_reg_opr64 o sM sK == va_upd_operand_reg_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (x:reg_xmm).{:pattern (va_update_operand_xmm x sM sK)} va_update_operand_xmm x sM sK == va_upd_operand_xmm x (eval_reg_xmm x sM) sK) ) = () (** Constructors for va_codes *) [@va_qattr] unfold let va_CNil () : va_codes = [] [@va_qattr] unfold let va_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl (** Constructors for va_code *) unfold let va_Block (block:va_codes) : va_code = Block block unfold let va_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse unfold let va_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp unfold let va_get_block (c:va_code{Block? c}) : va_codes = Block?.block c unfold let va_get_ifCond (c:va_code{IfElse? c}) : ocmp = IfElse?.ifCond c unfold let va_get_ifTrue (c:va_code{IfElse? c}) : va_code = IfElse?.ifTrue c unfold let va_get_ifFalse (c:va_code{IfElse? c}) : va_code = IfElse?.ifFalse c unfold let va_get_whileCond (c:va_code{While? c}) : ocmp = While?.whileCond c unfold let va_get_whileBody (c:va_code{While? c}) : va_code = While?.whileBody c (** Map syntax **) //unfold let (.[]) (m:vale_heap) (b:M.buffer64) = fun index -> buffer64_read b index m // syntax for map accesses, m.[key] and m.[key] <- value (* type map (key:eqtype) (value:Type) = Map.t key value unfold let (.[]) = Map.sel unfold let (.[]<-) = Map.upd *) (** Memory framing **) (* unfold let in_mem (addr:int) (m:mem) : bool = m `Map.contains` addr let disjoint (ptr1:int) (num_bytes1:int) (ptr2:int) (num_bytes2:int) = ptr1 + num_bytes1 <= ptr2 \/ ptr2 + num_bytes2 <= ptr1 let validSrcAddrs (mem:mem) (addr:int) (size:int) (num_bytes:int) = size == 64 /\ (forall (a:int) . {:pattern (mem `Map.contains` a)} addr <= a && a < addr+num_bytes && (a - addr) % 8 = 0 ==> mem `Map.contains` a) let memModified (old_mem:mem) (new_mem:mem) (ptr:int) (num_bytes) = (forall (a:int) . {:pattern (new_mem `Map.contains` a)} old_mem `Map.contains` a <==> new_mem `Map.contains` a) /\ (forall (a:int) . {:pattern (new_mem.[a]) \/ Map.sel new_mem a} a < ptr || a >= ptr + num_bytes ==> old_mem.[a] == new_mem.[ a]) *) (** Convenient memory-related functions **) let rec buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l) = match l with | [] -> True | b :: l' -> buffer_readable h b /\ buffers_readable h l' unfold let modifies_buffer (b:M.buffer64) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer_2 (b1 b2:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer_3 (b1 b2 b3:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 unfold let modifies_buffer128 (b:M.buffer128) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer128_2 (b1 b2:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer128_3 (b1 b2 b3:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 let validSrcAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = buffer_readable h b /\ len <= buffer_length b /\ M.buffer_addr b h == addr /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) false /\ M.valid_taint_buf b h layout.vl_taint tn let validDstAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) true /\ buffer_writeable b let validSrcAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h (addr - 16 * offset) b (len + offset) layout tn let validDstAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h (addr - 16 * offset) b (len + offset) layout tn let modifies_buffer_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer128 b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let buffer_modifies_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let modifies_buffer_specific (b:M.buffer64) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer64_read b i h1 == buffer64_read b i h2) unfold let buffers_disjoint (b1 b2:M.buffer64) = locs_disjoint [loc_buffer b1; loc_buffer b2] unfold let buffers_disjoint128 (b1 b2:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2] let rec loc_locs_disjoint_rec128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = match ls with | [] -> True | h::t -> locs_disjoint [loc_buffer l; loc_buffer h] /\ loc_locs_disjoint_rec128 l t unfold let buffer_disjoints128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = norm [zeta; iota; delta_only [`%loc_locs_disjoint_rec128]] (loc_locs_disjoint_rec128 l ls) unfold let buffers3_disjoint128 (b1 b2 b3:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2; loc_buffer b3] val eval_code (c:va_code) (s0:va_state) (f0:va_fuel) (sN:va_state) : prop0 val eval_while_inv (c:va_code) (s0:va_state) (fW:va_fuel) (sW:va_state) : prop0 [@va_qattr] let va_state_eq (s0:va_state) (s1:va_state) : prop0 = state_eq s0 s1 let state_inv (s:va_state) : prop0 = M.mem_inv s.vs_heap let vale_state_with_inv = s:va_state{state_inv s} let va_require_total (c0:va_code) (c1:va_code) (s0:va_state) : prop0 = c0 == c1 /\ state_inv s0
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_ensure_total (c0: va_code) (s0 s1: va_state) (f1: va_fuel) : prop0
[]
Vale.X64.Decls.va_ensure_total
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
c0: Vale.X64.Decls.va_code -> s0: Vale.X64.Decls.va_state -> s1: Vale.X64.Decls.va_state -> f1: Vale.X64.Decls.va_fuel -> Vale.Def.Prop_s.prop0
{ "end_col": 39, "end_line": 489, "start_col": 2, "start_line": 489 }
Prims.Tot
val va_state_eq (s0 s1: va_state) : prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_state_eq (s0:va_state) (s1:va_state) : prop0 = state_eq s0 s1
val va_state_eq (s0 s1: va_state) : prop0 let va_state_eq (s0 s1: va_state) : prop0 =
false
null
false
state_eq s0 s1
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.State.state_eq", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s [@va_qattr] unfold let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s let va_lemma_upd_update (sM:vale_state) : Lemma ( (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_dst_opr64 o sM sK)} va_is_dst_dst_opr64 o sK ==> va_update_operand_dst_opr64 o sM sK == va_upd_operand_dst_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_reg_opr64 o sM sK)} va_is_dst_reg_opr64 o sK ==> va_update_operand_reg_opr64 o sM sK == va_upd_operand_reg_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (x:reg_xmm).{:pattern (va_update_operand_xmm x sM sK)} va_update_operand_xmm x sM sK == va_upd_operand_xmm x (eval_reg_xmm x sM) sK) ) = () (** Constructors for va_codes *) [@va_qattr] unfold let va_CNil () : va_codes = [] [@va_qattr] unfold let va_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl (** Constructors for va_code *) unfold let va_Block (block:va_codes) : va_code = Block block unfold let va_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse unfold let va_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp unfold let va_get_block (c:va_code{Block? c}) : va_codes = Block?.block c unfold let va_get_ifCond (c:va_code{IfElse? c}) : ocmp = IfElse?.ifCond c unfold let va_get_ifTrue (c:va_code{IfElse? c}) : va_code = IfElse?.ifTrue c unfold let va_get_ifFalse (c:va_code{IfElse? c}) : va_code = IfElse?.ifFalse c unfold let va_get_whileCond (c:va_code{While? c}) : ocmp = While?.whileCond c unfold let va_get_whileBody (c:va_code{While? c}) : va_code = While?.whileBody c (** Map syntax **) //unfold let (.[]) (m:vale_heap) (b:M.buffer64) = fun index -> buffer64_read b index m // syntax for map accesses, m.[key] and m.[key] <- value (* type map (key:eqtype) (value:Type) = Map.t key value unfold let (.[]) = Map.sel unfold let (.[]<-) = Map.upd *) (** Memory framing **) (* unfold let in_mem (addr:int) (m:mem) : bool = m `Map.contains` addr let disjoint (ptr1:int) (num_bytes1:int) (ptr2:int) (num_bytes2:int) = ptr1 + num_bytes1 <= ptr2 \/ ptr2 + num_bytes2 <= ptr1 let validSrcAddrs (mem:mem) (addr:int) (size:int) (num_bytes:int) = size == 64 /\ (forall (a:int) . {:pattern (mem `Map.contains` a)} addr <= a && a < addr+num_bytes && (a - addr) % 8 = 0 ==> mem `Map.contains` a) let memModified (old_mem:mem) (new_mem:mem) (ptr:int) (num_bytes) = (forall (a:int) . {:pattern (new_mem `Map.contains` a)} old_mem `Map.contains` a <==> new_mem `Map.contains` a) /\ (forall (a:int) . {:pattern (new_mem.[a]) \/ Map.sel new_mem a} a < ptr || a >= ptr + num_bytes ==> old_mem.[a] == new_mem.[ a]) *) (** Convenient memory-related functions **) let rec buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l) = match l with | [] -> True | b :: l' -> buffer_readable h b /\ buffers_readable h l' unfold let modifies_buffer (b:M.buffer64) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer_2 (b1 b2:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer_3 (b1 b2 b3:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 unfold let modifies_buffer128 (b:M.buffer128) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer128_2 (b1 b2:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer128_3 (b1 b2 b3:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 let validSrcAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = buffer_readable h b /\ len <= buffer_length b /\ M.buffer_addr b h == addr /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) false /\ M.valid_taint_buf b h layout.vl_taint tn let validDstAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) true /\ buffer_writeable b let validSrcAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h (addr - 16 * offset) b (len + offset) layout tn let validDstAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h (addr - 16 * offset) b (len + offset) layout tn let modifies_buffer_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer128 b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let buffer_modifies_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let modifies_buffer_specific (b:M.buffer64) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer64_read b i h1 == buffer64_read b i h2) unfold let buffers_disjoint (b1 b2:M.buffer64) = locs_disjoint [loc_buffer b1; loc_buffer b2] unfold let buffers_disjoint128 (b1 b2:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2] let rec loc_locs_disjoint_rec128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = match ls with | [] -> True | h::t -> locs_disjoint [loc_buffer l; loc_buffer h] /\ loc_locs_disjoint_rec128 l t unfold let buffer_disjoints128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = norm [zeta; iota; delta_only [`%loc_locs_disjoint_rec128]] (loc_locs_disjoint_rec128 l ls) unfold let buffers3_disjoint128 (b1 b2 b3:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2; loc_buffer b3] val eval_code (c:va_code) (s0:va_state) (f0:va_fuel) (sN:va_state) : prop0 val eval_while_inv (c:va_code) (s0:va_state) (fW:va_fuel) (sW:va_state) : prop0
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_state_eq (s0 s1: va_state) : prop0
[]
Vale.X64.Decls.va_state_eq
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s0: Vale.X64.Decls.va_state -> s1: Vale.X64.Decls.va_state -> Vale.Def.Prop_s.prop0
{ "end_col": 68, "end_line": 479, "start_col": 54, "start_line": 479 }
Prims.Tot
val va_update_operand_heaplet (h: heaplet_id) (sM sK: va_state) : va_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK
val va_update_operand_heaplet (h: heaplet_id) (sM sK: va_state) : va_state let va_update_operand_heaplet (h: heaplet_id) (sM sK: va_state) : va_state =
false
null
false
va_update_mem_heaplet h sM sK
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.heaplet_id", "Vale.X64.Decls.va_state", "Vale.X64.Decls.va_update_mem_heaplet" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_update_operand_heaplet (h: heaplet_id) (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_operand_heaplet
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
h: Vale.X64.Decls.heaplet_id -> sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 31, "end_line": 295, "start_col": 2, "start_line": 295 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let buffers_disjoint (b1 b2:M.buffer64) = locs_disjoint [loc_buffer b1; loc_buffer b2]
let buffers_disjoint (b1 b2: M.buffer64) =
false
null
false
locs_disjoint [loc_buffer b1; loc_buffer b2]
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Memory.buffer64", "Vale.X64.Decls.locs_disjoint", "Prims.Cons", "Vale.X64.Memory.loc", "Vale.X64.Decls.loc_buffer", "Vale.X64.Memory.vuint64", "Prims.Nil", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s [@va_qattr] unfold let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s let va_lemma_upd_update (sM:vale_state) : Lemma ( (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_dst_opr64 o sM sK)} va_is_dst_dst_opr64 o sK ==> va_update_operand_dst_opr64 o sM sK == va_upd_operand_dst_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_reg_opr64 o sM sK)} va_is_dst_reg_opr64 o sK ==> va_update_operand_reg_opr64 o sM sK == va_upd_operand_reg_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (x:reg_xmm).{:pattern (va_update_operand_xmm x sM sK)} va_update_operand_xmm x sM sK == va_upd_operand_xmm x (eval_reg_xmm x sM) sK) ) = () (** Constructors for va_codes *) [@va_qattr] unfold let va_CNil () : va_codes = [] [@va_qattr] unfold let va_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl (** Constructors for va_code *) unfold let va_Block (block:va_codes) : va_code = Block block unfold let va_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse unfold let va_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp unfold let va_get_block (c:va_code{Block? c}) : va_codes = Block?.block c unfold let va_get_ifCond (c:va_code{IfElse? c}) : ocmp = IfElse?.ifCond c unfold let va_get_ifTrue (c:va_code{IfElse? c}) : va_code = IfElse?.ifTrue c unfold let va_get_ifFalse (c:va_code{IfElse? c}) : va_code = IfElse?.ifFalse c unfold let va_get_whileCond (c:va_code{While? c}) : ocmp = While?.whileCond c unfold let va_get_whileBody (c:va_code{While? c}) : va_code = While?.whileBody c (** Map syntax **) //unfold let (.[]) (m:vale_heap) (b:M.buffer64) = fun index -> buffer64_read b index m // syntax for map accesses, m.[key] and m.[key] <- value (* type map (key:eqtype) (value:Type) = Map.t key value unfold let (.[]) = Map.sel unfold let (.[]<-) = Map.upd *) (** Memory framing **) (* unfold let in_mem (addr:int) (m:mem) : bool = m `Map.contains` addr let disjoint (ptr1:int) (num_bytes1:int) (ptr2:int) (num_bytes2:int) = ptr1 + num_bytes1 <= ptr2 \/ ptr2 + num_bytes2 <= ptr1 let validSrcAddrs (mem:mem) (addr:int) (size:int) (num_bytes:int) = size == 64 /\ (forall (a:int) . {:pattern (mem `Map.contains` a)} addr <= a && a < addr+num_bytes && (a - addr) % 8 = 0 ==> mem `Map.contains` a) let memModified (old_mem:mem) (new_mem:mem) (ptr:int) (num_bytes) = (forall (a:int) . {:pattern (new_mem `Map.contains` a)} old_mem `Map.contains` a <==> new_mem `Map.contains` a) /\ (forall (a:int) . {:pattern (new_mem.[a]) \/ Map.sel new_mem a} a < ptr || a >= ptr + num_bytes ==> old_mem.[a] == new_mem.[ a]) *) (** Convenient memory-related functions **) let rec buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l) = match l with | [] -> True | b :: l' -> buffer_readable h b /\ buffers_readable h l' unfold let modifies_buffer (b:M.buffer64) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer_2 (b1 b2:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer_3 (b1 b2 b3:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 unfold let modifies_buffer128 (b:M.buffer128) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer128_2 (b1 b2:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer128_3 (b1 b2 b3:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 let validSrcAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = buffer_readable h b /\ len <= buffer_length b /\ M.buffer_addr b h == addr /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) false /\ M.valid_taint_buf b h layout.vl_taint tn let validDstAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) true /\ buffer_writeable b let validSrcAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h (addr - 16 * offset) b (len + offset) layout tn let validDstAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h (addr - 16 * offset) b (len + offset) layout tn let modifies_buffer_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer128 b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let buffer_modifies_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let modifies_buffer_specific (b:M.buffer64) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer64_read b i h1 == buffer64_read b i h2)
false
true
Vale.X64.Decls.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 buffers_disjoint : b1: Vale.X64.Memory.buffer64 -> b2: Vale.X64.Memory.buffer64 -> Vale.Def.Prop_s.prop0
[]
Vale.X64.Decls.buffers_disjoint
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b1: Vale.X64.Memory.buffer64 -> b2: Vale.X64.Memory.buffer64 -> Vale.Def.Prop_s.prop0
{ "end_col": 48, "end_line": 458, "start_col": 4, "start_line": 458 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_value_opr64 = nat64
let va_value_opr64 =
false
null
false
nat64
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.Def.Types_s.nat64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_value_opr64 : Type0
[]
Vale.X64.Decls.va_value_opr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 33, "end_line": 297, "start_col": 28, "start_line": 297 }
Prims.Tot
val va_get_whileCond (c: va_code{While? c}) : ocmp
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_get_whileCond (c:va_code{While? c}) : ocmp = While?.whileCond c
val va_get_whileCond (c: va_code{While? c}) : ocmp let va_get_whileCond (c: va_code{While? c}) : ocmp =
false
null
false
While?.whileCond c
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_code", "Prims.b2t", "Vale.X64.Machine_s.uu___is_While", "Vale.X64.Decls.ins", "Vale.X64.Decls.ocmp", "Vale.X64.Machine_s.__proj__While__item__whileCond" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s [@va_qattr] unfold let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s let va_lemma_upd_update (sM:vale_state) : Lemma ( (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_dst_opr64 o sM sK)} va_is_dst_dst_opr64 o sK ==> va_update_operand_dst_opr64 o sM sK == va_upd_operand_dst_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_reg_opr64 o sM sK)} va_is_dst_reg_opr64 o sK ==> va_update_operand_reg_opr64 o sM sK == va_upd_operand_reg_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (x:reg_xmm).{:pattern (va_update_operand_xmm x sM sK)} va_update_operand_xmm x sM sK == va_upd_operand_xmm x (eval_reg_xmm x sM) sK) ) = () (** Constructors for va_codes *) [@va_qattr] unfold let va_CNil () : va_codes = [] [@va_qattr] unfold let va_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl (** Constructors for va_code *) unfold let va_Block (block:va_codes) : va_code = Block block unfold let va_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse unfold let va_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp unfold let va_get_block (c:va_code{Block? c}) : va_codes = Block?.block c unfold let va_get_ifCond (c:va_code{IfElse? c}) : ocmp = IfElse?.ifCond c unfold let va_get_ifTrue (c:va_code{IfElse? c}) : va_code = IfElse?.ifTrue c
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_get_whileCond (c: va_code{While? c}) : ocmp
[]
Vale.X64.Decls.va_get_whileCond
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
c: Vale.X64.Decls.va_code{While? c} -> Vale.X64.Decls.ocmp
{ "end_col": 77, "end_line": 354, "start_col": 59, "start_line": 354 }
Prims.Tot
val va_require_total (c0 c1: va_code) (s0: va_state) : prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_require_total (c0:va_code) (c1:va_code) (s0:va_state) : prop0 = c0 == c1 /\ state_inv s0
val va_require_total (c0 c1: va_code) (s0: va_state) : prop0 let va_require_total (c0 c1: va_code) (s0: va_state) : prop0 =
false
null
false
c0 == c1 /\ state_inv s0
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_code", "Vale.X64.Decls.va_state", "Prims.l_and", "Prims.eq2", "Vale.X64.Decls.state_inv", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s [@va_qattr] unfold let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s let va_lemma_upd_update (sM:vale_state) : Lemma ( (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_dst_opr64 o sM sK)} va_is_dst_dst_opr64 o sK ==> va_update_operand_dst_opr64 o sM sK == va_upd_operand_dst_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_reg_opr64 o sM sK)} va_is_dst_reg_opr64 o sK ==> va_update_operand_reg_opr64 o sM sK == va_upd_operand_reg_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (x:reg_xmm).{:pattern (va_update_operand_xmm x sM sK)} va_update_operand_xmm x sM sK == va_upd_operand_xmm x (eval_reg_xmm x sM) sK) ) = () (** Constructors for va_codes *) [@va_qattr] unfold let va_CNil () : va_codes = [] [@va_qattr] unfold let va_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl (** Constructors for va_code *) unfold let va_Block (block:va_codes) : va_code = Block block unfold let va_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse unfold let va_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp unfold let va_get_block (c:va_code{Block? c}) : va_codes = Block?.block c unfold let va_get_ifCond (c:va_code{IfElse? c}) : ocmp = IfElse?.ifCond c unfold let va_get_ifTrue (c:va_code{IfElse? c}) : va_code = IfElse?.ifTrue c unfold let va_get_ifFalse (c:va_code{IfElse? c}) : va_code = IfElse?.ifFalse c unfold let va_get_whileCond (c:va_code{While? c}) : ocmp = While?.whileCond c unfold let va_get_whileBody (c:va_code{While? c}) : va_code = While?.whileBody c (** Map syntax **) //unfold let (.[]) (m:vale_heap) (b:M.buffer64) = fun index -> buffer64_read b index m // syntax for map accesses, m.[key] and m.[key] <- value (* type map (key:eqtype) (value:Type) = Map.t key value unfold let (.[]) = Map.sel unfold let (.[]<-) = Map.upd *) (** Memory framing **) (* unfold let in_mem (addr:int) (m:mem) : bool = m `Map.contains` addr let disjoint (ptr1:int) (num_bytes1:int) (ptr2:int) (num_bytes2:int) = ptr1 + num_bytes1 <= ptr2 \/ ptr2 + num_bytes2 <= ptr1 let validSrcAddrs (mem:mem) (addr:int) (size:int) (num_bytes:int) = size == 64 /\ (forall (a:int) . {:pattern (mem `Map.contains` a)} addr <= a && a < addr+num_bytes && (a - addr) % 8 = 0 ==> mem `Map.contains` a) let memModified (old_mem:mem) (new_mem:mem) (ptr:int) (num_bytes) = (forall (a:int) . {:pattern (new_mem `Map.contains` a)} old_mem `Map.contains` a <==> new_mem `Map.contains` a) /\ (forall (a:int) . {:pattern (new_mem.[a]) \/ Map.sel new_mem a} a < ptr || a >= ptr + num_bytes ==> old_mem.[a] == new_mem.[ a]) *) (** Convenient memory-related functions **) let rec buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l) = match l with | [] -> True | b :: l' -> buffer_readable h b /\ buffers_readable h l' unfold let modifies_buffer (b:M.buffer64) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer_2 (b1 b2:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer_3 (b1 b2 b3:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 unfold let modifies_buffer128 (b:M.buffer128) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer128_2 (b1 b2:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer128_3 (b1 b2 b3:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 let validSrcAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = buffer_readable h b /\ len <= buffer_length b /\ M.buffer_addr b h == addr /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) false /\ M.valid_taint_buf b h layout.vl_taint tn let validDstAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) true /\ buffer_writeable b let validSrcAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h (addr - 16 * offset) b (len + offset) layout tn let validDstAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h (addr - 16 * offset) b (len + offset) layout tn let modifies_buffer_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer128 b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let buffer_modifies_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let modifies_buffer_specific (b:M.buffer64) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer64_read b i h1 == buffer64_read b i h2) unfold let buffers_disjoint (b1 b2:M.buffer64) = locs_disjoint [loc_buffer b1; loc_buffer b2] unfold let buffers_disjoint128 (b1 b2:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2] let rec loc_locs_disjoint_rec128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = match ls with | [] -> True | h::t -> locs_disjoint [loc_buffer l; loc_buffer h] /\ loc_locs_disjoint_rec128 l t unfold let buffer_disjoints128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = norm [zeta; iota; delta_only [`%loc_locs_disjoint_rec128]] (loc_locs_disjoint_rec128 l ls) unfold let buffers3_disjoint128 (b1 b2 b3:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2; loc_buffer b3] val eval_code (c:va_code) (s0:va_state) (f0:va_fuel) (sN:va_state) : prop0 val eval_while_inv (c:va_code) (s0:va_state) (fW:va_fuel) (sW:va_state) : prop0 [@va_qattr] let va_state_eq (s0:va_state) (s1:va_state) : prop0 = state_eq s0 s1 let state_inv (s:va_state) : prop0 = M.mem_inv s.vs_heap let vale_state_with_inv = s:va_state{state_inv s}
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_require_total (c0 c1: va_code) (s0: va_state) : prop0
[]
Vale.X64.Decls.va_require_total
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
c0: Vale.X64.Decls.va_code -> c1: Vale.X64.Decls.va_code -> s0: Vale.X64.Decls.va_state -> Vale.Def.Prop_s.prop0
{ "end_col": 26, "end_line": 486, "start_col": 2, "start_line": 486 }
Prims.Tot
val va_whileInv_total (b: ocmp) (c: va_code) (s0 sN: va_state) (f0: va_fuel) : prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_whileInv_total (b:ocmp) (c:va_code) (s0:va_state) (sN:va_state) (f0:va_fuel) : prop0 = eval_while_inv (While b c) s0 f0 sN /\ state_inv s0
val va_whileInv_total (b: ocmp) (c: va_code) (s0 sN: va_state) (f0: va_fuel) : prop0 let va_whileInv_total (b: ocmp) (c: va_code) (s0 sN: va_state) (f0: va_fuel) : prop0 =
false
null
false
eval_while_inv (While b c) s0 f0 sN /\ state_inv s0
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.ocmp", "Vale.X64.Decls.va_code", "Vale.X64.Decls.va_state", "Vale.X64.Decls.va_fuel", "Prims.l_and", "Vale.X64.Decls.eval_while_inv", "Vale.X64.Machine_s.While", "Vale.X64.Decls.ins", "Vale.X64.Decls.state_inv", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s [@va_qattr] unfold let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s let va_lemma_upd_update (sM:vale_state) : Lemma ( (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_dst_opr64 o sM sK)} va_is_dst_dst_opr64 o sK ==> va_update_operand_dst_opr64 o sM sK == va_upd_operand_dst_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_reg_opr64 o sM sK)} va_is_dst_reg_opr64 o sK ==> va_update_operand_reg_opr64 o sM sK == va_upd_operand_reg_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (x:reg_xmm).{:pattern (va_update_operand_xmm x sM sK)} va_update_operand_xmm x sM sK == va_upd_operand_xmm x (eval_reg_xmm x sM) sK) ) = () (** Constructors for va_codes *) [@va_qattr] unfold let va_CNil () : va_codes = [] [@va_qattr] unfold let va_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl (** Constructors for va_code *) unfold let va_Block (block:va_codes) : va_code = Block block unfold let va_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse unfold let va_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp unfold let va_get_block (c:va_code{Block? c}) : va_codes = Block?.block c unfold let va_get_ifCond (c:va_code{IfElse? c}) : ocmp = IfElse?.ifCond c unfold let va_get_ifTrue (c:va_code{IfElse? c}) : va_code = IfElse?.ifTrue c unfold let va_get_ifFalse (c:va_code{IfElse? c}) : va_code = IfElse?.ifFalse c unfold let va_get_whileCond (c:va_code{While? c}) : ocmp = While?.whileCond c unfold let va_get_whileBody (c:va_code{While? c}) : va_code = While?.whileBody c (** Map syntax **) //unfold let (.[]) (m:vale_heap) (b:M.buffer64) = fun index -> buffer64_read b index m // syntax for map accesses, m.[key] and m.[key] <- value (* type map (key:eqtype) (value:Type) = Map.t key value unfold let (.[]) = Map.sel unfold let (.[]<-) = Map.upd *) (** Memory framing **) (* unfold let in_mem (addr:int) (m:mem) : bool = m `Map.contains` addr let disjoint (ptr1:int) (num_bytes1:int) (ptr2:int) (num_bytes2:int) = ptr1 + num_bytes1 <= ptr2 \/ ptr2 + num_bytes2 <= ptr1 let validSrcAddrs (mem:mem) (addr:int) (size:int) (num_bytes:int) = size == 64 /\ (forall (a:int) . {:pattern (mem `Map.contains` a)} addr <= a && a < addr+num_bytes && (a - addr) % 8 = 0 ==> mem `Map.contains` a) let memModified (old_mem:mem) (new_mem:mem) (ptr:int) (num_bytes) = (forall (a:int) . {:pattern (new_mem `Map.contains` a)} old_mem `Map.contains` a <==> new_mem `Map.contains` a) /\ (forall (a:int) . {:pattern (new_mem.[a]) \/ Map.sel new_mem a} a < ptr || a >= ptr + num_bytes ==> old_mem.[a] == new_mem.[ a]) *) (** Convenient memory-related functions **) let rec buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l) = match l with | [] -> True | b :: l' -> buffer_readable h b /\ buffers_readable h l' unfold let modifies_buffer (b:M.buffer64) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer_2 (b1 b2:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer_3 (b1 b2 b3:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 unfold let modifies_buffer128 (b:M.buffer128) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer128_2 (b1 b2:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer128_3 (b1 b2 b3:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 let validSrcAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = buffer_readable h b /\ len <= buffer_length b /\ M.buffer_addr b h == addr /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) false /\ M.valid_taint_buf b h layout.vl_taint tn let validDstAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) true /\ buffer_writeable b let validSrcAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h (addr - 16 * offset) b (len + offset) layout tn let validDstAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h (addr - 16 * offset) b (len + offset) layout tn let modifies_buffer_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer128 b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let buffer_modifies_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let modifies_buffer_specific (b:M.buffer64) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer64_read b i h1 == buffer64_read b i h2) unfold let buffers_disjoint (b1 b2:M.buffer64) = locs_disjoint [loc_buffer b1; loc_buffer b2] unfold let buffers_disjoint128 (b1 b2:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2] let rec loc_locs_disjoint_rec128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = match ls with | [] -> True | h::t -> locs_disjoint [loc_buffer l; loc_buffer h] /\ loc_locs_disjoint_rec128 l t unfold let buffer_disjoints128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = norm [zeta; iota; delta_only [`%loc_locs_disjoint_rec128]] (loc_locs_disjoint_rec128 l ls) unfold let buffers3_disjoint128 (b1 b2 b3:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2; loc_buffer b3] val eval_code (c:va_code) (s0:va_state) (f0:va_fuel) (sN:va_state) : prop0 val eval_while_inv (c:va_code) (s0:va_state) (fW:va_fuel) (sW:va_state) : prop0 [@va_qattr] let va_state_eq (s0:va_state) (s1:va_state) : prop0 = state_eq s0 s1 let state_inv (s:va_state) : prop0 = M.mem_inv s.vs_heap let vale_state_with_inv = s:va_state{state_inv s} let va_require_total (c0:va_code) (c1:va_code) (s0:va_state) : prop0 = c0 == c1 /\ state_inv s0 let va_ensure_total (c0:va_code) (s0:va_state) (s1:va_state) (f1:va_fuel) : prop0 = eval_code c0 s0 f1 s1 /\ state_inv s1 val eval_ocmp : s:va_state -> c:ocmp -> GTot bool unfold let va_evalCond (b:ocmp) (s:va_state) : GTot bool = eval_ocmp s b val valid_ocmp : c:ocmp -> s:va_state -> GTot bool val havoc_flags : Flags.t val lemma_cmp_eq : s:va_state -> o1:operand64{ not (OMem? o1 || OStack? o1) } -> o2:operand64{ not (OMem? o2 || OStack? o2) } -> Lemma (requires True) (ensures (eval_ocmp s (va_cmp_eq o1 o2)) <==> (va_eval_opr64 s o1 == va_eval_opr64 s o2)) [SMTPat (eval_ocmp s (va_cmp_eq o1 o2))] val lemma_cmp_ne : s:va_state -> o1:operand64{ not (OMem? o1 || OStack? o1) } -> o2:operand64{ not (OMem? o2 || OStack? o2) } -> Lemma (requires True) (ensures (eval_ocmp s (va_cmp_ne o1 o2)) <==> (va_eval_opr64 s o1 <> va_eval_opr64 s o2)) [SMTPat (eval_ocmp s (va_cmp_ne o1 o2))] val lemma_cmp_le : s:va_state -> o1:operand64{ not (OMem? o1 || OStack? o1) } -> o2:operand64{ not (OMem? o2 || OStack? o2) } -> Lemma (requires True) (ensures (eval_ocmp s (va_cmp_le o1 o2)) <==> (va_eval_opr64 s o1 <= va_eval_opr64 s o2)) [SMTPat (eval_ocmp s (va_cmp_le o1 o2))] val lemma_cmp_ge : s:va_state -> o1:operand64{ not (OMem? o1 || OStack? o1) } -> o2:operand64{ not (OMem? o2 || OStack? o2) } -> Lemma (requires True) (ensures (eval_ocmp s (va_cmp_ge o1 o2)) <==> (va_eval_opr64 s o1 >= va_eval_opr64 s o2)) [SMTPat (eval_ocmp s (va_cmp_ge o1 o2))] val lemma_cmp_lt : s:va_state -> o1:operand64{ not (OMem? o1 || OStack? o1) } -> o2:operand64{ not (OMem? o2 || OStack? o2) } -> Lemma (requires True) (ensures (eval_ocmp s (va_cmp_lt o1 o2)) <==> (va_eval_opr64 s o1 < va_eval_opr64 s o2)) [SMTPat (eval_ocmp s (va_cmp_lt o1 o2))] val lemma_cmp_gt : s:va_state -> o1:operand64{ not (OMem? o1 || OStack? o1) } -> o2:operand64{ not (OMem? o2 || OStack? o2) } -> Lemma (requires True) (ensures (eval_ocmp s (va_cmp_gt o1 o2)) <==> (va_eval_opr64 s o1 > va_eval_opr64 s o2)) [SMTPat (eval_ocmp s (va_cmp_gt o1 o2))] val lemma_valid_cmp_eq : s:va_state -> o1:operand64{ not (OMem? o1 || OStack? o1) } -> o2:operand64{ not (OMem? o2 || OStack? o2) } -> Lemma (requires True) (ensures (valid_operand o1 s /\ valid_operand o2 s) ==> (valid_ocmp (va_cmp_eq o1 o2) s)) [SMTPat (valid_ocmp (va_cmp_eq o1 o2) s)] val lemma_valid_cmp_ne : s:va_state -> o1:operand64{ not (OMem? o1 || OStack? o1) } -> o2:operand64{ not (OMem? o2 || OStack? o2) } -> Lemma (requires True) (ensures (valid_operand o1 s /\ valid_operand o2 s) ==> (valid_ocmp (va_cmp_ne o1 o2) s)) [SMTPat (valid_ocmp (va_cmp_ne o1 o2) s)] val lemma_valid_cmp_le : s:va_state -> o1:operand64{ not (OMem? o1 || OStack? o1) } -> o2:operand64{ not (OMem? o2 || OStack? o2) } -> Lemma (requires True) (ensures (valid_operand o1 s /\ valid_operand o2 s) ==> (valid_ocmp (va_cmp_le o1 o2) s)) [SMTPat (valid_ocmp (va_cmp_le o1 o2) s)] val lemma_valid_cmp_ge : s:va_state -> o1:operand64{ not (OMem? o1 || OStack? o1) } -> o2:operand64{ not (OMem? o2 || OStack? o2) } -> Lemma (requires True) (ensures (valid_operand o1 s /\ valid_operand o2 s) ==> (valid_ocmp (va_cmp_ge o1 o2) s)) [SMTPat (valid_ocmp (va_cmp_ge o1 o2) s)] val lemma_valid_cmp_lt : s:va_state -> o1:operand64{ not (OMem? o1 || OStack? o1) } -> o2:operand64{ not (OMem? o2 || OStack? o2) } -> Lemma (requires True) (ensures (valid_operand o1 s /\ valid_operand o2 s) ==> (valid_ocmp (va_cmp_lt o1 o2) s)) [SMTPat (valid_ocmp (va_cmp_lt o1 o2) s)] val lemma_valid_cmp_gt : s:va_state -> o1:operand64{ not (OMem? o1 || OStack? o1) } -> o2:operand64{ not (OMem? o2 || OStack? o2) } -> Lemma (requires True) (ensures (valid_operand o1 s /\ valid_operand o2 s) ==> (valid_ocmp (va_cmp_gt o1 o2) s)) [SMTPat (valid_ocmp (va_cmp_gt o1 o2) s)] val va_compute_merge_total (f0:va_fuel) (fM:va_fuel) : va_fuel val va_lemma_merge_total (b0:va_codes) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel (requires Cons? b0 /\ eval_code (Cons?.hd b0) s0 f0 sM /\ eval_code (va_Block (Cons?.tl b0)) sM fM sN ) (ensures (fun fN -> fN == va_compute_merge_total f0 fM /\ eval_code (va_Block b0) s0 fN sN )) val va_lemma_empty_total (s0:va_state) (bN:va_codes) : Ghost (va_state & va_fuel) (requires True) (ensures (fun (sM, fM) -> s0 == sM /\ eval_code (va_Block []) s0 fM sM )) val va_lemma_ifElse_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) : Ghost (bool & va_state & va_state & va_fuel) (requires True) (ensures (fun (cond, sM, sN, f0) -> cond == eval_ocmp s0 ifb /\ sM == {s0 with vs_flags = havoc_flags} )) val va_lemma_ifElseTrue_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) : Lemma (requires valid_ocmp ifb s0 /\ eval_ocmp s0 ifb /\ eval_code ct ({s0 with vs_flags = havoc_flags}) f0 sM ) (ensures eval_code (IfElse ifb ct cf) s0 f0 sM ) val va_lemma_ifElseFalse_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) : Lemma (requires valid_ocmp ifb s0 /\ not (eval_ocmp s0 ifb) /\ eval_code cf ({s0 with vs_flags = havoc_flags}) f0 sM ) (ensures eval_code (IfElse ifb ct cf) s0 f0 sM )
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_whileInv_total (b: ocmp) (c: va_code) (s0 sN: va_state) (f0: va_fuel) : prop0
[]
Vale.X64.Decls.va_whileInv_total
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b: Vale.X64.Decls.ocmp -> c: Vale.X64.Decls.va_code -> s0: Vale.X64.Decls.va_state -> sN: Vale.X64.Decls.va_state -> f0: Vale.X64.Decls.va_fuel -> Vale.Def.Prop_s.prop0
{ "end_col": 53, "end_line": 606, "start_col": 2, "start_line": 606 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let buffers3_disjoint128 (b1 b2 b3:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2; loc_buffer b3]
let buffers3_disjoint128 (b1 b2 b3: M.buffer128) =
false
null
false
locs_disjoint [loc_buffer b1; loc_buffer b2; loc_buffer b3]
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Memory.buffer128", "Vale.X64.Decls.locs_disjoint", "Prims.Cons", "Vale.X64.Memory.loc", "Vale.X64.Decls.loc_buffer", "Vale.X64.Memory.vuint128", "Prims.Nil", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s [@va_qattr] unfold let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s let va_lemma_upd_update (sM:vale_state) : Lemma ( (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_dst_opr64 o sM sK)} va_is_dst_dst_opr64 o sK ==> va_update_operand_dst_opr64 o sM sK == va_upd_operand_dst_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_reg_opr64 o sM sK)} va_is_dst_reg_opr64 o sK ==> va_update_operand_reg_opr64 o sM sK == va_upd_operand_reg_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (x:reg_xmm).{:pattern (va_update_operand_xmm x sM sK)} va_update_operand_xmm x sM sK == va_upd_operand_xmm x (eval_reg_xmm x sM) sK) ) = () (** Constructors for va_codes *) [@va_qattr] unfold let va_CNil () : va_codes = [] [@va_qattr] unfold let va_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl (** Constructors for va_code *) unfold let va_Block (block:va_codes) : va_code = Block block unfold let va_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse unfold let va_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp unfold let va_get_block (c:va_code{Block? c}) : va_codes = Block?.block c unfold let va_get_ifCond (c:va_code{IfElse? c}) : ocmp = IfElse?.ifCond c unfold let va_get_ifTrue (c:va_code{IfElse? c}) : va_code = IfElse?.ifTrue c unfold let va_get_ifFalse (c:va_code{IfElse? c}) : va_code = IfElse?.ifFalse c unfold let va_get_whileCond (c:va_code{While? c}) : ocmp = While?.whileCond c unfold let va_get_whileBody (c:va_code{While? c}) : va_code = While?.whileBody c (** Map syntax **) //unfold let (.[]) (m:vale_heap) (b:M.buffer64) = fun index -> buffer64_read b index m // syntax for map accesses, m.[key] and m.[key] <- value (* type map (key:eqtype) (value:Type) = Map.t key value unfold let (.[]) = Map.sel unfold let (.[]<-) = Map.upd *) (** Memory framing **) (* unfold let in_mem (addr:int) (m:mem) : bool = m `Map.contains` addr let disjoint (ptr1:int) (num_bytes1:int) (ptr2:int) (num_bytes2:int) = ptr1 + num_bytes1 <= ptr2 \/ ptr2 + num_bytes2 <= ptr1 let validSrcAddrs (mem:mem) (addr:int) (size:int) (num_bytes:int) = size == 64 /\ (forall (a:int) . {:pattern (mem `Map.contains` a)} addr <= a && a < addr+num_bytes && (a - addr) % 8 = 0 ==> mem `Map.contains` a) let memModified (old_mem:mem) (new_mem:mem) (ptr:int) (num_bytes) = (forall (a:int) . {:pattern (new_mem `Map.contains` a)} old_mem `Map.contains` a <==> new_mem `Map.contains` a) /\ (forall (a:int) . {:pattern (new_mem.[a]) \/ Map.sel new_mem a} a < ptr || a >= ptr + num_bytes ==> old_mem.[a] == new_mem.[ a]) *) (** Convenient memory-related functions **) let rec buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l) = match l with | [] -> True | b :: l' -> buffer_readable h b /\ buffers_readable h l' unfold let modifies_buffer (b:M.buffer64) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer_2 (b1 b2:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer_3 (b1 b2 b3:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 unfold let modifies_buffer128 (b:M.buffer128) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer128_2 (b1 b2:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer128_3 (b1 b2 b3:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 let validSrcAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = buffer_readable h b /\ len <= buffer_length b /\ M.buffer_addr b h == addr /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) false /\ M.valid_taint_buf b h layout.vl_taint tn let validDstAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) true /\ buffer_writeable b let validSrcAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h (addr - 16 * offset) b (len + offset) layout tn let validDstAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h (addr - 16 * offset) b (len + offset) layout tn let modifies_buffer_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer128 b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let buffer_modifies_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let modifies_buffer_specific (b:M.buffer64) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer64_read b i h1 == buffer64_read b i h2) unfold let buffers_disjoint (b1 b2:M.buffer64) = locs_disjoint [loc_buffer b1; loc_buffer b2] unfold let buffers_disjoint128 (b1 b2:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2] let rec loc_locs_disjoint_rec128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = match ls with | [] -> True | h::t -> locs_disjoint [loc_buffer l; loc_buffer h] /\ loc_locs_disjoint_rec128 l t unfold let buffer_disjoints128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = norm [zeta; iota; delta_only [`%loc_locs_disjoint_rec128]] (loc_locs_disjoint_rec128 l ls)
false
true
Vale.X64.Decls.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 buffers3_disjoint128 : b1: Vale.X64.Memory.buffer128 -> b2: Vale.X64.Memory.buffer128 -> b3: Vale.X64.Memory.buffer128 -> Vale.Def.Prop_s.prop0
[]
Vale.X64.Decls.buffers3_disjoint128
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b1: Vale.X64.Memory.buffer128 -> b2: Vale.X64.Memory.buffer128 -> b3: Vale.X64.Memory.buffer128 -> Vale.Def.Prop_s.prop0
{ "end_col": 63, "end_line": 473, "start_col": 4, "start_line": 473 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let vale_state_with_inv = s:va_state{state_inv s}
let vale_state_with_inv =
false
null
false
s: va_state{state_inv s}
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.Decls.state_inv" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s [@va_qattr] unfold let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s let va_lemma_upd_update (sM:vale_state) : Lemma ( (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_dst_opr64 o sM sK)} va_is_dst_dst_opr64 o sK ==> va_update_operand_dst_opr64 o sM sK == va_upd_operand_dst_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_reg_opr64 o sM sK)} va_is_dst_reg_opr64 o sK ==> va_update_operand_reg_opr64 o sM sK == va_upd_operand_reg_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (x:reg_xmm).{:pattern (va_update_operand_xmm x sM sK)} va_update_operand_xmm x sM sK == va_upd_operand_xmm x (eval_reg_xmm x sM) sK) ) = () (** Constructors for va_codes *) [@va_qattr] unfold let va_CNil () : va_codes = [] [@va_qattr] unfold let va_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl (** Constructors for va_code *) unfold let va_Block (block:va_codes) : va_code = Block block unfold let va_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse unfold let va_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp unfold let va_get_block (c:va_code{Block? c}) : va_codes = Block?.block c unfold let va_get_ifCond (c:va_code{IfElse? c}) : ocmp = IfElse?.ifCond c unfold let va_get_ifTrue (c:va_code{IfElse? c}) : va_code = IfElse?.ifTrue c unfold let va_get_ifFalse (c:va_code{IfElse? c}) : va_code = IfElse?.ifFalse c unfold let va_get_whileCond (c:va_code{While? c}) : ocmp = While?.whileCond c unfold let va_get_whileBody (c:va_code{While? c}) : va_code = While?.whileBody c (** Map syntax **) //unfold let (.[]) (m:vale_heap) (b:M.buffer64) = fun index -> buffer64_read b index m // syntax for map accesses, m.[key] and m.[key] <- value (* type map (key:eqtype) (value:Type) = Map.t key value unfold let (.[]) = Map.sel unfold let (.[]<-) = Map.upd *) (** Memory framing **) (* unfold let in_mem (addr:int) (m:mem) : bool = m `Map.contains` addr let disjoint (ptr1:int) (num_bytes1:int) (ptr2:int) (num_bytes2:int) = ptr1 + num_bytes1 <= ptr2 \/ ptr2 + num_bytes2 <= ptr1 let validSrcAddrs (mem:mem) (addr:int) (size:int) (num_bytes:int) = size == 64 /\ (forall (a:int) . {:pattern (mem `Map.contains` a)} addr <= a && a < addr+num_bytes && (a - addr) % 8 = 0 ==> mem `Map.contains` a) let memModified (old_mem:mem) (new_mem:mem) (ptr:int) (num_bytes) = (forall (a:int) . {:pattern (new_mem `Map.contains` a)} old_mem `Map.contains` a <==> new_mem `Map.contains` a) /\ (forall (a:int) . {:pattern (new_mem.[a]) \/ Map.sel new_mem a} a < ptr || a >= ptr + num_bytes ==> old_mem.[a] == new_mem.[ a]) *) (** Convenient memory-related functions **) let rec buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l) = match l with | [] -> True | b :: l' -> buffer_readable h b /\ buffers_readable h l' unfold let modifies_buffer (b:M.buffer64) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer_2 (b1 b2:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer_3 (b1 b2 b3:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 unfold let modifies_buffer128 (b:M.buffer128) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer128_2 (b1 b2:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer128_3 (b1 b2 b3:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 let validSrcAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = buffer_readable h b /\ len <= buffer_length b /\ M.buffer_addr b h == addr /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) false /\ M.valid_taint_buf b h layout.vl_taint tn let validDstAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) true /\ buffer_writeable b let validSrcAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h (addr - 16 * offset) b (len + offset) layout tn let validDstAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h (addr - 16 * offset) b (len + offset) layout tn let modifies_buffer_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer128 b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let buffer_modifies_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let modifies_buffer_specific (b:M.buffer64) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer64_read b i h1 == buffer64_read b i h2) unfold let buffers_disjoint (b1 b2:M.buffer64) = locs_disjoint [loc_buffer b1; loc_buffer b2] unfold let buffers_disjoint128 (b1 b2:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2] let rec loc_locs_disjoint_rec128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = match ls with | [] -> True | h::t -> locs_disjoint [loc_buffer l; loc_buffer h] /\ loc_locs_disjoint_rec128 l t unfold let buffer_disjoints128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = norm [zeta; iota; delta_only [`%loc_locs_disjoint_rec128]] (loc_locs_disjoint_rec128 l ls) unfold let buffers3_disjoint128 (b1 b2 b3:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2; loc_buffer b3] val eval_code (c:va_code) (s0:va_state) (f0:va_fuel) (sN:va_state) : prop0 val eval_while_inv (c:va_code) (s0:va_state) (fW:va_fuel) (sW:va_state) : prop0 [@va_qattr] let va_state_eq (s0:va_state) (s1:va_state) : prop0 = state_eq s0 s1 let state_inv (s:va_state) : prop0 = M.mem_inv s.vs_heap
false
true
Vale.X64.Decls.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 vale_state_with_inv : Type
[]
Vale.X64.Decls.vale_state_with_inv
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type
{ "end_col": 49, "end_line": 483, "start_col": 26, "start_line": 483 }
Prims.Tot
[ { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let vale_full_heap = M.vale_full_heap
let vale_full_heap =
false
null
false
M.vale_full_heap
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Memory.vale_full_heap" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s
false
true
Vale.X64.Decls.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 vale_full_heap : Type
[]
Vale.X64.Decls.vale_full_heap
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type
{ "end_col": 44, "end_line": 21, "start_col": 28, "start_line": 21 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_update = Map.upd
let va_update =
false
null
false
Map.upd
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Prims.eqtype", "FStar.Map.upd", "FStar.Map.t" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_update : _: FStar.Map.t _ _ -> _: _ -> _: _ -> FStar.Map.t _ _
[]
Vale.X64.Decls.va_update
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: FStar.Map.t _ _ -> _: _ -> _: _ -> FStar.Map.t _ _
{ "end_col": 30, "end_line": 44, "start_col": 23, "start_line": 44 }
Prims.Tot
[ { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let quad32 = quad32
let quad32 =
false
null
false
quad32
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.Def.Types_s.quad32" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap
false
true
Vale.X64.Decls.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 quad32 : Prims.eqtype
[]
Vale.X64.Decls.quad32
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Prims.eqtype
{ "end_col": 26, "end_line": 23, "start_col": 20, "start_line": 23 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_hd = Cons?.hd
let va_hd =
false
null
false
Cons?.hd
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Prims.__proj__Cons__item__hd", "Prims.list", "Prims.b2t", "Prims.uu___is_Cons" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_hd : projectee: _: Prims.list _ {Cons? _} -> _
[]
Vale.X64.Decls.va_hd
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
projectee: _: Prims.list _ {Cons? _} -> _
{ "end_col": 27, "end_line": 45, "start_col": 19, "start_line": 45 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_int_at_least (k:int) = i:int{i >= k}
let va_int_at_least (k: int) =
false
null
false
i: int{i >= k}
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Prims.int", "Prims.b2t", "Prims.op_GreaterThanOrEqual" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y ()
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_int_at_least : k: Prims.int -> Type0
[]
Vale.X64.Decls.va_int_at_least
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
k: Prims.int -> Type0
{ "end_col": 43, "end_line": 63, "start_col": 30, "start_line": 63 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x'
let va_reveal_eq (#ax: Type) (s: string) (x x': ax) =
false
null
false
norm [zeta; delta_only [s]] #ax x == x'
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Prims.string", "Prims.eq2", "FStar.Pervasives.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.zeta", "FStar.Pervasives.delta_only", "Prims.Nil", "Prims.logical" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_reveal_eq : s: Prims.string -> x: ax -> x': ax -> Prims.logical
[]
Vale.X64.Decls.va_reveal_eq
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Prims.string -> x: ax -> x': ax -> Prims.logical
{ "end_col": 109, "end_line": 49, "start_col": 70, "start_line": 49 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_int_at_most (k:int) = i:int{i <= k}
let va_int_at_most (k: int) =
false
null
false
i: int{i <= k}
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Prims.int", "Prims.b2t", "Prims.op_LessThanOrEqual" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *)
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_int_at_most : k: Prims.int -> Type0
[]
Vale.X64.Decls.va_int_at_most
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
k: Prims.int -> Type0
{ "end_col": 42, "end_line": 64, "start_col": 29, "start_line": 64 }
FStar.Pervasives.Lemma
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]]
let va_reveal_opaque (s: string) =
false
null
true
norm_spec [zeta; delta_only [s]]
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "lemma" ]
[ "Prims.string", "FStar.Pervasives.norm_spec", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.zeta", "FStar.Pervasives.delta_only", "Prims.Nil", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Pervasives.norm", "FStar.Pervasives.pattern" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_reveal_opaque : s: Prims.string -> x: _ -> FStar.Pervasives.Lemma (ensures FStar.Pervasives.norm [FStar.Pervasives.zeta; FStar.Pervasives.delta_only [s]] x == x)
[]
Vale.X64.Decls.va_reveal_opaque
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Prims.string -> x: _ -> FStar.Pervasives.Lemma (ensures FStar.Pervasives.norm [FStar.Pervasives.zeta; FStar.Pervasives.delta_only [s]] x == x)
{ "end_col": 66, "end_line": 50, "start_col": 34, "start_line": 50 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2}
let va_int_range (k1 k2: int) =
false
null
false
i: int{k1 <= i /\ i <= k2}
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Prims.int", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k}
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_int_range : k1: Prims.int -> k2: Prims.int -> Type0
[]
Vale.X64.Decls.va_int_range
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
k1: Prims.int -> k2: Prims.int -> Type0
{ "end_col": 56, "end_line": 65, "start_col": 31, "start_line": 65 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_operand_dst_opr64 = operand64
let va_operand_dst_opr64 =
false
null
false
operand64
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.operand64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o}
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_operand_dst_opr64 : Prims.eqtype
[]
Vale.X64.Decls.va_operand_dst_opr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Prims.eqtype
{ "end_col": 43, "end_line": 76, "start_col": 34, "start_line": 76 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_operand_shift_amt64 = operand64
let va_operand_shift_amt64 =
false
null
false
operand64
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.operand64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o}
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_operand_shift_amt64 : Prims.eqtype
[]
Vale.X64.Decls.va_operand_shift_amt64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Prims.eqtype
{ "end_col": 45, "end_line": 77, "start_col": 36, "start_line": 77 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_code = precode ins ocmp
let va_code =
false
null
false
precode ins ocmp
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.precode", "Vale.X64.Decls.ins", "Vale.X64.Decls.ocmp" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_code : Type0
[]
Vale.X64.Decls.va_code
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 37, "end_line": 68, "start_col": 21, "start_line": 68 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_codes = list va_code
let va_codes =
false
null
false
list va_code
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Prims.list", "Vale.X64.Decls.va_code" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_codes : Type0
[]
Vale.X64.Decls.va_codes
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 34, "end_line": 69, "start_col": 22, "start_line": 69 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_operand_heaplet = heaplet_id
let va_operand_heaplet =
false
null
false
heaplet_id
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.heaplet_id" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_operand_heaplet : Type0
[]
Vale.X64.Decls.va_operand_heaplet
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 42, "end_line": 81, "start_col": 32, "start_line": 81 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_operand_xmm = reg_xmm
let va_operand_xmm =
false
null
false
reg_xmm
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.reg_xmm" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_operand_xmm : Type0
[]
Vale.X64.Decls.va_operand_xmm
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 35, "end_line": 79, "start_col": 28, "start_line": 79 }
Prims.Tot
val va_get_result (r: va_transformation_result) : va_code
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_get_result (r:va_transformation_result) : va_code = r.result
val va_get_result (r: va_transformation_result) : va_code let va_get_result (r: va_transformation_result) : va_code =
false
null
false
r.result
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_transformation_result", "Vale.X64.Decls.__proj__Mkva_transformation_result__item__result", "Vale.X64.Decls.va_code" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; }
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_get_result (r: va_transformation_result) : va_code
[]
Vale.X64.Decls.va_get_result
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
r: Vale.X64.Decls.va_transformation_result -> Vale.X64.Decls.va_code
{ "end_col": 74, "end_line": 95, "start_col": 66, "start_line": 95 }
Prims.GTot
val buffer_writeable (#t: M.base_typ) (b: M.buffer t) : GTot prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b
val buffer_writeable (#t: M.base_typ) (b: M.buffer t) : GTot prop0 let buffer_writeable (#t: M.base_typ) (b: M.buffer t) : GTot prop0 =
false
null
false
M.buffer_writeable #t b
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.Arch.HeapTypes_s.base_typ", "Vale.X64.Memory.buffer", "Vale.X64.Memory.buffer_writeable", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o)
false
false
Vale.X64.Decls.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 buffer_writeable (#t: M.base_typ) (b: M.buffer t) : GTot prop0
[]
Vale.X64.Decls.buffer_writeable
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b: Vale.X64.Memory.buffer t -> Prims.GTot Vale.Def.Prop_s.prop0
{ "end_col": 97, "end_line": 106, "start_col": 74, "start_line": 106 }
Prims.GTot
val buffer_readable (#t: M.base_typ) (h: vale_heap) (b: M.buffer t) : GTot prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b
val buffer_readable (#t: M.base_typ) (h: vale_heap) (b: M.buffer t) : GTot prop0 let buffer_readable (#t: M.base_typ) (h: vale_heap) (b: M.buffer t) : GTot prop0 =
false
null
false
M.buffer_readable #t h b
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.Arch.HeapTypes_s.base_typ", "Vale.X64.Decls.vale_heap", "Vale.X64.Memory.buffer", "Vale.X64.Memory.buffer_readable", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s
false
false
Vale.X64.Decls.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 buffer_readable (#t: M.base_typ) (h: vale_heap) (b: M.buffer t) : GTot prop0
[]
Vale.X64.Decls.buffer_readable
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
h: Vale.X64.Decls.vale_heap -> b: Vale.X64.Memory.buffer t -> Prims.GTot Vale.Def.Prop_s.prop0
{ "end_col": 111, "end_line": 105, "start_col": 87, "start_line": 105 }
Prims.Tot
val va_expand_state (s: vale_state) : vale_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_expand_state (s:vale_state) : vale_state = state_eta s
val va_expand_state (s: vale_state) : vale_state let va_expand_state (s: vale_state) : vale_state =
false
null
false
state_eta s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.State.vale_state", "Vale.X64.State.state_eta" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_expand_state (s: vale_state) : vale_state
[]
Vale.X64.Decls.va_expand_state
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
{ "end_col": 80, "end_line": 102, "start_col": 69, "start_line": 102 }
Prims.GTot
val buffer8_as_seq (m: vale_heap) (b: M.buffer8) : GTot (Seq.seq nat8)
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b
val buffer8_as_seq (m: vale_heap) (b: M.buffer8) : GTot (Seq.seq nat8) let buffer8_as_seq (m: vale_heap) (b: M.buffer8) : GTot (Seq.seq nat8) =
false
null
false
M.buffer_as_seq m b
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Decls.vale_heap", "Vale.X64.Memory.buffer8", "Vale.X64.Memory.buffer_as_seq", "Vale.X64.Memory.vuint8", "FStar.Seq.Base.seq", "Vale.Def.Types_s.nat8" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b
false
false
Vale.X64.Decls.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 buffer8_as_seq (m: vale_heap) (b: M.buffer8) : GTot (Seq.seq nat8)
[]
Vale.X64.Decls.buffer8_as_seq
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
m: Vale.X64.Decls.vale_heap -> b: Vale.X64.Memory.buffer8 -> Prims.GTot (FStar.Seq.Base.seq Vale.Def.Types_s.nat8)
{ "end_col": 97, "end_line": 108, "start_col": 78, "start_line": 108 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_state = vale_state
let va_state =
false
null
false
vale_state
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.State.vale_state" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_state : Type
[]
Vale.X64.Decls.va_state
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type
{ "end_col": 32, "end_line": 71, "start_col": 22, "start_line": 71 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_operand_opr128 = operand128
let va_operand_opr128 =
false
null
false
operand128
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.operand128" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)}
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_operand_opr128 : Prims.eqtype
[]
Vale.X64.Decls.va_operand_opr128
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Prims.eqtype
{ "end_col": 41, "end_line": 80, "start_col": 31, "start_line": 80 }
Prims.GTot
val buffer64_as_seq (m: vale_heap) (b: M.buffer64) : GTot (Seq.seq nat64)
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b
val buffer64_as_seq (m: vale_heap) (b: M.buffer64) : GTot (Seq.seq nat64) let buffer64_as_seq (m: vale_heap) (b: M.buffer64) : GTot (Seq.seq nat64) =
false
null
false
M.buffer_as_seq m b
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Decls.vale_heap", "Vale.X64.Memory.buffer64", "Vale.X64.Memory.buffer_as_seq", "Vale.X64.Memory.vuint64", "FStar.Seq.Base.seq", "Vale.Def.Types_s.nat64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b
false
false
Vale.X64.Decls.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 buffer64_as_seq (m: vale_heap) (b: M.buffer64) : GTot (Seq.seq nat64)
[]
Vale.X64.Decls.buffer64_as_seq
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
m: Vale.X64.Decls.vale_heap -> b: Vale.X64.Memory.buffer64 -> Prims.GTot (FStar.Seq.Base.seq Vale.Def.Types_s.nat64)
{ "end_col": 100, "end_line": 109, "start_col": 81, "start_line": 109 }
Prims.GTot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b
let buffer_length (#t: M.base_typ) (b: M.buffer t) =
false
null
false
M.buffer_length #t b
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.Arch.HeapTypes_s.base_typ", "Vale.X64.Memory.buffer", "Vale.X64.Memory.buffer_length", "Prims.nat" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b
false
false
Vale.X64.Decls.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 buffer_length : b: Vale.X64.Memory.buffer t -> Prims.GTot Prims.nat
[]
Vale.X64.Decls.buffer_length
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b: Vale.X64.Memory.buffer t -> Prims.GTot Prims.nat
{ "end_col": 78, "end_line": 107, "start_col": 58, "start_line": 107 }
Prims.GTot
val s64 (m: vale_heap) (b: M.buffer64) : GTot (Seq.seq nat64)
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b
val s64 (m: vale_heap) (b: M.buffer64) : GTot (Seq.seq nat64) let s64 (m: vale_heap) (b: M.buffer64) : GTot (Seq.seq nat64) =
false
null
false
buffer64_as_seq m b
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Decls.vale_heap", "Vale.X64.Memory.buffer64", "Vale.X64.Decls.buffer64_as_seq", "FStar.Seq.Base.seq", "Vale.Def.Types_s.nat64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b
false
false
Vale.X64.Decls.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 s64 (m: vale_heap) (b: M.buffer64) : GTot (Seq.seq nat64)
[]
Vale.X64.Decls.s64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
m: Vale.X64.Decls.vale_heap -> b: Vale.X64.Memory.buffer64 -> Prims.GTot (FStar.Seq.Base.seq Vale.Def.Types_s.nat64)
{ "end_col": 88, "end_line": 110, "start_col": 69, "start_line": 110 }
Prims.GTot
val buffer64_read (b: M.buffer64) (i: int) (h: vale_heap) : GTot nat64
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h
val buffer64_read (b: M.buffer64) (i: int) (h: vale_heap) : GTot nat64 let buffer64_read (b: M.buffer64) (i: int) (h: vale_heap) : GTot nat64 =
false
null
false
M.buffer_read b i h
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Memory.buffer64", "Prims.int", "Vale.X64.Decls.vale_heap", "Vale.X64.Memory.buffer_read", "Vale.X64.Memory.vuint64", "Vale.Def.Types_s.nat64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i
false
false
Vale.X64.Decls.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 buffer64_read (b: M.buffer64) (i: int) (h: vale_heap) : GTot nat64
[]
Vale.X64.Decls.buffer64_read
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b: Vale.X64.Memory.buffer64 -> i: Prims.int -> h: Vale.X64.Decls.vale_heap -> Prims.GTot Vale.Def.Types_s.nat64
{ "end_col": 96, "end_line": 115, "start_col": 77, "start_line": 115 }
Prims.Tot
val valid_dst_addr (#t: M.base_typ) (m: vale_heap) (b: M.buffer t) (i: int) : prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i
val valid_dst_addr (#t: M.base_typ) (m: vale_heap) (b: M.buffer t) (i: int) : prop0 let valid_dst_addr (#t: M.base_typ) (m: vale_heap) (b: M.buffer t) (i: int) : prop0 =
false
null
false
M.valid_buffer_write m b i
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.Arch.HeapTypes_s.base_typ", "Vale.X64.Decls.vale_heap", "Vale.X64.Memory.buffer", "Prims.int", "Vale.X64.Memory.valid_buffer_write", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b
false
false
Vale.X64.Decls.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 valid_dst_addr (#t: M.base_typ) (m: vale_heap) (b: M.buffer t) (i: int) : prop0
[]
Vale.X64.Decls.valid_dst_addr
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
m: Vale.X64.Decls.vale_heap -> b: Vale.X64.Memory.buffer t -> i: Prims.int -> Vale.Def.Prop_s.prop0
{ "end_col": 115, "end_line": 114, "start_col": 89, "start_line": 114 }
Prims.GTot
val modifies_mem (s: M.loc) (h1 h2: vale_heap) : GTot prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2
val modifies_mem (s: M.loc) (h1 h2: vale_heap) : GTot prop0 let modifies_mem (s: M.loc) (h1 h2: vale_heap) : GTot prop0 =
false
null
false
M.modifies s h1 h2
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Memory.loc", "Vale.X64.Decls.vale_heap", "Vale.X64.Memory.modifies", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h
false
false
Vale.X64.Decls.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 modifies_mem (s: M.loc) (h1 h2: vale_heap) : GTot prop0
[]
Vale.X64.Decls.modifies_mem
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Memory.loc -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> Prims.GTot Vale.Def.Prop_s.prop0
{ "end_col": 85, "end_line": 117, "start_col": 67, "start_line": 117 }
Prims.GTot
val s128 (m: vale_heap) (b: M.buffer128) : GTot (Seq.seq quad32)
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b
val s128 (m: vale_heap) (b: M.buffer128) : GTot (Seq.seq quad32) let s128 (m: vale_heap) (b: M.buffer128) : GTot (Seq.seq quad32) =
false
null
false
buffer128_as_seq m b
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Decls.vale_heap", "Vale.X64.Memory.buffer128", "Vale.X64.Decls.buffer128_as_seq", "FStar.Seq.Base.seq", "Vale.X64.Decls.quad32" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b
false
false
Vale.X64.Decls.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 s128 (m: vale_heap) (b: M.buffer128) : GTot (Seq.seq quad32)
[]
Vale.X64.Decls.s128
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
m: Vale.X64.Decls.vale_heap -> b: Vale.X64.Memory.buffer128 -> Prims.GTot (FStar.Seq.Base.seq Vale.X64.Decls.quad32)
{ "end_col": 92, "end_line": 112, "start_col": 72, "start_line": 112 }
Prims.Tot
val valid_src_addr (#t: M.base_typ) (m: vale_heap) (b: M.buffer t) (i: int) : prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i
val valid_src_addr (#t: M.base_typ) (m: vale_heap) (b: M.buffer t) (i: int) : prop0 let valid_src_addr (#t: M.base_typ) (m: vale_heap) (b: M.buffer t) (i: int) : prop0 =
false
null
false
M.valid_buffer_read m b i
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.Arch.HeapTypes_s.base_typ", "Vale.X64.Decls.vale_heap", "Vale.X64.Memory.buffer", "Prims.int", "Vale.X64.Memory.valid_buffer_read", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b
false
false
Vale.X64.Decls.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 valid_src_addr (#t: M.base_typ) (m: vale_heap) (b: M.buffer t) (i: int) : prop0
[]
Vale.X64.Decls.valid_src_addr
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
m: Vale.X64.Decls.vale_heap -> b: Vale.X64.Memory.buffer t -> i: Prims.int -> Vale.Def.Prop_s.prop0
{ "end_col": 114, "end_line": 113, "start_col": 89, "start_line": 113 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let locs_disjoint = M.locs_disjoint
let locs_disjoint =
false
null
false
M.locs_disjoint
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Memory.locs_disjoint" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2
false
true
Vale.X64.Decls.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 locs_disjoint : ls: Prims.list Vale.X64.Memory.loc -> Vale.Def.Prop_s.prop0
[]
Vale.X64.Decls.locs_disjoint
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
ls: Prims.list Vale.X64.Memory.loc -> Vale.Def.Prop_s.prop0
{ "end_col": 42, "end_line": 119, "start_col": 27, "start_line": 119 }
Prims.GTot
val va_if (#a: Type) (b: bool) (x: (_: unit{b} -> GTot a)) (y: (_: unit{~b} -> GTot a)) : GTot a
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y ()
val va_if (#a: Type) (b: bool) (x: (_: unit{b} -> GTot a)) (y: (_: unit{~b} -> GTot a)) : GTot a let va_if (#a: Type) (b: bool) (x: (_: unit{b} -> GTot a)) (y: (_: unit{~b} -> GTot a)) : GTot a =
false
null
false
if b then x () else y ()
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Prims.bool", "Prims.unit", "Prims.b2t", "Prims.l_not" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_if (#a: Type) (b: bool) (x: (_: unit{b} -> GTot a)) (y: (_: unit{~b} -> GTot a)) : GTot a
[]
Vale.X64.Decls.va_if
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b: Prims.bool -> x: (_: Prims.unit{b} -> Prims.GTot a) -> y: (_: Prims.unit{~b} -> Prims.GTot a) -> Prims.GTot a
{ "end_col": 26, "end_line": 54, "start_col": 2, "start_line": 54 }
Prims.Tot
val valid_buf_maddr64 (addr: int) (s_mem: vale_heap) (layout: vale_heap_layout) (b: M.buffer64) (index: int) (t: taint) : prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index
val valid_buf_maddr64 (addr: int) (s_mem: vale_heap) (layout: vale_heap_layout) (b: M.buffer64) (index: int) (t: taint) : prop0 let valid_buf_maddr64 (addr: int) (s_mem: vale_heap) (layout: vale_heap_layout) (b: M.buffer64) (index: int) (t: taint) : prop0 =
false
null
false
valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Prims.int", "Vale.X64.Decls.vale_heap", "Vale.Arch.HeapImpl.vale_heap_layout", "Vale.X64.Memory.buffer64", "Vale.Arch.HeapTypes_s.taint", "Prims.l_and", "Vale.X64.Decls.valid_src_addr", "Vale.X64.Memory.vuint64", "Vale.X64.Memory.valid_taint_buf64", "Vale.Arch.HeapImpl.__proj__Mkvale_heap_layout__item__vl_taint", "Prims.eq2", "Prims.op_Addition", "Vale.X64.Memory.buffer_addr", "FStar.Mul.op_Star", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union
false
true
Vale.X64.Decls.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 valid_buf_maddr64 (addr: int) (s_mem: vale_heap) (layout: vale_heap_layout) (b: M.buffer64) (index: int) (t: taint) : prop0
[]
Vale.X64.Decls.valid_buf_maddr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
addr: Prims.int -> s_mem: Vale.X64.Decls.vale_heap -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> b: Vale.X64.Memory.buffer64 -> index: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> Vale.Def.Prop_s.prop0
{ "end_col": 43, "end_line": 125, "start_col": 2, "start_line": 123 }
Prims.Tot
val valid_mem_operand64 (addr: int) (t: taint) (s_mem: vale_heap) (layout: vale_heap_layout) : prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t
val valid_mem_operand64 (addr: int) (t: taint) (s_mem: vale_heap) (layout: vale_heap_layout) : prop0 let valid_mem_operand64 (addr: int) (t: taint) (s_mem: vale_heap) (layout: vale_heap_layout) : prop0 =
false
null
false
exists (b: M.buffer64) (index: int). {:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Decls.vale_heap", "Vale.Arch.HeapImpl.vale_heap_layout", "Prims.l_Exists", "Vale.X64.Memory.buffer64", "Vale.X64.Decls.valid_buf_maddr64", "Vale.X64.Memory.valid_buffer_read", "Vale.X64.Memory.vuint64", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index
false
true
Vale.X64.Decls.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 valid_mem_operand64 (addr: int) (t: taint) (s_mem: vale_heap) (layout: vale_heap_layout) : prop0
[]
Vale.X64.Decls.valid_mem_operand64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
addr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> s_mem: Vale.X64.Decls.vale_heap -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> Vale.Def.Prop_s.prop0
{ "end_col": 49, "end_line": 134, "start_col": 2, "start_line": 133 }
Prims.GTot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let loc_union = M.loc_union
let loc_union =
false
null
false
M.loc_union
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Memory.loc_union" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b
false
false
Vale.X64.Decls.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 loc_union : s1: Vale.X64.Memory.loc -> s2: Vale.X64.Memory.loc -> Prims.GTot Vale.X64.Memory.loc
[]
Vale.X64.Decls.loc_union
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s1: Vale.X64.Memory.loc -> s2: Vale.X64.Memory.loc -> Prims.GTot Vale.X64.Memory.loc
{ "end_col": 34, "end_line": 120, "start_col": 23, "start_line": 120 }
Prims.Tot
val va_op_shift_amt64_reg64 (r: reg_64) : operand64
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r
val va_op_shift_amt64_reg64 (r: reg_64) : operand64 let va_op_shift_amt64_reg64 (r: reg_64) : operand64 =
false
null
false
OReg r
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.reg_64", "Vale.X64.Machine_s.OReg", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.operand64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_op_shift_amt64_reg64 (r: reg_64) : operand64
[]
Vale.X64.Decls.va_op_shift_amt64_reg64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.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 -> Vale.X64.Machine_s.operand64
{ "end_col": 78, "end_line": 166, "start_col": 72, "start_line": 166 }
Prims.Tot
val valid_mem_operand128 (addr: int) (t: taint) (s_mem: vale_heap) (layout: vale_heap_layout) : prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t
val valid_mem_operand128 (addr: int) (t: taint) (s_mem: vale_heap) (layout: vale_heap_layout) : prop0 let valid_mem_operand128 (addr: int) (t: taint) (s_mem: vale_heap) (layout: vale_heap_layout) : prop0 =
false
null
false
exists (b: M.buffer128) (index: int). {:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Decls.vale_heap", "Vale.Arch.HeapImpl.vale_heap_layout", "Prims.l_Exists", "Vale.X64.Memory.buffer128", "Vale.X64.Decls.valid_buf_maddr128", "Vale.X64.Memory.valid_buffer_read", "Vale.X64.Memory.vuint128", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t
false
true
Vale.X64.Decls.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 valid_mem_operand128 (addr: int) (t: taint) (s_mem: vale_heap) (layout: vale_heap_layout) : prop0
[]
Vale.X64.Decls.valid_mem_operand128
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
addr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> s_mem: Vale.X64.Decls.vale_heap -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> Vale.Def.Prop_s.prop0
{ "end_col": 50, "end_line": 138, "start_col": 2, "start_line": 137 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let reg_operand = o:operand64{OReg? o}
let reg_operand =
false
null
false
o: operand64{OReg? o}
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.operand64", "Prims.b2t", "Vale.X64.Machine_s.uu___is_OReg", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.reg_64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0
false
true
Vale.X64.Decls.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_operand : Type0
[]
Vale.X64.Decls.reg_operand
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 38, "end_line": 74, "start_col": 18, "start_line": 74 }
Prims.Tot
val get_reg (o: reg_operand) : reg
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o)
val get_reg (o: reg_operand) : reg let get_reg (o: reg_operand) : reg =
false
null
false
Reg 0 (OReg?.r o)
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.reg_operand", "Vale.X64.Machine_s.Reg", "Vale.X64.Machine_s.__proj__OReg__item__r", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.reg_64", "Vale.X64.Machine_s.reg" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s
false
true
Vale.X64.Decls.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 get_reg (o: reg_operand) : reg
[]
Vale.X64.Decls.get_reg
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
o: Vale.X64.Decls.reg_operand -> Vale.X64.Machine_s.reg
{ "end_col": 60, "end_line": 104, "start_col": 43, "start_line": 104 }
Prims.Tot
val va_const_cmp (n: nat64) : cmp_operand
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_const_cmp (n:nat64) : cmp_operand = OConst n
val va_const_cmp (n: nat64) : cmp_operand let va_const_cmp (n: nat64) : cmp_operand =
false
null
false
OConst n
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.Def.Types_s.nat64", "Vale.X64.Machine_s.OConst", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.reg_64", "Vale.X64.Decls.cmp_operand" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_const_cmp (n: nat64) : cmp_operand
[]
Vale.X64.Decls.va_const_cmp
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Vale.Def.Types_s.nat64 -> Vale.X64.Decls.cmp_operand
{ "end_col": 70, "end_line": 168, "start_col": 62, "start_line": 168 }
Prims.Tot
val va_coerce_xmm_to_opr128 (x: reg_xmm) : operand128
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x
val va_coerce_xmm_to_opr128 (x: reg_xmm) : operand128 let va_coerce_xmm_to_opr128 (x: reg_xmm) : operand128 =
false
null
false
OReg x
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.reg_xmm", "Vale.X64.Machine_s.OReg", "Vale.X64.Machine_s.quad32", "Vale.X64.Machine_s.operand128" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_coerce_xmm_to_opr128 (x: reg_xmm) : operand128
[]
Vale.X64.Decls.va_coerce_xmm_to_opr128
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.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 -> Vale.X64.Machine_s.operand128
{ "end_col": 80, "end_line": 176, "start_col": 74, "start_line": 176 }
Prims.Tot
val va_op_reg_opr64_reg64 (r: reg_64) : reg_operand
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r
val va_op_reg_opr64_reg64 (r: reg_64) : reg_operand let va_op_reg_opr64_reg64 (r: reg_64) : reg_operand =
false
null
false
OReg r
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.reg_64", "Vale.X64.Machine_s.OReg", "Vale.X64.Machine_s.nat64", "Vale.X64.Decls.reg_operand" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_op_reg_opr64_reg64 (r: reg_64) : reg_operand
[]
Vale.X64.Decls.va_op_reg_opr64_reg64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.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 -> Vale.X64.Decls.reg_operand
{ "end_col": 78, "end_line": 173, "start_col": 72, "start_line": 173 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_operand_reg_opr64 = o:operand64{OReg? o}
let va_operand_reg_opr64 =
false
null
false
o: operand64{OReg? o}
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.operand64", "Prims.b2t", "Vale.X64.Machine_s.uu___is_OReg", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.reg_64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_operand_reg_opr64 : Type0
[]
Vale.X64.Decls.va_operand_reg_opr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 47, "end_line": 75, "start_col": 27, "start_line": 75 }
Prims.Tot
val loc_locs_disjoint_rec128 (l: M.buffer128) (ls: list (M.buffer128)) : prop0
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec loc_locs_disjoint_rec128 (l:M.buffer128) (ls:list (M.buffer128)) : prop0 = match ls with | [] -> True | h::t -> locs_disjoint [loc_buffer l; loc_buffer h] /\ loc_locs_disjoint_rec128 l t
val loc_locs_disjoint_rec128 (l: M.buffer128) (ls: list (M.buffer128)) : prop0 let rec loc_locs_disjoint_rec128 (l: M.buffer128) (ls: list (M.buffer128)) : prop0 =
false
null
false
match ls with | [] -> True | h :: t -> locs_disjoint [loc_buffer l; loc_buffer h] /\ loc_locs_disjoint_rec128 l t
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Memory.buffer128", "Prims.list", "Prims.l_True", "Prims.l_and", "Vale.X64.Decls.locs_disjoint", "Prims.Cons", "Vale.X64.Memory.loc", "Vale.X64.Decls.loc_buffer", "Vale.X64.Memory.vuint128", "Prims.Nil", "Vale.X64.Decls.loc_locs_disjoint_rec128", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr] let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s [@va_qattr] unfold let va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s let va_lemma_upd_update (sM:vale_state) : Lemma ( (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_dst_opr64 o sM sK)} va_is_dst_dst_opr64 o sK ==> va_update_operand_dst_opr64 o sM sK == va_upd_operand_dst_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (o:operand64).{:pattern (va_update_operand_reg_opr64 o sM sK)} va_is_dst_reg_opr64 o sK ==> va_update_operand_reg_opr64 o sM sK == va_upd_operand_reg_opr64 o (eval_operand o sM) sK) /\ (forall (sK:vale_state) (x:reg_xmm).{:pattern (va_update_operand_xmm x sM sK)} va_update_operand_xmm x sM sK == va_upd_operand_xmm x (eval_reg_xmm x sM) sK) ) = () (** Constructors for va_codes *) [@va_qattr] unfold let va_CNil () : va_codes = [] [@va_qattr] unfold let va_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl (** Constructors for va_code *) unfold let va_Block (block:va_codes) : va_code = Block block unfold let va_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse unfold let va_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp val va_cmp_gt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp unfold let va_get_block (c:va_code{Block? c}) : va_codes = Block?.block c unfold let va_get_ifCond (c:va_code{IfElse? c}) : ocmp = IfElse?.ifCond c unfold let va_get_ifTrue (c:va_code{IfElse? c}) : va_code = IfElse?.ifTrue c unfold let va_get_ifFalse (c:va_code{IfElse? c}) : va_code = IfElse?.ifFalse c unfold let va_get_whileCond (c:va_code{While? c}) : ocmp = While?.whileCond c unfold let va_get_whileBody (c:va_code{While? c}) : va_code = While?.whileBody c (** Map syntax **) //unfold let (.[]) (m:vale_heap) (b:M.buffer64) = fun index -> buffer64_read b index m // syntax for map accesses, m.[key] and m.[key] <- value (* type map (key:eqtype) (value:Type) = Map.t key value unfold let (.[]) = Map.sel unfold let (.[]<-) = Map.upd *) (** Memory framing **) (* unfold let in_mem (addr:int) (m:mem) : bool = m `Map.contains` addr let disjoint (ptr1:int) (num_bytes1:int) (ptr2:int) (num_bytes2:int) = ptr1 + num_bytes1 <= ptr2 \/ ptr2 + num_bytes2 <= ptr1 let validSrcAddrs (mem:mem) (addr:int) (size:int) (num_bytes:int) = size == 64 /\ (forall (a:int) . {:pattern (mem `Map.contains` a)} addr <= a && a < addr+num_bytes && (a - addr) % 8 = 0 ==> mem `Map.contains` a) let memModified (old_mem:mem) (new_mem:mem) (ptr:int) (num_bytes) = (forall (a:int) . {:pattern (new_mem `Map.contains` a)} old_mem `Map.contains` a <==> new_mem `Map.contains` a) /\ (forall (a:int) . {:pattern (new_mem.[a]) \/ Map.sel new_mem a} a < ptr || a >= ptr + num_bytes ==> old_mem.[a] == new_mem.[ a]) *) (** Convenient memory-related functions **) let rec buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l) = match l with | [] -> True | b :: l' -> buffer_readable h b /\ buffers_readable h l' unfold let modifies_buffer (b:M.buffer64) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer_2 (b1 b2:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer_3 (b1 b2 b3:M.buffer64) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 unfold let modifies_buffer128 (b:M.buffer128) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2 unfold let modifies_buffer128_2 (b1 b2:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2 unfold let modifies_buffer128_3 (b1 b2 b3:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) h1 h2 let validSrcAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = buffer_readable h b /\ len <= buffer_length b /\ M.buffer_addr b h == addr /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) false /\ M.valid_taint_buf b h layout.vl_taint tn let validDstAddrs (#t:base_typ) (h:vale_heap) (addr:int) (b:M.buffer t) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) true /\ buffer_writeable b let validSrcAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs64 (h:vale_heap) (addr:int) (b:M.buffer64) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h addr b len layout tn let validDstAddrs128 (h:vale_heap) (addr:int) (b:M.buffer128) (len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h addr b len layout tn let validSrcAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validSrcAddrs h (addr - 16 * offset) b (len + offset) layout tn let validDstAddrsOffset128 (h:vale_heap) (addr:int) (b:M.buffer128) (offset len:int) (layout:vale_heap_layout) (tn:taint) = validDstAddrs h (addr - 16 * offset) b (len + offset) layout tn let modifies_buffer_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer128 b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let buffer_modifies_specific128 (b:M.buffer128) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer128_read b i h1 == buffer128_read b i h2) let modifies_buffer_specific (b:M.buffer64) (h1 h2:vale_heap) (start last:nat) : GTot prop0 = modifies_buffer b h1 h2 /\ // TODO: Consider replacing this with: modifies (loc_buffer (gsub_buffer b i len)) h1 h2 (forall (i:nat) . {:pattern (Seq.index (M.buffer_as_seq h2 b) i)} 0 <= i /\ i < buffer_length b /\ (i < start || i > last) ==> buffer64_read b i h1 == buffer64_read b i h2) unfold let buffers_disjoint (b1 b2:M.buffer64) = locs_disjoint [loc_buffer b1; loc_buffer b2] unfold let buffers_disjoint128 (b1 b2:M.buffer128) = locs_disjoint [loc_buffer b1; loc_buffer b2]
false
true
Vale.X64.Decls.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 loc_locs_disjoint_rec128 (l: M.buffer128) (ls: list (M.buffer128)) : prop0
[ "recursion" ]
Vale.X64.Decls.loc_locs_disjoint_rec128
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Vale.X64.Memory.buffer128 -> ls: Prims.list Vale.X64.Memory.buffer128 -> Vale.Def.Prop_s.prop0
{ "end_col": 86, "end_line": 466, "start_col": 2, "start_line": 464 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_upd_operand_reg_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s
let va_upd_operand_reg_opr64 (o: operand64) (v: nat64) (s: vale_state) =
false
null
false
match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s | OStack (m, _) -> s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.operand64", "Vale.Def.Types_s.nat64", "Vale.X64.State.vale_state", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.reg_64", "Vale.X64.State.update_reg_64", "Vale.X64.Machine_s.maddr", "Vale.Arch.HeapTypes_s.taint" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True [@va_qattr] unfold let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s [@va_qattr] unfold let va_is_src_heaplet (h:heaplet_id) (s:va_state) = True [@va_qattr] unfold let va_is_dst_heaplet (h:heaplet_id) (s:va_state) = True (* Framing: va_update_foo means the two states are the same except for foo *) [@va_qattr] unfold let va_update_ok (sM:va_state) (sK:va_state) : va_state = va_upd_ok sM.vs_ok sK [@va_qattr] unfold let va_update_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK [@va_qattr] unfold let update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK [@va_qattr] unfold let va_update_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK [@va_qattr] unfold let va_update_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK [@va_qattr] unfold let va_update_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK [@va_qattr] unfold let va_update_mem_heaplet (n:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) sK [@va_qattr] unfold let va_update_stack (sM:va_state) (sK:va_state) : va_state = va_upd_stack sM.vs_stack sK [@va_qattr] unfold let va_update_stackTaint (sM:va_state) (sK:va_state) : va_state = va_upd_stackTaint sM.vs_stackTaint sK [@va_qattr] let update_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = match o with | OConst n -> sK | OReg r -> va_update_reg64 r sM sK | OMem (m, _) -> va_update_mem sM sK | OStack (m, _) -> va_update_stack sM sK [@va_qattr] unfold let update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK [@va_qattr] unfold let va_update_operand_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK [@va_qattr] unfold let va_update_operand_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK [@va_qattr] unfold let va_update_operand_heaplet (h:heaplet_id) (sM:va_state) (sK:va_state) : va_state = va_update_mem_heaplet h sM sK unfold let va_value_opr64 = nat64 unfold let va_value_dst_opr64 = nat64 unfold let va_value_reg_opr64 = nat64 unfold let va_value_xmm = quad32 unfold let va_value_heaplet = vale_heap [@va_qattr] let va_upd_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_operand_dst_opr64 (o:operand64) (v:nat64) (s:vale_state) = match o with | OConst n -> s | OReg r -> update_reg_64 r v s | OMem (m, _) -> s // TODO: support destination memory operands | OStack (m, _) -> s // TODO: support destination stack operands [@va_qattr]
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_upd_operand_reg_opr64 : o: Vale.X64.Machine_s.operand64 -> v: Vale.Def.Types_s.nat64 -> s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
[]
Vale.X64.Decls.va_upd_operand_reg_opr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
o: Vale.X64.Machine_s.operand64 -> v: Vale.Def.Types_s.nat64 -> s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
{ "end_col": 22, "end_line": 321, "start_col": 2, "start_line": 317 }
Prims.Tot
val va_coerce_reg_opr64_to_dst_opr64 (o: va_operand_reg_opr64) : va_operand_dst_opr64
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o
val va_coerce_reg_opr64_to_dst_opr64 (o: va_operand_reg_opr64) : va_operand_dst_opr64 let va_coerce_reg_opr64_to_dst_opr64 (o: va_operand_reg_opr64) : va_operand_dst_opr64 =
false
null
false
o
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_operand_reg_opr64", "Vale.X64.Decls.va_operand_dst_opr64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_coerce_reg_opr64_to_dst_opr64 (o: va_operand_reg_opr64) : va_operand_dst_opr64
[]
Vale.X64.Decls.va_coerce_reg_opr64_to_dst_opr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
o: Vale.X64.Decls.va_operand_reg_opr64 -> Vale.X64.Decls.va_operand_dst_opr64
{ "end_col": 107, "end_line": 170, "start_col": 106, "start_line": 170 }
Prims.Tot
val va_op_heaplet_mem_heaplet (h: heaplet_id) : heaplet_id
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h
val va_op_heaplet_mem_heaplet (h: heaplet_id) : heaplet_id let va_op_heaplet_mem_heaplet (h: heaplet_id) : heaplet_id =
false
null
false
h
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.heaplet_id" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_op_heaplet_mem_heaplet (h: heaplet_id) : heaplet_id
[]
Vale.X64.Decls.va_op_heaplet_mem_heaplet
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
h: Vale.X64.Decls.heaplet_id -> Vale.X64.Decls.heaplet_id
{ "end_col": 80, "end_line": 177, "start_col": 79, "start_line": 177 }
Prims.Tot
val va_coerce_dst_opr64_to_opr64 (o: operand64) : operand64
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o
val va_coerce_dst_opr64_to_opr64 (o: operand64) : operand64 let va_coerce_dst_opr64_to_opr64 (o: operand64) : operand64 =
false
null
false
o
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.operand64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_coerce_dst_opr64_to_opr64 (o: operand64) : operand64
[]
Vale.X64.Decls.va_coerce_dst_opr64_to_opr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
o: Vale.X64.Machine_s.operand64 -> Vale.X64.Machine_s.operand64
{ "end_col": 81, "end_line": 175, "start_col": 80, "start_line": 175 }
Prims.Tot
val va_get_flags (s: va_state) : Flags.t
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_get_flags (s:va_state) : Flags.t = s.vs_flags
val va_get_flags (s: va_state) : Flags.t let va_get_flags (s: va_state) : Flags.t =
false
null
false
s.vs_flags
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.State.__proj__Mkvale_state__item__vs_flags", "Vale.X64.Flags.t" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *)
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_get_flags (s: va_state) : Flags.t
[]
Vale.X64.Decls.va_get_flags
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> Vale.X64.Flags.t
{ "end_col": 71, "end_line": 203, "start_col": 61, "start_line": 203 }
Prims.Tot
val va_get_ok (s: va_state) : bool
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_get_ok (s:va_state) : bool = s.vs_ok
val va_get_ok (s: va_state) : bool let va_get_ok (s: va_state) : bool =
false
null
false
s.vs_ok
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.State.__proj__Mkvale_state__item__vs_ok", "Prims.bool" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_get_ok (s: va_state) : bool
[]
Vale.X64.Decls.va_get_ok
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> Prims.bool
{ "end_col": 62, "end_line": 202, "start_col": 55, "start_line": 202 }
Prims.Tot
val va_get_mem_heaplet (n: heaplet_id) (s: va_state) : vale_heap
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n
val va_get_mem_heaplet (n: heaplet_id) (s: va_state) : vale_heap let va_get_mem_heaplet (n: heaplet_id) (s: va_state) : vale_heap =
false
null
false
Map16.sel s.vs_heap.vf_heaplets n
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.heaplet_id", "Vale.X64.Decls.va_state", "Vale.Lib.Map16.sel", "Vale.Arch.HeapImpl.vale_heap", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heaplets", "Vale.X64.State.__proj__Mkvale_state__item__vs_heap", "Vale.X64.Decls.vale_heap" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_get_mem_heaplet (n: heaplet_id) (s: va_state) : vale_heap
[]
Vale.X64.Decls.va_get_mem_heaplet
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Vale.X64.Decls.heaplet_id -> s: Vale.X64.Decls.va_state -> Vale.X64.Decls.vale_heap
{ "end_col": 117, "end_line": 208, "start_col": 84, "start_line": 208 }
Prims.Tot
val va_get_stackTaint (s: va_state) : M.memtaint
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint
val va_get_stackTaint (s: va_state) : M.memtaint let va_get_stackTaint (s: va_state) : M.memtaint =
false
null
false
s.vs_stackTaint
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.State.__proj__Mkvale_state__item__vs_stackTaint", "Vale.X64.Memory.memtaint" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_get_stackTaint (s: va_state) : M.memtaint
[]
Vale.X64.Decls.va_get_stackTaint
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> Vale.X64.Memory.memtaint
{ "end_col": 84, "end_line": 210, "start_col": 69, "start_line": 210 }
Prims.Tot
val va_get_mem_layout (s: va_state) : vale_heap_layout
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout
val va_get_mem_layout (s: va_state) : vale_heap_layout let va_get_mem_layout (s: va_state) : vale_heap_layout =
false
null
false
s.vs_heap.vf_layout
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_state", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout", "Vale.X64.State.__proj__Mkvale_state__item__vs_heap", "Vale.Arch.HeapImpl.vale_heap_layout" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_get_mem_layout (s: va_state) : vale_heap_layout
[]
Vale.X64.Decls.va_get_mem_layout
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> Vale.Arch.HeapImpl.vale_heap_layout
{ "end_col": 94, "end_line": 207, "start_col": 75, "start_line": 207 }
Prims.Tot
val va_get_stack (s: va_state) : S.vale_stack
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack
val va_get_stack (s: va_state) : S.vale_stack let va_get_stack (s: va_state) : S.vale_stack =
false
null
false
s.vs_stack
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.State.__proj__Mkvale_state__item__vs_stack", "Vale.X64.Stack_i.vale_stack" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_get_stack (s: va_state) : S.vale_stack
[]
Vale.X64.Decls.va_get_stack
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> Vale.X64.Stack_i.vale_stack
{ "end_col": 76, "end_line": 209, "start_col": 66, "start_line": 209 }
Prims.Tot
val va_get_xmm (x: reg_xmm) (s: va_state) : quad32
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s
val va_get_xmm (x: reg_xmm) (s: va_state) : quad32 let va_get_xmm (x: reg_xmm) (s: va_state) : quad32 =
false
null
false
eval_reg_xmm x s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.reg_xmm", "Vale.X64.Decls.va_state", "Vale.X64.State.eval_reg_xmm", "Vale.X64.Decls.quad32" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_get_xmm (x: reg_xmm) (s: va_state) : quad32
[]
Vale.X64.Decls.va_get_xmm
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.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 -> s: Vale.X64.Decls.va_state -> Vale.X64.Decls.quad32
{ "end_col": 86, "end_line": 205, "start_col": 70, "start_line": 205 }
Prims.Tot
val va_upd_flags (flags: Flags.t) (s: vale_state) : vale_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags }
val va_upd_flags (flags: Flags.t) (s: vale_state) : vale_state let va_upd_flags (flags: Flags.t) (s: vale_state) : vale_state =
false
null
false
{ s with vs_flags = flags }
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Flags.t", "Vale.X64.State.vale_state", "Vale.X64.State.Mkvale_state", "Vale.X64.State.__proj__Mkvale_state__item__vs_ok", "Vale.X64.State.__proj__Mkvale_state__item__vs_regs", "Vale.X64.State.__proj__Mkvale_state__item__vs_heap", "Vale.X64.State.__proj__Mkvale_state__item__vs_stack", "Vale.X64.State.__proj__Mkvale_state__item__vs_stackTaint" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_upd_flags (flags: Flags.t) (s: vale_state) : vale_state
[]
Vale.X64.Decls.va_upd_flags
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
flags: Vale.X64.Flags.t -> s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
{ "end_col": 100, "end_line": 213, "start_col": 77, "start_line": 213 }
Prims.Tot
val va_upd_reg64 (r: reg_64) (v: nat64) (s: vale_state) : vale_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s
val va_upd_reg64 (r: reg_64) (v: nat64) (s: vale_state) : vale_state let va_upd_reg64 (r: reg_64) (v: nat64) (s: vale_state) : vale_state =
false
null
false
update_reg_64 r v s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.reg_64", "Vale.Def.Types_s.nat64", "Vale.X64.State.vale_state", "Vale.X64.State.update_reg_64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags }
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_upd_reg64 (r: reg_64) (v: nat64) (s: vale_state) : vale_state
[]
Vale.X64.Decls.va_upd_reg64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.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 -> v: Vale.Def.Types_s.nat64 -> s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
{ "end_col": 99, "end_line": 215, "start_col": 80, "start_line": 215 }
Prims.Tot
val va_upd_mem_layout (layout: vale_heap_layout) (s: vale_state) : vale_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } }
val va_upd_mem_layout (layout: vale_heap_layout) (s: vale_state) : vale_state let va_upd_mem_layout (layout: vale_heap_layout) (s: vale_state) : vale_state =
false
null
false
{ s with vs_heap = { s.vs_heap with vf_layout = layout } }
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.Arch.HeapImpl.vale_heap_layout", "Vale.X64.State.vale_state", "Vale.X64.State.Mkvale_state", "Vale.X64.State.__proj__Mkvale_state__item__vs_ok", "Vale.X64.State.__proj__Mkvale_state__item__vs_regs", "Vale.X64.State.__proj__Mkvale_state__item__vs_flags", "Vale.Arch.HeapImpl.Mkvale_full_heap", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heap", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heaplets", "Vale.Arch.HeapImpl.vale_full_heap", "Vale.X64.State.__proj__Mkvale_state__item__vs_heap", "Vale.X64.State.__proj__Mkvale_state__item__vs_stack", "Vale.X64.State.__proj__Mkvale_state__item__vs_stackTaint" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_upd_mem_layout (layout: vale_heap_layout) (s: vale_state) : vale_state
[]
Vale.X64.Decls.va_upd_mem_layout
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
layout: Vale.Arch.HeapImpl.vale_heap_layout -> s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
{ "end_col": 146, "end_line": 218, "start_col": 92, "start_line": 218 }
Prims.Tot
val va_upd_stack (stack: S.vale_stack) (s: vale_state) : vale_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack }
val va_upd_stack (stack: S.vale_stack) (s: vale_state) : vale_state let va_upd_stack (stack: S.vale_stack) (s: vale_state) : vale_state =
false
null
false
{ s with vs_stack = stack }
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Stack_i.vale_stack", "Vale.X64.State.vale_state", "Vale.X64.State.Mkvale_state", "Vale.X64.State.__proj__Mkvale_state__item__vs_ok", "Vale.X64.State.__proj__Mkvale_state__item__vs_regs", "Vale.X64.State.__proj__Mkvale_state__item__vs_flags", "Vale.X64.State.__proj__Mkvale_state__item__vs_heap", "Vale.X64.State.__proj__Mkvale_state__item__vs_stackTaint" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state =
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_upd_stack (stack: S.vale_stack) (s: vale_state) : vale_state
[]
Vale.X64.Decls.va_upd_stack
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
stack: Vale.X64.Stack_i.vale_stack -> s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
{ "end_col": 105, "end_line": 221, "start_col": 82, "start_line": 221 }
Prims.Tot
val va_upd_mem (mem: vale_heap) (s: vale_state) : vale_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem }
val va_upd_mem (mem: vale_heap) (s: vale_state) : vale_state let va_upd_mem (mem: vale_heap) (s: vale_state) : vale_state =
false
null
false
{ s with vs_heap = M.set_vale_heap s.vs_heap mem }
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.vale_heap", "Vale.X64.State.vale_state", "Vale.X64.State.Mkvale_state", "Vale.X64.State.__proj__Mkvale_state__item__vs_ok", "Vale.X64.State.__proj__Mkvale_state__item__vs_regs", "Vale.X64.State.__proj__Mkvale_state__item__vs_flags", "Vale.X64.Memory.set_vale_heap", "Vale.X64.State.__proj__Mkvale_state__item__vs_heap", "Vale.X64.State.__proj__Mkvale_state__item__vs_stack", "Vale.X64.State.__proj__Mkvale_state__item__vs_stackTaint" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_upd_mem (mem: vale_heap) (s: vale_state) : vale_state
[]
Vale.X64.Decls.va_upd_mem
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
mem: Vale.X64.Decls.vale_heap -> s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
{ "end_col": 121, "end_line": 217, "start_col": 75, "start_line": 217 }
Prims.GTot
val va_eval_dst_opr64 (s: va_state) (o: operand64) : GTot nat64
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s
val va_eval_dst_opr64 (s: va_state) (o: operand64) : GTot nat64 let va_eval_dst_opr64 (s: va_state) (o: operand64) : GTot nat64 =
false
null
false
eval_operand o s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.Machine_s.operand64", "Vale.X64.State.eval_operand", "Vale.Def.Types_s.nat64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *)
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_eval_dst_opr64 (s: va_state) (o: operand64) : GTot nat64
[]
Vale.X64.Decls.va_eval_dst_opr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> o: Vale.X64.Machine_s.operand64 -> Prims.GTot Vale.Def.Types_s.nat64
{ "end_col": 102, "end_line": 226, "start_col": 86, "start_line": 226 }
Prims.Tot
val va_upd_xmm (x: reg_xmm) (v: quad32) (s: vale_state) : vale_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s
val va_upd_xmm (x: reg_xmm) (v: quad32) (s: vale_state) : vale_state let va_upd_xmm (x: reg_xmm) (v: quad32) (s: vale_state) : vale_state =
false
null
false
update_reg_xmm x v s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.reg_xmm", "Vale.X64.Decls.quad32", "Vale.X64.State.vale_state", "Vale.X64.State.update_reg_xmm" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_upd_xmm (x: reg_xmm) (v: quad32) (s: vale_state) : vale_state
[]
Vale.X64.Decls.va_upd_xmm
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.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 -> v: Vale.X64.Decls.quad32 -> s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
{ "end_col": 100, "end_line": 216, "start_col": 80, "start_line": 216 }
Prims.GTot
val va_eval_cmp_uint64 (s: va_state) (r: cmp_operand) : GTot nat64
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s
val va_eval_cmp_uint64 (s: va_state) (r: cmp_operand) : GTot nat64 let va_eval_cmp_uint64 (s: va_state) (r: cmp_operand) : GTot nat64 =
false
null
false
eval_operand r s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.Decls.cmp_operand", "Vale.X64.State.eval_operand", "Vale.Def.Types_s.nat64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_eval_cmp_uint64 (s: va_state) (r: cmp_operand) : GTot nat64
[]
Vale.X64.Decls.va_eval_cmp_uint64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> r: Vale.X64.Decls.cmp_operand -> Prims.GTot Vale.Def.Types_s.nat64
{ "end_col": 112, "end_line": 228, "start_col": 96, "start_line": 228 }
Prims.GTot
val va_eval_shift_amt64 (s: va_state) (o: operand64) : GTot nat64
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s
val va_eval_shift_amt64 (s: va_state) (o: operand64) : GTot nat64 let va_eval_shift_amt64 (s: va_state) (o: operand64) : GTot nat64 =
false
null
false
eval_operand o s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.Machine_s.operand64", "Vale.X64.State.eval_operand", "Vale.Def.Types_s.nat64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_eval_shift_amt64 (s: va_state) (o: operand64) : GTot nat64
[]
Vale.X64.Decls.va_eval_shift_amt64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> o: Vale.X64.Machine_s.operand64 -> Prims.GTot Vale.Def.Types_s.nat64
{ "end_col": 104, "end_line": 227, "start_col": 88, "start_line": 227 }
Prims.GTot
val va_eval_reg_opr64 (s: va_state) (o: operand64) : GTot nat64
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s
val va_eval_reg_opr64 (s: va_state) (o: operand64) : GTot nat64 let va_eval_reg_opr64 (s: va_state) (o: operand64) : GTot nat64 =
false
null
false
eval_operand o s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.Machine_s.operand64", "Vale.X64.State.eval_operand", "Vale.Def.Types_s.nat64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_eval_reg_opr64 (s: va_state) (o: operand64) : GTot nat64
[]
Vale.X64.Decls.va_eval_reg_opr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> o: Vale.X64.Machine_s.operand64 -> Prims.GTot Vale.Def.Types_s.nat64
{ "end_col": 106, "end_line": 230, "start_col": 90, "start_line": 230 }
Prims.Tot
val va_upd_mem_heaplet (n: heaplet_id) (h: vale_heap) (s: vale_state) : vale_state
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } }
val va_upd_mem_heaplet (n: heaplet_id) (h: vale_heap) (s: vale_state) : vale_state let va_upd_mem_heaplet (n: heaplet_id) (h: vale_heap) (s: vale_state) : vale_state =
false
null
false
{ s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } }
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.heaplet_id", "Vale.X64.Decls.vale_heap", "Vale.X64.State.vale_state", "Vale.X64.State.Mkvale_state", "Vale.X64.State.__proj__Mkvale_state__item__vs_ok", "Vale.X64.State.__proj__Mkvale_state__item__vs_regs", "Vale.X64.State.__proj__Mkvale_state__item__vs_flags", "Vale.Arch.HeapImpl.Mkvale_full_heap", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heap", "Vale.Lib.Map16.upd", "Vale.Arch.HeapImpl.vale_heap", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heaplets", "Vale.X64.State.__proj__Mkvale_state__item__vs_heap", "Vale.Arch.HeapImpl.vale_full_heap", "Vale.X64.State.__proj__Mkvale_state__item__vs_stack", "Vale.X64.State.__proj__Mkvale_state__item__vs_stackTaint" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } }
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_upd_mem_heaplet (n: heaplet_id) (h: vale_heap) (s: vale_state) : vale_state
[]
Vale.X64.Decls.va_upd_mem_heaplet
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Vale.X64.Decls.heaplet_id -> h: Vale.X64.Decls.vale_heap -> s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
{ "end_col": 89, "end_line": 220, "start_col": 4, "start_line": 220 }
Prims.GTot
val va_eval_xmm (s: va_state) (x: reg_xmm) : GTot quad32
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s
val va_eval_xmm (s: va_state) (x: reg_xmm) : GTot quad32 let va_eval_xmm (s: va_state) (x: reg_xmm) : GTot quad32 =
false
null
false
eval_reg_xmm x s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "sometrivial" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.Machine_s.reg_xmm", "Vale.X64.State.eval_reg_xmm", "Vale.X64.Decls.quad32" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_eval_xmm (s: va_state) (x: reg_xmm) : GTot quad32
[]
Vale.X64.Decls.va_eval_xmm
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> x: Vale.X64.Machine_s.reg_xmm -> Prims.GTot Vale.X64.Decls.quad32
{ "end_col": 112, "end_line": 231, "start_col": 96, "start_line": 231 }
Prims.Tot
val va_eval_heaplet (s: va_state) (h: heaplet_id) : vale_heap
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s
val va_eval_heaplet (s: va_state) (h: heaplet_id) : vale_heap let va_eval_heaplet (s: va_state) (h: heaplet_id) : vale_heap =
false
null
false
va_get_mem_heaplet h s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Decls.va_state", "Vale.X64.Decls.heaplet_id", "Vale.X64.Decls.va_get_mem_heaplet", "Vale.X64.Decls.vale_heap" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_eval_heaplet (s: va_state) (h: heaplet_id) : vale_heap
[]
Vale.X64.Decls.va_eval_heaplet
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Vale.X64.Decls.va_state -> h: Vale.X64.Decls.heaplet_id -> Vale.X64.Decls.vale_heap
{ "end_col": 103, "end_line": 233, "start_col": 81, "start_line": 233 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let cmp_operand = o:operand64{not (OMem? o)}
let cmp_operand =
false
null
false
o: operand64{not (OMem? o)}
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.operand64", "Prims.b2t", "Prims.op_Negation", "Vale.X64.Machine_s.uu___is_OMem", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.reg_64" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64
false
true
Vale.X64.Decls.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 cmp_operand : Type0
[]
Vale.X64.Decls.cmp_operand
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 51, "end_line": 78, "start_col": 25, "start_line": 78 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s
let va_is_dst_dst_opr64 (o: operand64) (s: va_state) =
false
null
false
va_is_dst_opr64 o s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.operand64", "Vale.X64.Decls.va_state", "Vale.X64.Decls.va_is_dst_opr64", "Prims.bool" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_is_dst_dst_opr64 : o: Vale.X64.Machine_s.operand64 -> s: Vale.X64.Decls.va_state -> Prims.bool
[]
Vale.X64.Decls.va_is_dst_dst_opr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
o: Vale.X64.Machine_s.operand64 -> s: Vale.X64.Decls.va_state -> Prims.bool
{ "end_col": 91, "end_line": 238, "start_col": 72, "start_line": 238 }
Prims.Tot
val total_thunk_if (#a: Type) (b: bool) (x: (_: unit{b} -> a)) (y: (_: unit{~b} -> a)) : a
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y ()
val total_thunk_if (#a: Type) (b: bool) (x: (_: unit{b} -> a)) (y: (_: unit{~b} -> a)) : a let total_thunk_if (#a: Type) (b: bool) (x: (_: unit{b} -> a)) (y: (_: unit{~b} -> a)) : a =
false
null
false
if b then x () else y ()
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Prims.bool", "Prims.unit", "Prims.b2t", "Prims.l_not" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y
false
false
Vale.X64.Decls.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 total_thunk_if (#a: Type) (b: bool) (x: (_: unit{b} -> a)) (y: (_: unit{~b} -> a)) : a
[]
Vale.X64.Decls.total_thunk_if
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b: Prims.bool -> x: (_: Prims.unit{b} -> a) -> y: (_: Prims.unit{~b} -> a) -> a
{ "end_col": 26, "end_line": 60, "start_col": 2, "start_line": 60 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_is_dst_xmm (x:reg_xmm) (s:va_state) = True
let va_is_dst_xmm (x: reg_xmm) (s: va_state) =
false
null
false
True
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.reg_xmm", "Vale.X64.Decls.va_state", "Prims.l_True", "Prims.logical" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o))
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_is_dst_xmm : x: Vale.X64.Machine_s.reg_xmm -> s: Vale.X64.Decls.va_state -> Prims.logical
[]
Vale.X64.Decls.va_is_dst_xmm
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.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 -> s: Vale.X64.Decls.va_state -> Prims.logical
{ "end_col": 68, "end_line": 243, "start_col": 64, "start_line": 243 }
Prims.Ghost
val va_tl (cs: va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs)
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs
val va_tl (cs: va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) let va_tl (cs: va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) =
false
null
false
Cons?.tl cs
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[]
[ "Vale.X64.Decls.va_codes", "Prims.__proj__Cons__item__tl", "Vale.X64.Decls.va_code", "Prims.b2t", "Prims.uu___is_Cons", "Prims.eq2", "Prims.list" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp
false
false
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_tl (cs: va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs)
[]
Vale.X64.Decls.va_tl
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Vale.X64.Decls.va_codes -> Prims.Ghost Vale.X64.Decls.va_codes
{ "end_col": 112, "end_line": 70, "start_col": 101, "start_line": 70 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s
let va_is_src_opr64 (o: operand64) (s: va_state) =
false
null
false
valid_operand o s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.operand64", "Vale.X64.Decls.va_state", "Vale.X64.Decls.valid_operand", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_is_src_opr64 : o: Vale.X64.Machine_s.operand64 -> s: Vale.X64.Decls.va_state -> Vale.Def.Prop_s.prop0
[]
Vale.X64.Decls.va_is_src_opr64
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
o: Vale.X64.Machine_s.operand64 -> s: Vale.X64.Decls.va_state -> Vale.Def.Prop_s.prop0
{ "end_col": 85, "end_line": 236, "start_col": 68, "start_line": 236 }
Prims.Tot
[ { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "Vale.X64.Bytes_Code_s", "short_module": "BC" }, { "abbrev": true, "full_module": "Vale.X64.Print_s", "short_module": "P" }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.StateLemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": true, "full_module": "Vale.Lib.Map16", "short_module": "Map16" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "S" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "M" }, { "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_is_src_opr128 (o:operand128) (s:va_state) = valid_operand128 o s
let va_is_src_opr128 (o: operand128) (s: va_state) =
false
null
false
valid_operand128 o s
{ "checked_file": "Vale.X64.Decls.fsti.checked", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Flags.fsti.checked", "Vale.Lib.Map16.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Arch.HeapTypes_s.fst.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Decls.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.operand128", "Vale.X64.Decls.va_state", "Vale.X64.Decls.valid_operand128", "Vale.Def.Prop_s.prop0" ]
[]
module Vale.X64.Decls open FStar.Mul open Vale.Arch.HeapTypes_s open Vale.Arch.HeapImpl module M = Vale.X64.Memory module S = Vale.X64.Stack_i module Map16 = Vale.Lib.Map16 // This interface should hide all of Machine_Semantics_s. // (It should not refer to Machine_Semantics_s, directly or indirectly.) // It should not refer to StateLemmas, Lemmas, or Print_s, // because they refer to Machine_Semantics_s. // Stack_i, Memory, Regs, Flags and State are ok, because they do not refer to Machine_Semantics_s. open Vale.Def.Prop_s open Vale.X64.Machine_s open Vale.X64.State open Vale.Def.Types_s unfold let vale_heap = M.vale_heap unfold let vale_full_heap = M.vale_full_heap unfold let heaplet_id = M.heaplet_id unfold let quad32 = quad32 val cf (flags:Flags.t) : bool val overflow (flags:Flags.t) : bool val valid_cf (flags:Flags.t) : bool val valid_of (flags:Flags.t) : bool val updated_cf (new_flags:Flags.t) (new_cf:bool) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == new_cf /\ valid_cf new_flags) val updated_of (new_flags:Flags.t) (new_of:bool) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == new_of /\ valid_of new_flags) val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool (requires True) (ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) //unfold let va_subscript = Map.sel unfold let va_subscript (#a:eqtype) (#b:Type) (x:Map.t a b) (y:a) : Tot b = Map.sel x y unfold let va_update = Map.upd unfold let va_hd = Cons?.hd //unfold let va_tl = Cons?.tl // F* inlines "let ... = va_tl ..." more than we'd like; revised definition below suppresses this // REVIEW: reveal_opaque doesn't include zeta, so it fails for recursive functions [@va_qattr] unfold let va_reveal_eq (#ax:Type) (s:string) (x x':ax) = norm [zeta; delta_only [s]] #ax x == x' let va_reveal_opaque (s:string) = norm_spec [zeta; delta_only [s]] // hide 'if' so that x and y get fully normalized let va_if (#a:Type) (b:bool) (x:(_:unit{b}) -> GTot a) (y:(_:unit{~b}) -> GTot a) : GTot a = if b then x () else y () let total_if (#a:Type) (b:bool) (x y:a) : a = if b then x else y let total_thunk_if (#a:Type) (b:bool) (x:(_:unit{b}) -> a) (y:(_:unit{~b}) -> a) : a = if b then x () else y () (* Type aliases *) let va_int_at_least (k:int) = i:int{i >= k} let va_int_at_most (k:int) = i:int{i <= k} let va_int_range (k1 k2:int) = i:int{k1 <= i /\ i <= k2} val ins : Type0 val ocmp : eqtype unfold let va_code = precode ins ocmp unfold let va_codes = list va_code let va_tl (cs:va_codes) : Ghost va_codes (requires Cons? cs) (ensures fun tl -> tl == Cons?.tl cs) = Cons?.tl cs unfold let va_state = vale_state val va_fuel : Type0 unfold let va_operand_opr64 = operand64 let reg_operand = o:operand64{OReg? o} let va_operand_reg_opr64 = o:operand64{OReg? o} unfold let va_operand_dst_opr64 = operand64 unfold let va_operand_shift_amt64 = operand64 unfold let cmp_operand = o:operand64{not (OMem? o)} unfold let va_operand_xmm = reg_xmm unfold let va_operand_opr128 = operand128 unfold let va_operand_heaplet = heaplet_id val va_pbool : Type0 val va_ttrue (_:unit) : va_pbool val va_ffalse (reason:string) : va_pbool val va_pbool_and (x y:va_pbool) : va_pbool val get_reason (p:va_pbool) : option string noeq type va_transformation_result = { success : va_pbool; result : va_code; } unfold let va_get_success (r:va_transformation_result) : va_pbool = r.success unfold let va_get_result (r:va_transformation_result) : va_code = r.result val mul_nat_helper (x y:nat) : Lemma (x * y >= 0) [@va_qattr] unfold let va_mul_nat (x y:nat) : nat = mul_nat_helper x y; x * y [@va_qattr] unfold let va_expand_state (s:vale_state) : vale_state = state_eta s unfold let get_reg (o:reg_operand) : reg = Reg 0 (OReg?.r o) unfold let buffer_readable (#t:M.base_typ) (h:vale_heap) (b:M.buffer t) : GTot prop0 = M.buffer_readable #t h b unfold let buffer_writeable (#t:M.base_typ) (b:M.buffer t) : GTot prop0 = M.buffer_writeable #t b unfold let buffer_length (#t:M.base_typ) (b:M.buffer t) = M.buffer_length #t b unfold let buffer8_as_seq (m:vale_heap) (b:M.buffer8) : GTot (Seq.seq nat8) = M.buffer_as_seq m b unfold let buffer64_as_seq (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = M.buffer_as_seq m b unfold let s64 (m:vale_heap) (b:M.buffer64) : GTot (Seq.seq nat64) = buffer64_as_seq m b unfold let buffer128_as_seq (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = M.buffer_as_seq m b unfold let s128 (m:vale_heap) (b:M.buffer128) : GTot (Seq.seq quad32) = buffer128_as_seq m b unfold let valid_src_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_read m b i unfold let valid_dst_addr (#t:M.base_typ) (m:vale_heap) (b:M.buffer t) (i:int) : prop0 = M.valid_buffer_write m b i unfold let buffer64_read (b:M.buffer64) (i:int) (h:vale_heap) : GTot nat64 = M.buffer_read b i h unfold let buffer128_read (b:M.buffer128) (i:int) (h:vale_heap) : GTot quad32 = M.buffer_read b i h unfold let modifies_mem (s:M.loc) (h1 h2:vale_heap) : GTot prop0 = M.modifies s h1 h2 unfold let loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b unfold let locs_disjoint = M.locs_disjoint unfold let loc_union = M.loc_union let valid_buf_maddr64 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer64) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf64 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 8 * index let valid_buf_maddr128 (addr:int) (s_mem:vale_heap) (layout:vale_heap_layout) (b:M.buffer128) (index:int) (t:taint) : prop0 = valid_src_addr s_mem b index /\ M.valid_taint_buf128 b s_mem layout.vl_taint t /\ addr == M.buffer_addr b s_mem + 16 * index let valid_mem_operand64 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer64) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr64 addr s_mem layout b index t let valid_mem_operand128 (addr:int) (t:taint) (s_mem:vale_heap) (layout:vale_heap_layout) : prop0 = exists (b:M.buffer128) (index:int).{:pattern (M.valid_buffer_read s_mem b index)} valid_buf_maddr128 addr s_mem layout b index t [@va_qattr] let valid_operand (o:operand64) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand o s /\ ( match o with | OMem (m, t) -> valid_mem_operand64 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) [@va_qattr] let valid_operand128 (o:operand128) (s:vale_state) : prop0 = Vale.X64.State.valid_src_operand128 o s /\ ( match o with | OMem (m, t) -> valid_mem_operand128 (eval_maddr m s) t (M.get_vale_heap s.vs_heap) s.vs_heap.vf_layout | OStack (m, t) -> S.valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint | _ -> True ) (* Constructors *) val va_fuel_default : unit -> va_fuel [@va_qattr] unfold let va_op_xmm_xmm (x:reg_xmm) : va_operand_xmm = x [@va_qattr] unfold let va_op_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_reg64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_const_opr64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_const_shift_amt64 (n:nat64) : operand64 = OConst n [@va_qattr] unfold let va_op_shift_amt64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r [@va_qattr] unfold let va_const_cmp (n:nat64) : cmp_operand = OConst n [@va_qattr] unfold let va_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r [@va_qattr] unfold let va_coerce_reg_opr64_to_dst_opr64 (o:va_operand_reg_opr64) : va_operand_dst_opr64 = o [@va_qattr] unfold let va_coerce_reg_opr64_to_opr64 (o:va_operand_reg_opr64) : va_operand_opr64 = o [@va_qattr] unfold let va_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o [@va_qattr] unfold let va_op_reg_opr64_reg64 (r:reg_64) : reg_operand = OReg r [@va_qattr] unfold let va_op_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r [@va_qattr] unfold let va_coerce_dst_opr64_to_opr64 (o:operand64) : operand64 = o [@va_qattr] unfold let va_coerce_xmm_to_opr128 (x:reg_xmm) : operand128 = OReg x [@va_qattr] unfold let va_op_heaplet_mem_heaplet (h:heaplet_id) : heaplet_id = h [@va_qattr] unfold let va_opr_code_Mem64 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) [@va_qattr] unfold let va_opr_code_Stack (o:operand64) (offset:int) (t:taint) : operand64 = match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, t) [@va_qattr] unfold let va_opr_code_Mem128 (h:heaplet_id) (o:operand64) (offset:int) (t:taint) : operand128 = match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, t) val taint_at (memTaint:M.memtaint) (addr:int) : taint (* Getters *) [@va_qattr] unfold let va_get_ok (s:va_state) : bool = s.vs_ok [@va_qattr] unfold let va_get_flags (s:va_state) : Flags.t = s.vs_flags [@va_qattr] unfold let va_get_reg64 (r:reg_64) (s:va_state) : nat64 = eval_reg_64 r s [@va_qattr] unfold let va_get_xmm (x:reg_xmm) (s:va_state) : quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_get_mem (s:va_state) : vale_heap = M.get_vale_heap s.vs_heap [@va_qattr] unfold let va_get_mem_layout (s:va_state) : vale_heap_layout = s.vs_heap.vf_layout [@va_qattr] unfold let va_get_mem_heaplet (n:heaplet_id) (s:va_state) : vale_heap = Map16.sel s.vs_heap.vf_heaplets n [@va_qattr] unfold let va_get_stack (s:va_state) : S.vale_stack = s.vs_stack [@va_qattr] unfold let va_get_stackTaint (s:va_state) : M.memtaint = s.vs_stackTaint [@va_qattr] let va_upd_ok (ok:bool) (s:vale_state) : vale_state = { s with vs_ok = ok } [@va_qattr] let va_upd_flags (flags:Flags.t) (s:vale_state) : vale_state = { s with vs_flags = flags } [@va_qattr] let upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s [@va_qattr] let va_upd_reg64 (r:reg_64) (v:nat64) (s:vale_state) : vale_state = update_reg_64 r v s [@va_qattr] let va_upd_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s [@va_qattr] let va_upd_mem (mem:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = M.set_vale_heap s.vs_heap mem } [@va_qattr] let va_upd_mem_layout (layout:vale_heap_layout) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_layout = layout } } [@va_qattr] let va_upd_mem_heaplet (n:heaplet_id) (h:vale_heap) (s:vale_state) : vale_state = { s with vs_heap = { s.vs_heap with vf_heaplets = Map16.upd s.vs_heap.vf_heaplets n h } } [@va_qattr] let va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack } [@va_qattr] let va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint } (* Evaluation *) [@va_qattr] unfold let va_eval_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_dst_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_shift_amt64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_cmp_uint64 (s:va_state) (r:cmp_operand) : GTot nat64 = eval_operand r s //[@va_qattr] unfold let va_eval_reg64 (s:va_state) (r:va_register) : GTot nat64 = eval_reg_64 r s [@va_qattr] unfold let va_eval_reg_opr64 (s:va_state) (o:operand64) : GTot nat64 = eval_operand o s [@va_qattr] unfold let va_eval_xmm (s:va_state) (x:reg_xmm) : GTot quad32 = eval_reg_xmm x s [@va_qattr] unfold let va_eval_opr128 (s:va_state) (o:operand128) : GTot quad32 = eval_operand128 o s [@va_qattr] unfold let va_eval_heaplet (s:va_state) (h:heaplet_id) : vale_heap = va_get_mem_heaplet h s (* Predicates *) [@va_qattr] unfold let va_is_src_opr64 (o:operand64) (s:va_state) = valid_operand o s [@va_qattr] let va_is_dst_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false [@va_qattr] unfold let va_is_dst_dst_opr64 (o:operand64) (s:va_state) = va_is_dst_opr64 o s [@va_qattr] unfold let va_is_src_shift_amt64 (o:operand64) (s:va_state) = valid_operand o s /\ (va_eval_shift_amt64 s o) < 64 [@va_qattr] unfold let va_is_src_reg_opr64 (o:operand64) (s:va_state) = OReg? o [@va_qattr] unfold let va_is_dst_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o)) [@va_qattr] unfold let va_is_src_xmm (x:reg_xmm) (s:va_state) = True
false
true
Vale.X64.Decls.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_is_src_opr128 : o: Vale.X64.Machine_s.operand128 -> s: Vale.X64.Decls.va_state -> Vale.Def.Prop_s.prop0
[]
Vale.X64.Decls.va_is_src_opr128
{ "file_name": "vale/code/arch/x64/Vale.X64.Decls.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
o: Vale.X64.Machine_s.operand128 -> s: Vale.X64.Decls.va_state -> Vale.Def.Prop_s.prop0
{ "end_col": 90, "end_line": 244, "start_col": 70, "start_line": 244 }