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_dst_opr128 (o:operand128) (s:va_state) = valid_operand128 o s
let va_is_dst_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 [@va_qattr] unfold let va_is_dst_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_dst_opr128 : o: Vale.X64.Machine_s.operand128 -> s: Vale.X64.Decls.va_state -> Vale.Def.Prop_s.prop0
[]
Vale.X64.Decls.va_is_dst_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": 245, "start_col": 70, "start_line": 245 }
Prims.Tot
val valid_operand (o: operand64) (s: vale_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 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 )
val valid_operand (o: operand64) (s: vale_state) : prop0 let valid_operand (o: operand64) (s: vale_state) : prop0 =
false
null
false
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)
{ "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.State.vale_state", "Prims.l_and", "Vale.X64.State.valid_src_operand", "Vale.X64.Machine_s.maddr", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Decls.valid_mem_operand64", "Vale.X64.State.eval_maddr", "Vale.X64.Memory.get_vale_heap", "Vale.X64.State.__proj__Mkvale_state__item__vs_heap", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout", "Vale.X64.Stack_i.valid_taint_stack64", "Vale.X64.State.__proj__Mkvale_state__item__vs_stackTaint", "Vale.X64.Machine_s.operand", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.reg_64", "Prims.l_True", "Prims.logical", "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]
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_operand (o: operand64) (s: vale_state) : prop0
[]
Vale.X64.Decls.valid_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" }
o: Vale.X64.Machine_s.operand64 -> s: Vale.X64.State.vale_state -> Vale.Def.Prop_s.prop0
{ "end_col": 3, "end_line": 147, "start_col": 2, "start_line": 142 }
Prims.Tot
val valid_operand128 (o: operand128) (s: vale_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 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 )
val valid_operand128 (o: operand128) (s: vale_state) : prop0 let valid_operand128 (o: operand128) (s: vale_state) : prop0 =
false
null
false
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)
{ "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.State.vale_state", "Prims.l_and", "Vale.X64.State.valid_src_operand128", "Vale.X64.Machine_s.maddr", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Decls.valid_mem_operand128", "Vale.X64.State.eval_maddr", "Vale.X64.Memory.get_vale_heap", "Vale.X64.State.__proj__Mkvale_state__item__vs_heap", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout", "Vale.X64.Stack_i.valid_taint_stack128", "Vale.X64.State.__proj__Mkvale_state__item__vs_stackTaint", "Vale.X64.Machine_s.operand", "Vale.X64.Machine_s.quad32", "Vale.X64.Machine_s.reg_xmm", "Prims.l_True", "Prims.logical", "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]
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_operand128 (o: operand128) (s: vale_state) : prop0
[]
Vale.X64.Decls.valid_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" }
o: Vale.X64.Machine_s.operand128 -> s: Vale.X64.State.vale_state -> Vale.Def.Prop_s.prop0
{ "end_col": 3, "end_line": 156, "start_col": 2, "start_line": 151 }
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_heaplet (h:heaplet_id) (s:va_state) = True
let va_is_src_heaplet (h: heaplet_id) (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.Decls.heaplet_id", "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)) [@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
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_heaplet : h: Vale.X64.Decls.heaplet_id -> s: Vale.X64.Decls.va_state -> Prims.logical
[]
Vale.X64.Decls.va_is_src_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 -> s: Vale.X64.Decls.va_state -> Prims.logical
{ "end_col": 75, "end_line": 246, "start_col": 71, "start_line": 246 }
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_heaplet (h:heaplet_id) (s:va_state) = True
let va_is_dst_heaplet (h: heaplet_id) (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.Decls.heaplet_id", "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)) [@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
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_heaplet : h: Vale.X64.Decls.heaplet_id -> s: Vale.X64.Decls.va_state -> Prims.logical
[]
Vale.X64.Decls.va_is_dst_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 -> s: Vale.X64.Decls.va_state -> Prims.logical
{ "end_col": 75, "end_line": 247, "start_col": 71, "start_line": 247 }
Prims.Tot
val va_op_opr64_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_opr64_reg64 (r:reg_64) : operand64 = OReg r
val va_op_opr64_reg64 (r: reg_64) : operand64 let va_op_opr64_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
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_opr64_reg64 (r: reg_64) : operand64
[]
Vale.X64.Decls.va_op_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.Machine_s.operand64
{ "end_col": 72, "end_line": 161, "start_col": 66, "start_line": 161 }
Prims.Tot
val va_update_flags (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_flags (sM:va_state) (sK:va_state) : va_state = va_upd_flags sM.vs_flags sK
val va_update_flags (sM sK: va_state) : va_state let va_update_flags (sM sK: va_state) : va_state =
false
null
false
va_upd_flags sM.vs_flags 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_flags", "Vale.X64.State.__proj__Mkvale_state__item__vs_flags" ]
[]
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 *)
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_flags (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_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" }
sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 107, "end_line": 251, "start_col": 80, "start_line": 251 }
Prims.Tot
val va_update_reg64 (r: reg_64) (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_reg64 (r:reg_64) (sM:va_state) (sK:va_state) : va_state = va_upd_reg64 r (eval_reg_64 r sM) sK
val va_update_reg64 (r: reg_64) (sM sK: va_state) : va_state let va_update_reg64 (r: reg_64) (sM sK: va_state) : va_state =
false
null
false
va_upd_reg64 r (eval_reg_64 r 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.Machine_s.reg_64", "Vale.X64.Decls.va_state", "Vale.X64.Decls.va_upd_reg64", "Vale.X64.State.eval_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 } [@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
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_reg64 (r: reg_64) (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_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 -> sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 38, "end_line": 255, "start_col": 2, "start_line": 255 }
Prims.Tot
val update_register (r: reg) (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 update_register (r:reg) (sM:va_state) (sK:va_state) : va_state = upd_register r (eval_reg r sM) sK
val update_register (r: reg) (sM sK: va_state) : va_state let update_register (r: reg) (sM sK: va_state) : va_state =
false
null
false
upd_register r (eval_reg r 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.Machine_s.reg", "Vale.X64.Decls.va_state", "Vale.X64.Decls.upd_register", "Vale.X64.State.eval_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 } [@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
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 update_register (r: reg) (sM sK: va_state) : va_state
[]
Vale.X64.Decls.update_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 -> sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 35, "end_line": 253, "start_col": 2, "start_line": 253 }
Prims.Tot
val va_op_reg64_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_reg64_reg64 (r:reg_64) : operand64 = OReg r
val va_op_reg64_reg64 (r: reg_64) : operand64 let va_op_reg64_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
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_reg64_reg64 (r: reg_64) : operand64
[]
Vale.X64.Decls.va_op_reg64_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": 72, "end_line": 162, "start_col": 66, "start_line": 162 }
Prims.Tot
val va_const_opr64 (n: nat64) : 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_const_opr64 (n:nat64) : operand64 = OConst n
val va_const_opr64 (n: nat64) : operand64 let va_const_opr64 (n: nat64) : operand64 =
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.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
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_opr64 (n: nat64) : operand64
[]
Vale.X64.Decls.va_const_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" }
n: Vale.Def.Types_s.nat64 -> Vale.X64.Machine_s.operand64
{ "end_col": 70, "end_line": 164, "start_col": 62, "start_line": 164 }
Prims.Tot
val va_update_mem_heaplet (n: 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_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
val va_update_mem_heaplet (n: heaplet_id) (sM sK: va_state) : va_state let va_update_mem_heaplet (n: heaplet_id) (sM sK: va_state) : va_state =
false
null
false
va_upd_mem_heaplet n (Map16.sel sM.vs_heap.vf_heaplets n) 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_upd_mem_heaplet", "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" ]
[]
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
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_mem_heaplet (n: heaplet_id) (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_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 -> sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 62, "end_line": 261, "start_col": 2, "start_line": 261 }
Prims.Tot
val va_update_mem_layout (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_mem_layout (sM:va_state) (sK:va_state) : va_state = va_upd_mem_layout sM.vs_heap.vf_layout sK
val va_update_mem_layout (sM sK: va_state) : va_state let va_update_mem_layout (sM sK: va_state) : va_state =
false
null
false
va_upd_mem_layout sM.vs_heap.vf_layout 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_mem_layout", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout", "Vale.X64.State.__proj__Mkvale_state__item__vs_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 [@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
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_mem_layout (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_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" }
sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 126, "end_line": 259, "start_col": 85, "start_line": 259 }
Prims.Tot
val update_dst_operand (o: operand64) (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 update_dst_operand (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_operand o sM sK
val update_dst_operand (o: operand64) (sM sK: va_state) : va_state let update_dst_operand (o: operand64) (sM sK: va_state) : va_state =
false
null
false
update_operand o 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.Machine_s.operand64", "Vale.X64.Decls.va_state", "Vale.X64.Decls.update_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 [@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
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 update_dst_operand (o: operand64) (sM sK: va_state) : va_state
[]
Vale.X64.Decls.update_dst_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" }
o: Vale.X64.Machine_s.operand64 -> sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 24, "end_line": 275, "start_col": 2, "start_line": 275 }
Prims.Tot
val va_update_xmm (x: reg_xmm) (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_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = va_upd_xmm x (eval_reg_xmm x sM) sK
val va_update_xmm (x: reg_xmm) (sM sK: va_state) : va_state let va_update_xmm (x: reg_xmm) (sM sK: va_state) : va_state =
false
null
false
va_upd_xmm x (eval_reg_xmm x 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.Machine_s.reg_xmm", "Vale.X64.Decls.va_state", "Vale.X64.Decls.va_upd_xmm", "Vale.X64.State.eval_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 [@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
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_xmm (x: reg_xmm) (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_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 -> sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 37, "end_line": 257, "start_col": 2, "start_line": 257 }
Prims.Tot
val va_const_shift_amt64 (n: nat64) : 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_const_shift_amt64 (n:nat64) : operand64 = OConst n
val va_const_shift_amt64 (n: nat64) : operand64 let va_const_shift_amt64 (n: nat64) : operand64 =
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.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
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_shift_amt64 (n: nat64) : operand64
[]
Vale.X64.Decls.va_const_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" }
n: Vale.Def.Types_s.nat64 -> Vale.X64.Machine_s.operand64
{ "end_col": 76, "end_line": 165, "start_col": 68, "start_line": 165 }
Prims.Tot
val va_update_mem (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_mem (sM:va_state) (sK:va_state) : va_state = va_upd_mem sM.vs_heap.vf_heap sK
val va_update_mem (sM sK: va_state) : va_state let va_update_mem (sM sK: va_state) : va_state =
false
null
false
va_upd_mem sM.vs_heap.vf_heap 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_mem", "Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heap", "Vale.X64.State.__proj__Mkvale_state__item__vs_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 [@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 =
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_mem (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_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" }
sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 110, "end_line": 258, "start_col": 78, "start_line": 258 }
Prims.Tot
val va_op_opr128_xmm (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_op_opr128_xmm (x:reg_xmm) : operand128 = OReg x
val va_op_opr128_xmm (x: reg_xmm) : operand128 let va_op_opr128_xmm (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
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_opr128_xmm (x: reg_xmm) : operand128
[]
Vale.X64.Decls.va_op_opr128_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 -> Vale.X64.Machine_s.operand128
{ "end_col": 73, "end_line": 163, "start_col": 67, "start_line": 163 }
Prims.Tot
val va_update_operand_dst_opr64 (o: operand64) (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_dst_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK
val va_update_operand_dst_opr64 (o: operand64) (sM sK: va_state) : va_state let va_update_operand_dst_opr64 (o: operand64) (sM sK: va_state) : va_state =
false
null
false
update_dst_operand o 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.Machine_s.operand64", "Vale.X64.Decls.va_state", "Vale.X64.Decls.update_dst_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 [@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
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_dst_opr64 (o: operand64) (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_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" }
o: Vale.X64.Machine_s.operand64 -> sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 28, "end_line": 279, "start_col": 2, "start_line": 279 }
Prims.Tot
val va_update_operand_opr64 (o: operand64) (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_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK
val va_update_operand_opr64 (o: operand64) (sM sK: va_state) : va_state let va_update_operand_opr64 (o: operand64) (sM sK: va_state) : va_state =
false
null
false
update_dst_operand o 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.Machine_s.operand64", "Vale.X64.Decls.va_state", "Vale.X64.Decls.update_dst_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 [@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
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_opr64 (o: operand64) (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_operand_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 -> sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 28, "end_line": 283, "start_col": 2, "start_line": 283 }
Prims.Tot
val va_coerce_reg64_opr64_to_cmp (r: va_operand_reg_opr64) : 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_coerce_reg64_opr64_to_cmp (r:va_operand_reg_opr64) : cmp_operand = r
val va_coerce_reg64_opr64_to_cmp (r: va_operand_reg_opr64) : cmp_operand let va_coerce_reg64_opr64_to_cmp (r: va_operand_reg_opr64) : cmp_operand =
false
null
false
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.Decls.va_operand_reg_opr64", "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 [@va_qattr] unfold let va_op_cmp_reg64 (r:reg_64) : cmp_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_reg64_opr64_to_cmp (r: va_operand_reg_opr64) : cmp_operand
[]
Vale.X64.Decls.va_coerce_reg64_opr64_to_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" }
r: Vale.X64.Decls.va_operand_reg_opr64 -> Vale.X64.Decls.cmp_operand
{ "end_col": 94, "end_line": 169, "start_col": 93, "start_line": 169 }
Prims.Tot
val va_update_operand_reg_opr64 (o: operand64) (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_reg_opr64 (o:operand64) (sM:va_state) (sK:va_state) : va_state = update_dst_operand o sM sK
val va_update_operand_reg_opr64 (o: operand64) (sM sK: va_state) : va_state let va_update_operand_reg_opr64 (o: operand64) (sM sK: va_state) : va_state =
false
null
false
update_dst_operand o 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.Machine_s.operand64", "Vale.X64.Decls.va_state", "Vale.X64.Decls.update_dst_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 [@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
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_reg_opr64 (o: operand64) (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_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 -> sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 28, "end_line": 287, "start_col": 2, "start_line": 287 }
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_xmm = quad32
let va_value_xmm =
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.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 [@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
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_xmm : Prims.eqtype
[]
Vale.X64.Decls.va_value_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" }
Prims.eqtype
{ "end_col": 32, "end_line": 300, "start_col": 26, "start_line": 300 }
Prims.Tot
val va_update_operand_xmm (x: reg_xmm) (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_xmm (x:reg_xmm) (sM:va_state) (sK:va_state) : va_state = update_reg_xmm x (eval_reg_xmm x sM) sK
val va_update_operand_xmm (x: reg_xmm) (sM sK: va_state) : va_state let va_update_operand_xmm (x: reg_xmm) (sM sK: va_state) : va_state =
false
null
false
update_reg_xmm x (eval_reg_xmm x 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.Machine_s.reg_xmm", "Vale.X64.Decls.va_state", "Vale.X64.State.update_reg_xmm", "Vale.X64.State.eval_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 [@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
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_xmm (x: reg_xmm) (sM sK: va_state) : va_state
[]
Vale.X64.Decls.va_update_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" }
x: Vale.X64.Machine_s.reg_xmm -> sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 41, "end_line": 291, "start_col": 2, "start_line": 291 }
Prims.Tot
val va_op_cmp_reg64 (r: reg_64) : 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_op_cmp_reg64 (r:reg_64) : cmp_operand = OReg r
val va_op_cmp_reg64 (r: reg_64) : cmp_operand let va_op_cmp_reg64 (r: reg_64) : cmp_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.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
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_cmp_reg64 (r: reg_64) : cmp_operand
[]
Vale.X64.Decls.va_op_cmp_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.cmp_operand
{ "end_col": 72, "end_line": 167, "start_col": 66, "start_line": 167 }
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_heaplet = vale_heap
let va_value_heaplet =
false
null
false
vale_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.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 [@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
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_heaplet : Type
[]
Vale.X64.Decls.va_value_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" }
Type
{ "end_col": 39, "end_line": 301, "start_col": 30, "start_line": 301 }
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_dst_opr64 = nat64
let va_value_dst_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_dst_opr64 : Type0
[]
Vale.X64.Decls.va_value_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" }
Type0
{ "end_col": 37, "end_line": 298, "start_col": 32, "start_line": 298 }
Prims.Tot
val va_upd_operand_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_operand_xmm (x:reg_xmm) (v:quad32) (s:vale_state) : vale_state = update_reg_xmm x v s
val va_upd_operand_xmm (x: reg_xmm) (v: quad32) (s: vale_state) : vale_state let va_upd_operand_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 [@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]
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_xmm (x: reg_xmm) (v: quad32) (s: vale_state) : vale_state
[]
Vale.X64.Decls.va_upd_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" }
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": 22, "end_line": 305, "start_col": 2, "start_line": 305 }
Prims.Tot
val va_CNil: Prims.unit -> va_codes
[ { "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_CNil () : va_codes = []
val va_CNil: Prims.unit -> va_codes let va_CNil () : va_codes =
false
null
false
[]
{ "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.unit", "Prims.Nil", "Vale.X64.Decls.va_code", "Vale.X64.Decls.va_codes" ]
[]
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) ) = ()
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_CNil: Prims.unit -> va_codes
[]
Vale.X64.Decls.va_CNil
{ "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.unit -> Vale.X64.Decls.va_codes
{ "end_col": 49, "end_line": 335, "start_col": 47, "start_line": 335 }
Prims.Tot
val va_opr_code_Mem64 (h: heaplet_id) (o: operand64) (offset: int) (t: taint) : 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_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)
val va_opr_code_Mem64 (h: heaplet_id) (o: operand64) (offset: int) (t: taint) : operand64 let va_opr_code_Mem64 (h: heaplet_id) (o: operand64) (offset: int) (t: taint) : operand64 =
false
null
false
match o with | OConst n -> OMem (MConst (n + offset), t) | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, 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.Decls.heaplet_id", "Vale.X64.Machine_s.operand64", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.OMem", "Vale.X64.Machine_s.reg_64", "FStar.Pervasives.Native.Mktuple2", "Vale.X64.Machine_s.maddr", "Vale.X64.Machine_s.MConst", "Prims.op_Addition", "Vale.X64.Machine_s.MReg", "Vale.X64.Machine_s.Reg", "Vale.X64.Machine_s.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 [@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]
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_opr_code_Mem64 (h: heaplet_id) (o: operand64) (offset: int) (t: taint) : operand64
[]
Vale.X64.Decls.va_opr_code_Mem64
{ "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 -> o: Vale.X64.Machine_s.operand64 -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> Vale.X64.Machine_s.operand64
{ "end_col": 28, "end_line": 184, "start_col": 2, "start_line": 181 }
Prims.Tot
val va_coerce_opr64_to_cmp (o: operand64{not (OMem? o)}) : 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_coerce_opr64_to_cmp (o:operand64{not (OMem? o)}) : cmp_operand = o
val va_coerce_opr64_to_cmp (o: operand64{not (OMem? o)}) : cmp_operand let va_coerce_opr64_to_cmp (o: operand64{not (OMem? o)}) : cmp_operand =
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", "Prims.b2t", "Prims.op_Negation", "Vale.X64.Machine_s.uu___is_OMem", "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 [@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
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_coerce_opr64_to_cmp (o: operand64{not (OMem? o)}) : cmp_operand
[]
Vale.X64.Decls.va_coerce_opr64_to_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" }
o: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o)} -> Vale.X64.Decls.cmp_operand
{ "end_col": 92, "end_line": 172, "start_col": 91, "start_line": 172 }
Prims.Tot
val va_op_dst_opr64_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_dst_opr64_reg64 (r:reg_64) : operand64 = OReg r
val va_op_dst_opr64_reg64 (r: reg_64) : operand64 let va_op_dst_opr64_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 [@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
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_dst_opr64_reg64 (r: reg_64) : operand64
[]
Vale.X64.Decls.va_op_dst_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.Machine_s.operand64
{ "end_col": 76, "end_line": 174, "start_col": 70, "start_line": 174 }
Prims.Tot
val va_opr_code_Stack (o: operand64) (offset: int) (t: taint) : 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_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)
val va_opr_code_Stack (o: operand64) (offset: int) (t: taint) : operand64 let va_opr_code_Stack (o: operand64) (offset: int) (t: taint) : operand64 =
false
null
false
match o with | OConst n -> OStack (MConst (n + offset), t) | OReg r -> OStack (MReg (Reg 0 r) offset, t) | _ -> OStack (MConst 42, 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.Machine_s.operand64", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.OStack", "Vale.X64.Machine_s.reg_64", "FStar.Pervasives.Native.Mktuple2", "Vale.X64.Machine_s.maddr", "Vale.X64.Machine_s.MConst", "Prims.op_Addition", "Vale.X64.Machine_s.MReg", "Vale.X64.Machine_s.Reg", "Vale.X64.Machine_s.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 [@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]
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_opr_code_Stack (o: operand64) (offset: int) (t: taint) : operand64
[]
Vale.X64.Decls.va_opr_code_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" }
o: Vale.X64.Machine_s.operand64 -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> Vale.X64.Machine_s.operand64
{ "end_col": 30, "end_line": 191, "start_col": 2, "start_line": 188 }
Prims.Tot
val va_opr_code_Mem128 (h: heaplet_id) (o: operand64) (offset: int) (t: taint) : 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_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 va_opr_code_Mem128 (h: heaplet_id) (o: operand64) (offset: int) (t: taint) : operand128 let va_opr_code_Mem128 (h: heaplet_id) (o: operand64) (offset: int) (t: taint) : operand128 =
false
null
false
match o with | OReg r -> OMem (MReg (Reg 0 r) offset, t) | _ -> OMem (MConst 42, 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.Decls.heaplet_id", "Vale.X64.Machine_s.operand64", "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Machine_s.reg_64", "Vale.X64.Machine_s.OMem", "Vale.X64.Machine_s.quad32", "Vale.X64.Machine_s.reg_xmm", "FStar.Pervasives.Native.Mktuple2", "Vale.X64.Machine_s.maddr", "Vale.X64.Machine_s.MReg", "Vale.X64.Machine_s.Reg", "Vale.X64.Machine_s.operand", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.MConst", "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 [@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]
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_opr_code_Mem128 (h: heaplet_id) (o: operand64) (offset: int) (t: taint) : operand128
[]
Vale.X64.Decls.va_opr_code_Mem128
{ "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 -> o: Vale.X64.Machine_s.operand64 -> offset: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> Vale.X64.Machine_s.operand128
{ "end_col": 28, "end_line": 197, "start_col": 2, "start_line": 195 }
Prims.Tot
val va_Block (block: va_codes) : 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_Block (block:va_codes) : va_code = Block block
val va_Block (block: va_codes) : va_code let va_Block (block: va_codes) : va_code =
false
null
false
Block block
{ "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_codes", "Vale.X64.Machine_s.Block", "Vale.X64.Decls.ins", "Vale.X64.Decls.ocmp", "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; } 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
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_Block (block: va_codes) : va_code
[]
Vale.X64.Decls.va_Block
{ "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" }
block: Vale.X64.Decls.va_codes -> Vale.X64.Decls.va_code
{ "end_col": 60, "end_line": 339, "start_col": 49, "start_line": 339 }
Prims.Tot
val va_CCons (hd: va_code) (tl: va_codes) : va_codes
[ { "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_CCons (hd:va_code) (tl:va_codes) : va_codes = hd::tl
val va_CCons (hd: va_code) (tl: va_codes) : va_codes let va_CCons (hd: va_code) (tl: va_codes) : va_codes =
false
null
false
hd :: tl
{ "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_codes", "Prims.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 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 *)
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_CCons (hd: va_code) (tl: va_codes) : va_codes
[]
Vale.X64.Decls.va_CCons
{ "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" }
hd: Vale.X64.Decls.va_code -> tl: Vale.X64.Decls.va_codes -> Vale.X64.Decls.va_codes
{ "end_col": 78, "end_line": 336, "start_col": 72, "start_line": 336 }
Prims.Tot
val va_While (whileCond: ocmp) (whileBody: va_code) : 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_While (whileCond:ocmp) (whileBody:va_code) : va_code = While whileCond whileBody
val va_While (whileCond: ocmp) (whileBody: va_code) : va_code let va_While (whileCond: ocmp) (whileBody: va_code) : va_code =
false
null
false
While whileCond whileBody
{ "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.Machine_s.While", "Vale.X64.Decls.ins" ]
[]
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
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_While (whileCond: ocmp) (whileBody: va_code) : va_code
[]
Vale.X64.Decls.va_While
{ "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" }
whileCond: Vale.X64.Decls.ocmp -> whileBody: Vale.X64.Decls.va_code -> Vale.X64.Decls.va_code
{ "end_col": 94, "end_line": 341, "start_col": 69, "start_line": 341 }
Prims.Tot
val va_get_ifTrue (c: va_code{IfElse? c}) : 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_ifTrue (c:va_code{IfElse? c}) : va_code = IfElse?.ifTrue c
val va_get_ifTrue (c: va_code{IfElse? c}) : va_code let va_get_ifTrue (c: va_code{IfElse? c}) : va_code =
false
null
false
IfElse?.ifTrue 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__ifTrue" ]
[]
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
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_ifTrue (c: va_code{IfElse? c}) : va_code
[]
Vale.X64.Decls.va_get_ifTrue
{ "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.va_code
{ "end_col": 76, "end_line": 352, "start_col": 60, "start_line": 352 }
Prims.Tot
val va_IfElse (ifCond: ocmp) (ifTrue ifFalse: va_code) : 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_IfElse (ifCond:ocmp) (ifTrue:va_code) (ifFalse:va_code) : va_code = IfElse ifCond ifTrue ifFalse
val va_IfElse (ifCond: ocmp) (ifTrue ifFalse: va_code) : va_code let va_IfElse (ifCond: ocmp) (ifTrue ifFalse: va_code) : va_code =
false
null
false
IfElse ifCond ifTrue ifFalse
{ "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.Machine_s.IfElse", "Vale.X64.Decls.ins" ]
[]
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 *)
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_IfElse (ifCond: ocmp) (ifTrue ifFalse: va_code) : va_code
[]
Vale.X64.Decls.va_IfElse
{ "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" }
ifCond: Vale.X64.Decls.ocmp -> ifTrue: Vale.X64.Decls.va_code -> ifFalse: Vale.X64.Decls.va_code -> Vale.X64.Decls.va_code
{ "end_col": 110, "end_line": 340, "start_col": 82, "start_line": 340 }
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 (b:M.buffer64) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2
let modifies_buffer (b: M.buffer64) (h1 h2: vale_heap) =
false
null
false
modifies_mem (loc_buffer b) 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.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'
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 : b: 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
{ "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 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> Vale.Def.Prop_s.prop0
{ "end_col": 95, "end_line": 390, "start_col": 62, "start_line": 390 }
Prims.Tot
val va_get_block (c: va_code{Block? c}) : va_codes
[ { "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_block (c:va_code{Block? c}) : va_codes = Block?.block c
val va_get_block (c: va_code{Block? c}) : va_codes let va_get_block (c: va_code{Block? c}) : va_codes =
false
null
false
Block?.block 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_Block", "Vale.X64.Decls.ins", "Vale.X64.Decls.ocmp", "Vale.X64.Machine_s.__proj__Block__item__block", "Vale.X64.Decls.va_codes" ]
[]
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_block (c: va_code{Block? c}) : va_codes
[]
Vale.X64.Decls.va_get_block
{ "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{Block? c} -> Vale.X64.Decls.va_codes
{ "end_col": 73, "end_line": 350, "start_col": 59, "start_line": 350 }
Prims.Tot
val va_get_whileBody (c: va_code{While? c}) : 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_whileBody (c:va_code{While? c}) : va_code = While?.whileBody c
val va_get_whileBody (c: va_code{While? c}) : va_code let va_get_whileBody (c: va_code{While? c}) : va_code =
false
null
false
While?.whileBody 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__whileBody" ]
[]
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
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_whileBody (c: va_code{While? c}) : va_code
[]
Vale.X64.Decls.va_get_whileBody
{ "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.va_code
{ "end_col": 80, "end_line": 355, "start_col": 62, "start_line": 355 }
Prims.Tot
val va_get_ifFalse (c: va_code{IfElse? c}) : 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_ifFalse (c:va_code{IfElse? c}) : va_code = IfElse?.ifFalse c
val va_get_ifFalse (c: va_code{IfElse? c}) : va_code let va_get_ifFalse (c: va_code{IfElse? c}) : va_code =
false
null
false
IfElse?.ifFalse 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__ifFalse" ]
[]
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
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_ifFalse (c: va_code{IfElse? c}) : va_code
[]
Vale.X64.Decls.va_get_ifFalse
{ "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.va_code
{ "end_col": 78, "end_line": 353, "start_col": 61, "start_line": 353 }
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_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
let modifies_buffer_3 (b1 b2 b3: M.buffer64) (h1 h2: vale_heap) =
false
null
false
modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) 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 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
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_3 : b1: Vale.X64.Memory.buffer64 -> b2: Vale.X64.Memory.buffer64 -> b3: 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_3
{ "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 -> b3: Vale.X64.Memory.buffer64 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> Vale.Def.Prop_s.prop0
{ "end_col": 96, "end_line": 394, "start_col": 2, "start_line": 394 }
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_opr64 (o:operand64) (s:va_state) = match o with OReg r -> not (r = rRsp ) | _ -> false
let va_is_dst_opr64 (o: operand64) (s: va_state) =
false
null
false
match o with | OReg r -> not (r = rRsp) | _ -> false
{ "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.Machine_s.reg_64", "Prims.op_Negation", "Prims.op_Equality", "Vale.X64.Machine_s.rRsp", "Vale.X64.Machine_s.operand", "Vale.X64.Machine_s.nat64", "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 *)
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_opr64 : o: Vale.X64.Machine_s.operand64 -> s: Vale.X64.Decls.va_state -> Prims.bool
[]
Vale.X64.Decls.va_is_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": 112, "end_line": 237, "start_col": 61, "start_line": 237 }
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_reg_opr64 (o:operand64) (s:va_state) = OReg? o
let va_is_src_reg_opr64 (o: operand64) (s: va_state) =
false
null
false
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", "Vale.X64.Decls.va_state", "Vale.X64.Machine_s.uu___is_OReg", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.reg_64", "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 [@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
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_reg_opr64 : o: Vale.X64.Machine_s.operand64 -> s: Vale.X64.Decls.va_state -> Prims.bool
[]
Vale.X64.Decls.va_is_src_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 -> s: Vale.X64.Decls.va_state -> Prims.bool
{ "end_col": 79, "end_line": 240, "start_col": 72, "start_line": 240 }
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_reg_opr64 (o:operand64) (s:va_state) = OReg? o /\ not (rRsp = (OReg?.r o))
let va_is_dst_reg_opr64 (o: operand64) (s: va_state) =
false
null
false
OReg? o /\ not (rRsp = (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.Machine_s.operand64", "Vale.X64.Decls.va_state", "Prims.l_and", "Prims.b2t", "Vale.X64.Machine_s.uu___is_OReg", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.reg_64", "Prims.op_Negation", "Prims.op_Equality", "Vale.X64.Machine_s.rRsp", "Vale.X64.Machine_s.__proj__OReg__item__r", "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
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_reg_opr64 : o: Vale.X64.Machine_s.operand64 -> s: Vale.X64.Decls.va_state -> Prims.logical
[]
Vale.X64.Decls.va_is_dst_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 -> s: Vale.X64.Decls.va_state -> Prims.logical
{ "end_col": 107, "end_line": 241, "start_col": 72, "start_line": 241 }
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_buffer128 (b:M.buffer128) (h1 h2:vale_heap) = modifies_mem (loc_buffer b) h1 h2
let modifies_buffer128 (b: M.buffer128) (h1 h2: vale_heap) =
false
null
false
modifies_mem (loc_buffer b) 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.buffer128", "Vale.X64.Decls.vale_heap", "Vale.X64.Decls.modifies_mem", "Vale.X64.Decls.loc_buffer", "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 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) =
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_buffer128 : b: Vale.X64.Memory.buffer128 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> Vale.Def.Prop_s.prop0
[]
Vale.X64.Decls.modifies_buffer128
{ "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 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> Vale.Def.Prop_s.prop0
{ "end_col": 99, "end_line": 395, "start_col": 66, "start_line": 395 }
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_buffer128_2 (b1 b2:M.buffer128) (h1 h2:vale_heap) = modifies_mem (M.loc_union (loc_buffer b1) (loc_buffer b2)) h1 h2
let modifies_buffer128_2 (b1 b2: M.buffer128) (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.buffer128", "Vale.X64.Decls.vale_heap", "Vale.X64.Decls.modifies_mem", "Vale.X64.Memory.loc_union", "Vale.X64.Decls.loc_buffer", "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 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
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_buffer128_2 : b1: Vale.X64.Memory.buffer128 -> b2: Vale.X64.Memory.buffer128 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> Vale.Def.Prop_s.prop0
[]
Vale.X64.Decls.modifies_buffer128_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.buffer128 -> b2: Vale.X64.Memory.buffer128 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> Vale.Def.Prop_s.prop0
{ "end_col": 66, "end_line": 397, "start_col": 2, "start_line": 397 }
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_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 modifies_buffer128_3 (b1 b2 b3: M.buffer128) (h1 h2: vale_heap) =
false
null
false
modifies_mem (M.loc_union (loc_buffer b1) (M.loc_union (loc_buffer b2) (loc_buffer b3))) 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.buffer128", "Vale.X64.Decls.vale_heap", "Vale.X64.Decls.modifies_mem", "Vale.X64.Memory.loc_union", "Vale.X64.Decls.loc_buffer", "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 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
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_buffer128_3 : b1: Vale.X64.Memory.buffer128 -> b2: Vale.X64.Memory.buffer128 -> b3: Vale.X64.Memory.buffer128 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> Vale.Def.Prop_s.prop0
[]
Vale.X64.Decls.modifies_buffer128_3
{ "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 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> Vale.Def.Prop_s.prop0
{ "end_col": 96, "end_line": 399, "start_col": 2, "start_line": 399 }
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 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 validSrcAddrs (#t: base_typ) (h: vale_heap) (addr: int) (b: M.buffer t) (len: int) (layout: vale_heap_layout) (tn: taint) =
false
null
false
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
{ "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", "Prims.int", "Vale.X64.Memory.buffer", "Vale.Arch.HeapImpl.vale_heap_layout", "Vale.Arch.HeapTypes_s.taint", "Prims.l_and", "Vale.X64.Decls.buffer_readable", "Prims.b2t", "Prims.op_LessThanOrEqual", "Vale.X64.Decls.buffer_length", "Prims.eq2", "Vale.X64.Memory.buffer_addr", "Vale.X64.Memory.valid_layout_buffer_id", "Vale.X64.Memory.get_heaplet_id", "Vale.X64.Memory.valid_taint_buf", "Vale.Arch.HeapImpl.__proj__Mkvale_heap_layout__item__vl_taint", "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)) [@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
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 validSrcAddrs : h: Vale.X64.Decls.vale_heap -> addr: Prims.int -> b: Vale.X64.Memory.buffer t -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
[]
Vale.X64.Decls.validSrcAddrs
{ "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 -> addr: Prims.int -> b: Vale.X64.Memory.buffer t -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
{ "end_col": 42, "end_line": 406, "start_col": 2, "start_line": 402 }
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 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 validDstAddrs (#t: base_typ) (h: vale_heap) (addr: int) (b: M.buffer t) (len: int) (layout: vale_heap_layout) (tn: taint) =
false
null
false
validSrcAddrs h addr b len layout tn /\ M.valid_layout_buffer_id t b layout (M.get_heaplet_id h) true /\ buffer_writeable 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" }
[ "total" ]
[ "Vale.Arch.HeapTypes_s.base_typ", "Vale.X64.Decls.vale_heap", "Prims.int", "Vale.X64.Memory.buffer", "Vale.Arch.HeapImpl.vale_heap_layout", "Vale.Arch.HeapTypes_s.taint", "Prims.l_and", "Vale.X64.Decls.validSrcAddrs", "Vale.X64.Memory.valid_layout_buffer_id", "Vale.X64.Memory.get_heaplet_id", "Vale.X64.Decls.buffer_writeable", "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)) [@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
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 validDstAddrs : h: Vale.X64.Decls.vale_heap -> addr: Prims.int -> b: Vale.X64.Memory.buffer t -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
[]
Vale.X64.Decls.validDstAddrs
{ "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 -> addr: Prims.int -> b: Vale.X64.Memory.buffer t -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
{ "end_col": 20, "end_line": 411, "start_col": 2, "start_line": 409 }
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 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 validSrcAddrs64 (h: vale_heap) (addr: int) (b: M.buffer64) (len: int) (layout: vale_heap_layout) (tn: taint) =
false
null
false
validSrcAddrs h addr b len layout tn
{ "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", "Prims.int", "Vale.X64.Memory.buffer64", "Vale.Arch.HeapImpl.vale_heap_layout", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Decls.validSrcAddrs", "Vale.X64.Memory.vuint64", "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)) [@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
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 validSrcAddrs64 : h: Vale.X64.Decls.vale_heap -> addr: Prims.int -> b: Vale.X64.Memory.buffer64 -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
[]
Vale.X64.Decls.validSrcAddrs64
{ "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 -> addr: Prims.int -> b: Vale.X64.Memory.buffer64 -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
{ "end_col": 38, "end_line": 414, "start_col": 2, "start_line": 414 }
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 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 validDstAddrs64 (h: vale_heap) (addr: int) (b: M.buffer64) (len: int) (layout: vale_heap_layout) (tn: taint) =
false
null
false
validDstAddrs h addr b len layout tn
{ "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", "Prims.int", "Vale.X64.Memory.buffer64", "Vale.Arch.HeapImpl.vale_heap_layout", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Decls.validDstAddrs", "Vale.X64.Memory.vuint64", "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)) [@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
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 validDstAddrs64 : h: Vale.X64.Decls.vale_heap -> addr: Prims.int -> b: Vale.X64.Memory.buffer64 -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
[]
Vale.X64.Decls.validDstAddrs64
{ "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 -> addr: Prims.int -> b: Vale.X64.Memory.buffer64 -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
{ "end_col": 38, "end_line": 417, "start_col": 2, "start_line": 417 }
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 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 validSrcAddrs128 (h: vale_heap) (addr: int) (b: M.buffer128) (len: int) (layout: vale_heap_layout) (tn: taint) =
false
null
false
validSrcAddrs h addr b len layout tn
{ "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", "Prims.int", "Vale.X64.Memory.buffer128", "Vale.Arch.HeapImpl.vale_heap_layout", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Decls.validSrcAddrs", "Vale.X64.Memory.vuint128", "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)) [@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
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 validSrcAddrs128 : h: Vale.X64.Decls.vale_heap -> addr: Prims.int -> b: Vale.X64.Memory.buffer128 -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
[]
Vale.X64.Decls.validSrcAddrs128
{ "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 -> addr: Prims.int -> b: Vale.X64.Memory.buffer128 -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
{ "end_col": 38, "end_line": 420, "start_col": 2, "start_line": 420 }
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 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 validDstAddrs128 (h: vale_heap) (addr: int) (b: M.buffer128) (len: int) (layout: vale_heap_layout) (tn: taint) =
false
null
false
validDstAddrs h addr b len layout tn
{ "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", "Prims.int", "Vale.X64.Memory.buffer128", "Vale.Arch.HeapImpl.vale_heap_layout", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Decls.validDstAddrs", "Vale.X64.Memory.vuint128", "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)) [@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
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 validDstAddrs128 : h: Vale.X64.Decls.vale_heap -> addr: Prims.int -> b: Vale.X64.Memory.buffer128 -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
[]
Vale.X64.Decls.validDstAddrs128
{ "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 -> addr: Prims.int -> b: Vale.X64.Memory.buffer128 -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
{ "end_col": 38, "end_line": 423, "start_col": 2, "start_line": 423 }
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 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 validSrcAddrsOffset128 (h: vale_heap) (addr: int) (b: M.buffer128) (offset len: int) (layout: vale_heap_layout) (tn: taint) =
false
null
false
validSrcAddrs h (addr - 16 * offset) b (len + offset) layout tn
{ "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", "Prims.int", "Vale.X64.Memory.buffer128", "Vale.Arch.HeapImpl.vale_heap_layout", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Decls.validSrcAddrs", "Vale.X64.Memory.vuint128", "Prims.op_Subtraction", "FStar.Mul.op_Star", "Prims.op_Addition", "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)) [@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
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 validSrcAddrsOffset128 : h: Vale.X64.Decls.vale_heap -> addr: Prims.int -> b: Vale.X64.Memory.buffer128 -> offset: Prims.int -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
[]
Vale.X64.Decls.validSrcAddrsOffset128
{ "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 -> addr: Prims.int -> b: Vale.X64.Memory.buffer128 -> offset: Prims.int -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
{ "end_col": 65, "end_line": 426, "start_col": 2, "start_line": 426 }
Prims.GTot
val buffer_modifies_specific128 (b: M.buffer128) (h1 h2: vale_heap) (start last: nat) : 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_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)
val buffer_modifies_specific128 (b: M.buffer128) (h1 h2: vale_heap) (start last: nat) : GTot prop0 let buffer_modifies_specific128 (b: M.buffer128) (h1 h2: vale_heap) (start last: nat) : GTot prop0 =
false
null
false
(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)
{ "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", "Vale.X64.Decls.vale_heap", "Prims.nat", "Prims.l_Forall", "Prims.l_imp", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Vale.X64.Decls.buffer_length", "Vale.X64.Memory.vuint128", "Prims.op_BarBar", "Prims.op_GreaterThan", "Prims.eq2", "Vale.X64.Decls.quad32", "Vale.X64.Decls.buffer128_read", "FStar.Seq.Base.index", "Vale.X64.Memory.base_typ_as_vale_type", "Vale.X64.Memory.buffer_as_seq", "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 =
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_modifies_specific128 (b: M.buffer128) (h1 h2: vale_heap) (start last: nat) : GTot prop0
[]
Vale.X64.Decls.buffer_modifies_specific128
{ "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 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> start: Prims.nat -> last: Prims.nat -> Prims.GTot Vale.Def.Prop_s.prop0
{ "end_col": 46, "end_line": 446, "start_col": 4, "start_line": 442 }
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 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 validDstAddrsOffset128 (h: vale_heap) (addr: int) (b: M.buffer128) (offset len: int) (layout: vale_heap_layout) (tn: taint) =
false
null
false
validDstAddrs h (addr - 16 * offset) b (len + offset) layout tn
{ "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", "Prims.int", "Vale.X64.Memory.buffer128", "Vale.Arch.HeapImpl.vale_heap_layout", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Decls.validDstAddrs", "Vale.X64.Memory.vuint128", "Prims.op_Subtraction", "FStar.Mul.op_Star", "Prims.op_Addition", "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)) [@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
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 validDstAddrsOffset128 : h: Vale.X64.Decls.vale_heap -> addr: Prims.int -> b: Vale.X64.Memory.buffer128 -> offset: Prims.int -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
[]
Vale.X64.Decls.validDstAddrsOffset128
{ "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 -> addr: Prims.int -> b: Vale.X64.Memory.buffer128 -> offset: Prims.int -> len: Prims.int -> layout: Vale.Arch.HeapImpl.vale_heap_layout -> tn: Vale.Arch.HeapTypes_s.taint -> Prims.logical
{ "end_col": 65, "end_line": 429, "start_col": 2, "start_line": 429 }
Prims.GTot
val modifies_buffer_specific128 (b: M.buffer128) (h1 h2: vale_heap) (start last: nat) : 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_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)
val modifies_buffer_specific128 (b: M.buffer128) (h1 h2: vale_heap) (start last: nat) : GTot prop0 let modifies_buffer_specific128 (b: M.buffer128) (h1 h2: vale_heap) (start last: nat) : GTot prop0 =
false
null
false
modifies_buffer128 b 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)
{ "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", "Vale.X64.Decls.vale_heap", "Prims.nat", "Prims.l_and", "Vale.X64.Decls.modifies_buffer128", "Prims.l_Forall", "Prims.l_imp", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Vale.X64.Decls.buffer_length", "Vale.X64.Memory.vuint128", "Prims.op_BarBar", "Prims.op_GreaterThan", "Prims.eq2", "Vale.X64.Decls.quad32", "Vale.X64.Decls.buffer128_read", "FStar.Seq.Base.index", "Vale.X64.Memory.base_typ_as_vale_type", "Vale.X64.Memory.buffer_as_seq", "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
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_buffer_specific128 (b: M.buffer128) (h1 h2: vale_heap) (start last: nat) : GTot prop0
[]
Vale.X64.Decls.modifies_buffer_specific128
{ "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 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> start: Prims.nat -> last: Prims.nat -> Prims.GTot Vale.Def.Prop_s.prop0
{ "end_col": 46, "end_line": 438, "start_col": 4, "start_line": 432 }
Prims.Tot
val state_inv (s: 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 state_inv (s:va_state) : prop0 = M.mem_inv s.vs_heap
val state_inv (s: va_state) : prop0 let state_inv (s: va_state) : prop0 =
false
null
false
M.mem_inv s.vs_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.Decls.va_state", "Vale.X64.Memory.mem_inv", "Vale.X64.State.__proj__Mkvale_state__item__vs_heap", "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
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 state_inv (s: va_state) : prop0
[]
Vale.X64.Decls.state_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" }
s: Vale.X64.Decls.va_state -> Vale.Def.Prop_s.prop0
{ "end_col": 56, "end_line": 481, "start_col": 37, "start_line": 481 }
Prims.GTot
val modifies_buffer_specific (b: M.buffer64) (h1 h2: vale_heap) (start last: nat) : 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_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)
val modifies_buffer_specific (b: M.buffer64) (h1 h2: vale_heap) (start last: nat) : GTot prop0 let modifies_buffer_specific (b: M.buffer64) (h1 h2: vale_heap) (start last: nat) : GTot prop0 =
false
null
false
modifies_buffer b 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)
{ "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", "Vale.X64.Decls.vale_heap", "Prims.nat", "Prims.l_and", "Vale.X64.Decls.modifies_buffer", "Prims.l_Forall", "Prims.l_imp", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Vale.X64.Decls.buffer_length", "Vale.X64.Memory.vuint64", "Prims.op_BarBar", "Prims.op_GreaterThan", "Prims.eq2", "Vale.Def.Types_s.nat64", "Vale.X64.Decls.buffer64_read", "FStar.Seq.Base.index", "Vale.X64.Memory.base_typ_as_vale_type", "Vale.X64.Memory.buffer_as_seq", "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)
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_buffer_specific (b: M.buffer64) (h1 h2: vale_heap) (start last: nat) : GTot prop0
[]
Vale.X64.Decls.modifies_buffer_specific
{ "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 -> h1: Vale.X64.Decls.vale_heap -> h2: Vale.X64.Decls.vale_heap -> start: Prims.nat -> last: Prims.nat -> Prims.GTot Vale.Def.Prop_s.prop0
{ "end_col": 45, "end_line": 455, "start_col": 4, "start_line": 449 }
Prims.Tot
val buffer_disjoints128 (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 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)
val buffer_disjoints128 (l: M.buffer128) (ls: list (M.buffer128)) : prop0 let buffer_disjoints128 (l: M.buffer128) (ls: list (M.buffer128)) : prop0 =
false
null
false
norm [zeta; iota; delta_only [`%loc_locs_disjoint_rec128]] (loc_locs_disjoint_rec128 l ls)
{ "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", "FStar.Pervasives.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.zeta", "FStar.Pervasives.iota", "FStar.Pervasives.delta_only", "Prims.string", "Prims.Nil", "Vale.Def.Prop_s.prop0", "Vale.X64.Decls.loc_locs_disjoint_rec128" ]
[]
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
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 buffer_disjoints128 (l: M.buffer128) (ls: list (M.buffer128)) : prop0
[]
Vale.X64.Decls.buffer_disjoints128
{ "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": 92, "end_line": 470, "start_col": 2, "start_line": 470 }
Prims.GTot
val va_evalCond (b: ocmp) (s: va_state) : GTot 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_evalCond (b:ocmp) (s:va_state) : GTot bool = eval_ocmp s b
val va_evalCond (b: ocmp) (s: va_state) : GTot bool let va_evalCond (b: ocmp) (s: va_state) : GTot bool =
false
null
false
eval_ocmp s 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.ocmp", "Vale.X64.Decls.va_state", "Vale.X64.Decls.eval_ocmp", "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 [@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
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_evalCond (b: ocmp) (s: va_state) : GTot bool
[]
Vale.X64.Decls.va_evalCond
{ "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 -> s: Vale.X64.Decls.va_state -> Prims.GTot Prims.bool
{ "end_col": 72, "end_line": 492, "start_col": 59, "start_line": 492 }
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 memTaint_type = Map.t int taint
let memTaint_type =
false
null
false
Map.t int taint
{ "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" ]
[ "FStar.Map.t", "Prims.int", "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] 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 ) 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_lemma_while_total (b:ocmp) (c:va_code) (s0:va_state) : Ghost (va_state & va_fuel) (requires True) (ensures fun (s1, f1) -> s1 == s0 /\ eval_while_inv (While b c) s1 f1 s1 ) val va_lemma_whileTrue_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel) (requires eval_ocmp sW b /\ valid_ocmp b sW) (ensures fun (s1, f1) -> s1 == {sW with vs_flags = havoc_flags} /\ f1 == fW) val va_lemma_whileFalse_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel) (requires valid_ocmp b sW /\ not (eval_ocmp sW b) /\ eval_while_inv (While b c) s0 fW sW ) (ensures fun (s1, f1) -> s1 == {sW with vs_flags = havoc_flags} /\ eval_code (While b c) s0 f1 s1 ) val va_lemma_whileMerge_total (c:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel (requires While? c /\ ( let cond = While?.whileCond c in sN.vs_ok /\ valid_ocmp cond sM /\ eval_ocmp sM cond /\ eval_while_inv c s0 f0 sM /\ eval_code (While?.whileBody c) ({sM with vs_flags = havoc_flags}) fM sN )) (ensures (fun fN -> eval_while_inv c s0 fN sN )) val printer : Type0 val print_string : string -> FStar.All.ML unit val print_header : printer -> FStar.All.ML unit val print_proc : (name:string) -> (code:va_code) -> (label:int) -> (p:printer) -> FStar.All.ML int val print_footer : printer -> FStar.All.ML unit val masm : printer val gcc : printer val gcc_linux : printer
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 memTaint_type : Type0
[]
Vale.X64.Decls.memTaint_type
{ "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": 652, "start_col": 27, "start_line": 652 }
Prims.Tot
val update_operand (o: operand64) (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 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
val update_operand (o: operand64) (sM sK: va_state) : va_state let update_operand (o: operand64) (sM sK: va_state) : va_state =
false
null
false
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
{ "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.Machine_s.nat64", "Vale.X64.Machine_s.reg_64", "Vale.X64.Decls.va_update_reg64", "Vale.X64.Machine_s.maddr", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Decls.va_update_mem", "Vale.X64.Decls.va_update_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 = 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]
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 update_operand (o: operand64) (sM sK: va_state) : va_state
[]
Vale.X64.Decls.update_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" }
o: Vale.X64.Machine_s.operand64 -> sM: Vale.X64.Decls.va_state -> sK: Vale.X64.Decls.va_state -> Vale.X64.Decls.va_state
{ "end_col": 42, "end_line": 271, "start_col": 2, "start_line": 267 }
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_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
let va_upd_operand_dst_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]
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_dst_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_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 -> v: Vale.Def.Types_s.nat64 -> s: Vale.X64.State.vale_state -> Vale.X64.State.vale_state
{ "end_col": 22, "end_line": 313, "start_col": 2, "start_line": 309 }
Prims.GTot
val buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l)
[ { "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 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'
val buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l) let rec buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l) =
false
null
false
match l with | [] -> True | b :: l' -> buffer_readable h b /\ buffers_readable h l'
{ "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", "Prims.list", "Vale.X64.Memory.buffer64", "Prims.l_True", "Prims.l_and", "Vale.X64.Decls.buffer_readable", "Vale.X64.Memory.vuint64", "Vale.X64.Decls.buffers_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 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 **)
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 buffers_readable (h: vale_heap) (l: list M.buffer64) : GTot prop0 (decreases l)
[ "recursion" ]
Vale.X64.Decls.buffers_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 -> l: Prims.list Vale.X64.Memory.buffer64 -> Prims.GTot Vale.Def.Prop_s.prop0
{ "end_col": 62, "end_line": 388, "start_col": 4, "start_line": 386 }
Prims.Tot
val max_one_mem (o1 o2: operand64) : 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 max_one_mem (o1 o2:operand64) : prop0 = match (o1, o2) with | (OMem _, OMem _) | (OMem _, OStack _) | (OStack _, OMem _) | (OStack _, OStack _) -> False | _ -> True
val max_one_mem (o1 o2: operand64) : prop0 let max_one_mem (o1 o2: operand64) : prop0 =
false
null
false
match (o1, o2) with | OMem _, OMem _ | OMem _, OStack _ | OStack _, OMem _ | OStack _, OStack _ -> 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.operand64", "FStar.Pervasives.Native.Mktuple2", "Vale.X64.Machine_s.operand", "Vale.X64.Machine_s.nat64", "Vale.X64.Machine_s.reg_64", "Vale.X64.Machine_s.tmaddr", "Prims.l_False", "FStar.Pervasives.Native.tuple2", "Prims.l_True", "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 ) 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_lemma_while_total (b:ocmp) (c:va_code) (s0:va_state) : Ghost (va_state & va_fuel) (requires True) (ensures fun (s1, f1) -> s1 == s0 /\ eval_while_inv (While b c) s1 f1 s1 ) val va_lemma_whileTrue_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel) (requires eval_ocmp sW b /\ valid_ocmp b sW) (ensures fun (s1, f1) -> s1 == {sW with vs_flags = havoc_flags} /\ f1 == fW) val va_lemma_whileFalse_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel) (requires valid_ocmp b sW /\ not (eval_ocmp sW b) /\ eval_while_inv (While b c) s0 fW sW ) (ensures fun (s1, f1) -> s1 == {sW with vs_flags = havoc_flags} /\ eval_code (While b c) s0 f1 s1 ) val va_lemma_whileMerge_total (c:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel (requires While? c /\ ( let cond = While?.whileCond c in sN.vs_ok /\ valid_ocmp cond sM /\ eval_ocmp sM cond /\ eval_while_inv c s0 f0 sM /\ eval_code (While?.whileBody c) ({sM with vs_flags = havoc_flags}) fM sN )) (ensures (fun fN -> eval_while_inv c s0 fN sN )) val printer : Type0 val print_string : string -> FStar.All.ML unit val print_header : printer -> FStar.All.ML unit val print_proc : (name:string) -> (code:va_code) -> (label:int) -> (p:printer) -> FStar.All.ML int val print_footer : printer -> FStar.All.ML unit val masm : printer val gcc : printer val gcc_linux : printer unfold let memTaint_type = Map.t int taint [@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 max_one_mem (o1 o2: operand64) : prop0
[]
Vale.X64.Decls.max_one_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" }
o1: Vale.X64.Machine_s.operand64 -> o2: Vale.X64.Machine_s.operand64 -> Vale.Def.Prop_s.prop0
{ "end_col": 13, "end_line": 658, "start_col": 2, "start_line": 656 }
FStar.Pervasives.Lemma
val poly1305_vec_lemma: #w:lanes -> msg:bytes -> k:S.key -> Lemma (poly1305_mac #w msg k == S.poly1305_mac msg k)
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let poly1305_vec_lemma #w msg k = let acc0, r = S.poly1305_init k in poly1305_update_vec_lemma #w msg acc0 r
val poly1305_vec_lemma: #w:lanes -> msg:bytes -> k:S.key -> Lemma (poly1305_mac #w msg k == S.poly1305_mac msg k) let poly1305_vec_lemma #w msg k =
false
null
true
let acc0, r = S.poly1305_init k in poly1305_update_vec_lemma #w msg acc0 r
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Vec.lanes", "Lib.ByteSequence.bytes", "Spec.Poly1305.key", "Spec.Poly1305.felem", "Hacl.Spec.Poly1305.Equiv.poly1305_update_vec_lemma", "Prims.unit", "FStar.Pervasives.Native.tuple2", "Spec.Poly1305.poly1305_init" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma2 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1 val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma4 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in FStar.Math.Lemmas.modulo_lemma c1 prime; FStar.Math.Lemmas.modulo_lemma c2 prime; FStar.Math.Lemmas.modulo_lemma c3 prime; let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3 val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma #w b acc0 r = match w with | 1 -> load_acc_lemma1 b acc0 r | 2 -> load_acc_lemma2 b acc0 r | 4 -> load_acc_lemma4 b acc0 r /// /// val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma /// (let rw = compute_rw r in /// normalize_n r (poly_update_nblocks #w rw b acc_v0) == /// repeat_blocks_multi size_block b (poly_update1 r) (normalize_n r acc_v0)) /// val poly_update_nblocks_lemma1: r:pfelem -> b:block_v 1 -> acc_v0:elem 1 -> Lemma (let rw = compute_rw #1 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma1 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val poly_update_nblocks_lemma2: r:pfelem -> b:block_v 2 -> acc_v0:elem 2 -> Lemma (let rw = compute_rw #2 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma2 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1; Lemmas.poly_update_repeat_blocks_multi_lemma2_simplify acc_v0.[0] acc_v0.[1] c0 c1 r val poly_update_nblocks_lemma4: r:pfelem -> b:block_v 4 -> acc_v0:elem 4 -> Lemma (let rw = compute_rw #4 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma4 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in let r2 = pfmul r r in let r4 = pfmul r2 r2 in let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_repeat_blocks_multi_lemma4_simplify acc_v0.[0] acc_v0.[1] acc_v0.[2] acc_v0.[3] c0 c1 c2 c3 r r2 r4 val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma #w r b acc_v0 = match w with | 1 -> poly_update_nblocks_lemma1 r b acc_v0 | 2 -> poly_update_nblocks_lemma2 r b acc_v0 | 4 -> poly_update_nblocks_lemma4 r b acc_v0 val repeat_blocks_multi_vec_equiv_pre_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in VecLemmas.repeat_blocks_multi_vec_equiv_pre w size_block f f_v (normalize_n r) b acc_v0) let repeat_blocks_multi_vec_equiv_pre_lemma #w r b acc_v0 = poly_update_nblocks_lemma #w r b acc_v0 val poly_update_multi_lemma_v: #w:lanes -> text:bytes{length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc_v0:elem w -> r:pfelem -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in normalize_n r (repeat_blocks_multi (w * size_block) text f_v acc_v0) == repeat_blocks_multi size_block text f (normalize_n r acc_v0)) let poly_update_multi_lemma_v #w text acc_v0 r = let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in Classical.forall_intro_2 (repeat_blocks_multi_vec_equiv_pre_lemma #w r); VecLemmas.lemma_repeat_blocks_multi_vec w size_block text f f_v (normalize_n r) acc_v0 val poly_update_multi_lemma: #w:lanes -> text:bytes{w * size_block <= length text /\ length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc0:pfelem -> r:pfelem -> Lemma (poly1305_update_multi #w text acc0 r == repeat_blocks_multi size_block text (S.poly1305_update1 r size_block) acc0) let poly_update_multi_lemma #w text acc0 r = let len = length text in let blocksize_v = w * size_block in let text0 = Seq.slice text 0 blocksize_v in let text1 = Seq.slice text blocksize_v len in FStar.Math.Lemmas.modulo_addition_lemma len blocksize_v (- 1); assert (length text1 % (w * size_block) = 0 /\ length text1 % size_block = 0); let f = S.poly1305_update1 r size_block in let acc_v0 = load_acc #w text0 acc0 in let rp = poly1305_update_multi #w text acc0 r in poly_update_multi_lemma_v #w text1 acc_v0 r; load_acc_lemma #w text0 acc0 r; SeqLemmas.repeat_blocks_multi_split size_block blocksize_v text f acc0 val poly1305_update_vec_lemma: #w:lanes -> text:bytes -> acc0:pfelem -> r:pfelem -> Lemma (poly1305_update #w text acc0 r == S.poly1305_update text acc0 r) let poly1305_update_vec_lemma #w text acc0 r = let len = length text in let blocksize_v = w * size_block in let len0 = len / blocksize_v * blocksize_v in FStar.Math.Lemmas.cancel_mul_mod (len / blocksize_v) blocksize_v; assert (len0 % blocksize_v = 0); assert (len0 % size_block = 0); let text0 = Seq.slice text 0 len0 in let f = S.poly1305_update1 r size_block in let l = S.poly1305_update_last r in if len0 > 0 then begin poly_update_multi_lemma #w text0 acc0 r; SeqLemmas.repeat_blocks_split size_block len0 text f l acc0 end val poly1305_vec_lemma: #w:lanes -> msg:bytes -> k:S.key -> Lemma (poly1305_mac #w msg k == S.poly1305_mac msg k)
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val poly1305_vec_lemma: #w:lanes -> msg:bytes -> k:S.key -> Lemma (poly1305_mac #w msg k == S.poly1305_mac msg k)
[]
Hacl.Spec.Poly1305.Equiv.poly1305_vec_lemma
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
msg: Lib.ByteSequence.bytes -> k: Spec.Poly1305.key -> FStar.Pervasives.Lemma (ensures Hacl.Spec.Poly1305.Vec.poly1305_mac msg k == Spec.Poly1305.poly1305_mac msg k)
{ "end_col": 41, "end_line": 279, "start_col": 33, "start_line": 277 }
Prims.Tot
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block)
let block_v (w: lanes{w * size_block <= max_size_t}) =
false
null
false
lbytes (w * size_block)
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "total" ]
[ "Hacl.Spec.Poly1305.Vec.lanes", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Hacl.Spec.Poly1305.Vec.size_block", "Lib.IntTypes.max_size_t", "Lib.ByteSequence.lbytes" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0"
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val block_v : w: Hacl.Spec.Poly1305.Vec.lanes{w * Hacl.Spec.Poly1305.Vec.size_block <= Lib.IntTypes.max_size_t} -> Type0
[]
Hacl.Spec.Poly1305.Equiv.block_v
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
w: Hacl.Spec.Poly1305.Vec.lanes{w * Hacl.Spec.Poly1305.Vec.size_block <= Lib.IntTypes.max_size_t} -> Type0
{ "end_col": 77, "end_line": 19, "start_col": 54, "start_line": 19 }
FStar.Pervasives.Lemma
val poly1305_update_vec_lemma: #w:lanes -> text:bytes -> acc0:pfelem -> r:pfelem -> Lemma (poly1305_update #w text acc0 r == S.poly1305_update text acc0 r)
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let poly1305_update_vec_lemma #w text acc0 r = let len = length text in let blocksize_v = w * size_block in let len0 = len / blocksize_v * blocksize_v in FStar.Math.Lemmas.cancel_mul_mod (len / blocksize_v) blocksize_v; assert (len0 % blocksize_v = 0); assert (len0 % size_block = 0); let text0 = Seq.slice text 0 len0 in let f = S.poly1305_update1 r size_block in let l = S.poly1305_update_last r in if len0 > 0 then begin poly_update_multi_lemma #w text0 acc0 r; SeqLemmas.repeat_blocks_split size_block len0 text f l acc0 end
val poly1305_update_vec_lemma: #w:lanes -> text:bytes -> acc0:pfelem -> r:pfelem -> Lemma (poly1305_update #w text acc0 r == S.poly1305_update text acc0 r) let poly1305_update_vec_lemma #w text acc0 r =
false
null
true
let len = length text in let blocksize_v = w * size_block in let len0 = (len / blocksize_v) * blocksize_v in FStar.Math.Lemmas.cancel_mul_mod (len / blocksize_v) blocksize_v; assert (len0 % blocksize_v = 0); assert (len0 % size_block = 0); let text0 = Seq.slice text 0 len0 in let f = S.poly1305_update1 r size_block in let l = S.poly1305_update_last r in if len0 > 0 then (poly_update_multi_lemma #w text0 acc0 r; SeqLemmas.repeat_blocks_split size_block len0 text f l acc0)
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Vec.lanes", "Lib.ByteSequence.bytes", "Hacl.Spec.Poly1305.Vec.pfelem", "Prims.op_GreaterThan", "Lib.Sequence.Lemmas.repeat_blocks_split", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Poly1305.felem", "Hacl.Spec.Poly1305.Vec.size_block", "Prims.unit", "Hacl.Spec.Poly1305.Equiv.poly_update_multi_lemma", "Prims.bool", "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Prims.op_LessThan", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Spec.Poly1305.poly1305_update_last", "Spec.Poly1305.poly1305_update1", "FStar.Seq.Base.seq", "FStar.Seq.Base.slice", "Prims._assert", "Prims.op_Equality", "Prims.int", "Prims.op_Modulus", "FStar.Math.Lemmas.cancel_mul_mod", "Prims.op_Division", "FStar.Mul.op_Star", "Lib.Sequence.length" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma2 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1 val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma4 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in FStar.Math.Lemmas.modulo_lemma c1 prime; FStar.Math.Lemmas.modulo_lemma c2 prime; FStar.Math.Lemmas.modulo_lemma c3 prime; let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3 val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma #w b acc0 r = match w with | 1 -> load_acc_lemma1 b acc0 r | 2 -> load_acc_lemma2 b acc0 r | 4 -> load_acc_lemma4 b acc0 r /// /// val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma /// (let rw = compute_rw r in /// normalize_n r (poly_update_nblocks #w rw b acc_v0) == /// repeat_blocks_multi size_block b (poly_update1 r) (normalize_n r acc_v0)) /// val poly_update_nblocks_lemma1: r:pfelem -> b:block_v 1 -> acc_v0:elem 1 -> Lemma (let rw = compute_rw #1 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma1 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val poly_update_nblocks_lemma2: r:pfelem -> b:block_v 2 -> acc_v0:elem 2 -> Lemma (let rw = compute_rw #2 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma2 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1; Lemmas.poly_update_repeat_blocks_multi_lemma2_simplify acc_v0.[0] acc_v0.[1] c0 c1 r val poly_update_nblocks_lemma4: r:pfelem -> b:block_v 4 -> acc_v0:elem 4 -> Lemma (let rw = compute_rw #4 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma4 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in let r2 = pfmul r r in let r4 = pfmul r2 r2 in let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_repeat_blocks_multi_lemma4_simplify acc_v0.[0] acc_v0.[1] acc_v0.[2] acc_v0.[3] c0 c1 c2 c3 r r2 r4 val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma #w r b acc_v0 = match w with | 1 -> poly_update_nblocks_lemma1 r b acc_v0 | 2 -> poly_update_nblocks_lemma2 r b acc_v0 | 4 -> poly_update_nblocks_lemma4 r b acc_v0 val repeat_blocks_multi_vec_equiv_pre_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in VecLemmas.repeat_blocks_multi_vec_equiv_pre w size_block f f_v (normalize_n r) b acc_v0) let repeat_blocks_multi_vec_equiv_pre_lemma #w r b acc_v0 = poly_update_nblocks_lemma #w r b acc_v0 val poly_update_multi_lemma_v: #w:lanes -> text:bytes{length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc_v0:elem w -> r:pfelem -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in normalize_n r (repeat_blocks_multi (w * size_block) text f_v acc_v0) == repeat_blocks_multi size_block text f (normalize_n r acc_v0)) let poly_update_multi_lemma_v #w text acc_v0 r = let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in Classical.forall_intro_2 (repeat_blocks_multi_vec_equiv_pre_lemma #w r); VecLemmas.lemma_repeat_blocks_multi_vec w size_block text f f_v (normalize_n r) acc_v0 val poly_update_multi_lemma: #w:lanes -> text:bytes{w * size_block <= length text /\ length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc0:pfelem -> r:pfelem -> Lemma (poly1305_update_multi #w text acc0 r == repeat_blocks_multi size_block text (S.poly1305_update1 r size_block) acc0) let poly_update_multi_lemma #w text acc0 r = let len = length text in let blocksize_v = w * size_block in let text0 = Seq.slice text 0 blocksize_v in let text1 = Seq.slice text blocksize_v len in FStar.Math.Lemmas.modulo_addition_lemma len blocksize_v (- 1); assert (length text1 % (w * size_block) = 0 /\ length text1 % size_block = 0); let f = S.poly1305_update1 r size_block in let acc_v0 = load_acc #w text0 acc0 in let rp = poly1305_update_multi #w text acc0 r in poly_update_multi_lemma_v #w text1 acc_v0 r; load_acc_lemma #w text0 acc0 r; SeqLemmas.repeat_blocks_multi_split size_block blocksize_v text f acc0 val poly1305_update_vec_lemma: #w:lanes -> text:bytes -> acc0:pfelem -> r:pfelem -> Lemma (poly1305_update #w text acc0 r == S.poly1305_update text acc0 r)
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val poly1305_update_vec_lemma: #w:lanes -> text:bytes -> acc0:pfelem -> r:pfelem -> Lemma (poly1305_update #w text acc0 r == S.poly1305_update text acc0 r)
[]
Hacl.Spec.Poly1305.Equiv.poly1305_update_vec_lemma
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
text: Lib.ByteSequence.bytes -> acc0: Hacl.Spec.Poly1305.Vec.pfelem -> r: Hacl.Spec.Poly1305.Vec.pfelem -> FStar.Pervasives.Lemma (ensures Hacl.Spec.Poly1305.Vec.poly1305_update text acc0 r == Spec.Poly1305.poly1305_update text acc0 r)
{ "end_col": 67, "end_line": 271, "start_col": 46, "start_line": 257 }
FStar.Pervasives.Lemma
val repeat_blocks_multi_vec_equiv_pre_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in VecLemmas.repeat_blocks_multi_vec_equiv_pre w size_block f f_v (normalize_n r) b acc_v0)
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let repeat_blocks_multi_vec_equiv_pre_lemma #w r b acc_v0 = poly_update_nblocks_lemma #w r b acc_v0
val repeat_blocks_multi_vec_equiv_pre_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in VecLemmas.repeat_blocks_multi_vec_equiv_pre w size_block f f_v (normalize_n r) b acc_v0) let repeat_blocks_multi_vec_equiv_pre_lemma #w r b acc_v0 =
false
null
true
poly_update_nblocks_lemma #w r b acc_v0
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Vec.lanes", "Hacl.Spec.Poly1305.Vec.pfelem", "Hacl.Spec.Poly1305.Equiv.block_v", "Hacl.Spec.Poly1305.Vec.elem", "Hacl.Spec.Poly1305.Equiv.poly_update_nblocks_lemma", "Prims.unit" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma2 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1 val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma4 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in FStar.Math.Lemmas.modulo_lemma c1 prime; FStar.Math.Lemmas.modulo_lemma c2 prime; FStar.Math.Lemmas.modulo_lemma c3 prime; let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3 val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma #w b acc0 r = match w with | 1 -> load_acc_lemma1 b acc0 r | 2 -> load_acc_lemma2 b acc0 r | 4 -> load_acc_lemma4 b acc0 r /// /// val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma /// (let rw = compute_rw r in /// normalize_n r (poly_update_nblocks #w rw b acc_v0) == /// repeat_blocks_multi size_block b (poly_update1 r) (normalize_n r acc_v0)) /// val poly_update_nblocks_lemma1: r:pfelem -> b:block_v 1 -> acc_v0:elem 1 -> Lemma (let rw = compute_rw #1 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma1 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val poly_update_nblocks_lemma2: r:pfelem -> b:block_v 2 -> acc_v0:elem 2 -> Lemma (let rw = compute_rw #2 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma2 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1; Lemmas.poly_update_repeat_blocks_multi_lemma2_simplify acc_v0.[0] acc_v0.[1] c0 c1 r val poly_update_nblocks_lemma4: r:pfelem -> b:block_v 4 -> acc_v0:elem 4 -> Lemma (let rw = compute_rw #4 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma4 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in let r2 = pfmul r r in let r4 = pfmul r2 r2 in let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_repeat_blocks_multi_lemma4_simplify acc_v0.[0] acc_v0.[1] acc_v0.[2] acc_v0.[3] c0 c1 c2 c3 r r2 r4 val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma #w r b acc_v0 = match w with | 1 -> poly_update_nblocks_lemma1 r b acc_v0 | 2 -> poly_update_nblocks_lemma2 r b acc_v0 | 4 -> poly_update_nblocks_lemma4 r b acc_v0 val repeat_blocks_multi_vec_equiv_pre_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in VecLemmas.repeat_blocks_multi_vec_equiv_pre w size_block f f_v (normalize_n r) b acc_v0)
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val repeat_blocks_multi_vec_equiv_pre_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in VecLemmas.repeat_blocks_multi_vec_equiv_pre w size_block f f_v (normalize_n r) b acc_v0)
[]
Hacl.Spec.Poly1305.Equiv.repeat_blocks_multi_vec_equiv_pre_lemma
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
r: Hacl.Spec.Poly1305.Vec.pfelem -> b: Hacl.Spec.Poly1305.Equiv.block_v w -> acc_v0: Hacl.Spec.Poly1305.Vec.elem w -> FStar.Pervasives.Lemma (ensures (let rw = Hacl.Spec.Poly1305.Vec.compute_rw r in let f = Spec.Poly1305.poly1305_update1 r Hacl.Spec.Poly1305.Vec.size_block in let f_v = Hacl.Spec.Poly1305.Vec.poly1305_update_nblocks rw in Lib.Vec.Lemmas.repeat_blocks_multi_vec_equiv_pre w Hacl.Spec.Poly1305.Vec.size_block f f_v (Hacl.Spec.Poly1305.Vec.normalize_n r) b acc_v0))
{ "end_col": 41, "end_line": 206, "start_col": 2, "start_line": 206 }
FStar.Pervasives.Lemma
val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0)
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let load_acc_lemma #w b acc0 r = match w with | 1 -> load_acc_lemma1 b acc0 r | 2 -> load_acc_lemma2 b acc0 r | 4 -> load_acc_lemma4 b acc0 r
val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma #w b acc0 r =
false
null
true
match w with | 1 -> load_acc_lemma1 b acc0 r | 2 -> load_acc_lemma2 b acc0 r | 4 -> load_acc_lemma4 b acc0 r
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Vec.lanes", "Hacl.Spec.Poly1305.Equiv.block_v", "Hacl.Spec.Poly1305.Vec.pfelem", "Hacl.Spec.Poly1305.Equiv.load_acc_lemma1", "Hacl.Spec.Poly1305.Equiv.load_acc_lemma2", "Hacl.Spec.Poly1305.Equiv.load_acc_lemma4", "Prims.unit" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma2 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1 val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma4 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in FStar.Math.Lemmas.modulo_lemma c1 prime; FStar.Math.Lemmas.modulo_lemma c2 prime; FStar.Math.Lemmas.modulo_lemma c3 prime; let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3 val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0)
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0)
[]
Hacl.Spec.Poly1305.Equiv.load_acc_lemma
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b: Hacl.Spec.Poly1305.Equiv.block_v w -> acc0: Hacl.Spec.Poly1305.Vec.pfelem -> r: Hacl.Spec.Poly1305.Vec.pfelem -> FStar.Pervasives.Lemma (ensures Hacl.Spec.Poly1305.Vec.normalize_n r (Hacl.Spec.Poly1305.Vec.load_acc b acc0) == Lib.Sequence.repeat_blocks_multi Hacl.Spec.Poly1305.Vec.size_block b (Spec.Poly1305.poly1305_update1 r Hacl.Spec.Poly1305.Vec.size_block) acc0)
{ "end_col": 33, "end_line": 103, "start_col": 2, "start_line": 100 }
FStar.Pervasives.Lemma
val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0))
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let poly_update_nblocks_lemma #w r b acc_v0 = match w with | 1 -> poly_update_nblocks_lemma1 r b acc_v0 | 2 -> poly_update_nblocks_lemma2 r b acc_v0 | 4 -> poly_update_nblocks_lemma4 r b acc_v0
val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma #w r b acc_v0 =
false
null
true
match w with | 1 -> poly_update_nblocks_lemma1 r b acc_v0 | 2 -> poly_update_nblocks_lemma2 r b acc_v0 | 4 -> poly_update_nblocks_lemma4 r b acc_v0
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Vec.lanes", "Hacl.Spec.Poly1305.Vec.pfelem", "Hacl.Spec.Poly1305.Equiv.block_v", "Hacl.Spec.Poly1305.Vec.elem", "Hacl.Spec.Poly1305.Equiv.poly_update_nblocks_lemma1", "Hacl.Spec.Poly1305.Equiv.poly_update_nblocks_lemma2", "Hacl.Spec.Poly1305.Equiv.poly_update_nblocks_lemma4", "Prims.unit" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma2 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1 val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma4 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in FStar.Math.Lemmas.modulo_lemma c1 prime; FStar.Math.Lemmas.modulo_lemma c2 prime; FStar.Math.Lemmas.modulo_lemma c3 prime; let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3 val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma #w b acc0 r = match w with | 1 -> load_acc_lemma1 b acc0 r | 2 -> load_acc_lemma2 b acc0 r | 4 -> load_acc_lemma4 b acc0 r /// /// val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma /// (let rw = compute_rw r in /// normalize_n r (poly_update_nblocks #w rw b acc_v0) == /// repeat_blocks_multi size_block b (poly_update1 r) (normalize_n r acc_v0)) /// val poly_update_nblocks_lemma1: r:pfelem -> b:block_v 1 -> acc_v0:elem 1 -> Lemma (let rw = compute_rw #1 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma1 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val poly_update_nblocks_lemma2: r:pfelem -> b:block_v 2 -> acc_v0:elem 2 -> Lemma (let rw = compute_rw #2 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma2 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1; Lemmas.poly_update_repeat_blocks_multi_lemma2_simplify acc_v0.[0] acc_v0.[1] c0 c1 r val poly_update_nblocks_lemma4: r:pfelem -> b:block_v 4 -> acc_v0:elem 4 -> Lemma (let rw = compute_rw #4 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma4 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in let r2 = pfmul r r in let r4 = pfmul r2 r2 in let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_repeat_blocks_multi_lemma4_simplify acc_v0.[0] acc_v0.[1] acc_v0.[2] acc_v0.[3] c0 c1 c2 c3 r r2 r4 val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0))
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0))
[]
Hacl.Spec.Poly1305.Equiv.poly_update_nblocks_lemma
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
r: Hacl.Spec.Poly1305.Vec.pfelem -> b: Hacl.Spec.Poly1305.Equiv.block_v w -> acc_v0: Hacl.Spec.Poly1305.Vec.elem w -> FStar.Pervasives.Lemma (ensures (let rw = Hacl.Spec.Poly1305.Vec.compute_rw r in Hacl.Spec.Poly1305.Vec.normalize_n r (Hacl.Spec.Poly1305.Vec.poly1305_update_nblocks rw b acc_v0) == Lib.Sequence.repeat_blocks_multi Hacl.Spec.Poly1305.Vec.size_block b (Spec.Poly1305.poly1305_update1 r Hacl.Spec.Poly1305.Vec.size_block) (Hacl.Spec.Poly1305.Vec.normalize_n r acc_v0)))
{ "end_col": 46, "end_line": 196, "start_col": 2, "start_line": 193 }
FStar.Pervasives.Lemma
val poly_update_multi_lemma_v: #w:lanes -> text:bytes{length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc_v0:elem w -> r:pfelem -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in normalize_n r (repeat_blocks_multi (w * size_block) text f_v acc_v0) == repeat_blocks_multi size_block text f (normalize_n r acc_v0))
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let poly_update_multi_lemma_v #w text acc_v0 r = let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in Classical.forall_intro_2 (repeat_blocks_multi_vec_equiv_pre_lemma #w r); VecLemmas.lemma_repeat_blocks_multi_vec w size_block text f f_v (normalize_n r) acc_v0
val poly_update_multi_lemma_v: #w:lanes -> text:bytes{length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc_v0:elem w -> r:pfelem -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in normalize_n r (repeat_blocks_multi (w * size_block) text f_v acc_v0) == repeat_blocks_multi size_block text f (normalize_n r acc_v0)) let poly_update_multi_lemma_v #w text acc_v0 r =
false
null
true
let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in Classical.forall_intro_2 (repeat_blocks_multi_vec_equiv_pre_lemma #w r); VecLemmas.lemma_repeat_blocks_multi_vec w size_block text f f_v (normalize_n r) acc_v0
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Vec.lanes", "Lib.ByteSequence.bytes", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.op_Modulus", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "FStar.Mul.op_Star", "Hacl.Spec.Poly1305.Vec.size_block", "Hacl.Spec.Poly1305.Vec.elem", "Hacl.Spec.Poly1305.Vec.pfelem", "Lib.Vec.Lemmas.lemma_repeat_blocks_multi_vec", "Spec.Poly1305.felem", "Hacl.Spec.Poly1305.Vec.normalize_n", "Prims.unit", "FStar.Classical.forall_intro_2", "Hacl.Spec.Poly1305.Equiv.block_v", "Lib.Vec.Lemmas.repeat_blocks_multi_vec_equiv_pre", "Spec.Poly1305.poly1305_update1", "Hacl.Spec.Poly1305.Vec.poly1305_update_nblocks", "Hacl.Spec.Poly1305.Vec.compute_rw", "Hacl.Spec.Poly1305.Equiv.repeat_blocks_multi_vec_equiv_pre_lemma", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Prims.op_Multiply" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma2 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1 val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma4 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in FStar.Math.Lemmas.modulo_lemma c1 prime; FStar.Math.Lemmas.modulo_lemma c2 prime; FStar.Math.Lemmas.modulo_lemma c3 prime; let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3 val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma #w b acc0 r = match w with | 1 -> load_acc_lemma1 b acc0 r | 2 -> load_acc_lemma2 b acc0 r | 4 -> load_acc_lemma4 b acc0 r /// /// val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma /// (let rw = compute_rw r in /// normalize_n r (poly_update_nblocks #w rw b acc_v0) == /// repeat_blocks_multi size_block b (poly_update1 r) (normalize_n r acc_v0)) /// val poly_update_nblocks_lemma1: r:pfelem -> b:block_v 1 -> acc_v0:elem 1 -> Lemma (let rw = compute_rw #1 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma1 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val poly_update_nblocks_lemma2: r:pfelem -> b:block_v 2 -> acc_v0:elem 2 -> Lemma (let rw = compute_rw #2 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma2 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1; Lemmas.poly_update_repeat_blocks_multi_lemma2_simplify acc_v0.[0] acc_v0.[1] c0 c1 r val poly_update_nblocks_lemma4: r:pfelem -> b:block_v 4 -> acc_v0:elem 4 -> Lemma (let rw = compute_rw #4 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma4 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in let r2 = pfmul r r in let r4 = pfmul r2 r2 in let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_repeat_blocks_multi_lemma4_simplify acc_v0.[0] acc_v0.[1] acc_v0.[2] acc_v0.[3] c0 c1 c2 c3 r r2 r4 val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma #w r b acc_v0 = match w with | 1 -> poly_update_nblocks_lemma1 r b acc_v0 | 2 -> poly_update_nblocks_lemma2 r b acc_v0 | 4 -> poly_update_nblocks_lemma4 r b acc_v0 val repeat_blocks_multi_vec_equiv_pre_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in VecLemmas.repeat_blocks_multi_vec_equiv_pre w size_block f f_v (normalize_n r) b acc_v0) let repeat_blocks_multi_vec_equiv_pre_lemma #w r b acc_v0 = poly_update_nblocks_lemma #w r b acc_v0 val poly_update_multi_lemma_v: #w:lanes -> text:bytes{length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc_v0:elem w -> r:pfelem -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in normalize_n r (repeat_blocks_multi (w * size_block) text f_v acc_v0) == repeat_blocks_multi size_block text f (normalize_n r acc_v0))
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val poly_update_multi_lemma_v: #w:lanes -> text:bytes{length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc_v0:elem w -> r:pfelem -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in normalize_n r (repeat_blocks_multi (w * size_block) text f_v acc_v0) == repeat_blocks_multi size_block text f (normalize_n r acc_v0))
[]
Hacl.Spec.Poly1305.Equiv.poly_update_multi_lemma_v
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
text: Lib.ByteSequence.bytes { Lib.Sequence.length text % (w * Hacl.Spec.Poly1305.Vec.size_block) = 0 /\ Lib.Sequence.length text % Hacl.Spec.Poly1305.Vec.size_block = 0 } -> acc_v0: Hacl.Spec.Poly1305.Vec.elem w -> r: Hacl.Spec.Poly1305.Vec.pfelem -> FStar.Pervasives.Lemma (ensures (let rw = Hacl.Spec.Poly1305.Vec.compute_rw r in let f = Spec.Poly1305.poly1305_update1 r Hacl.Spec.Poly1305.Vec.size_block in let f_v = Hacl.Spec.Poly1305.Vec.poly1305_update_nblocks rw in Hacl.Spec.Poly1305.Vec.normalize_n r (Lib.Sequence.repeat_blocks_multi (w * Hacl.Spec.Poly1305.Vec.size_block) text f_v acc_v0) == Lib.Sequence.repeat_blocks_multi Hacl.Spec.Poly1305.Vec.size_block text f (Hacl.Spec.Poly1305.Vec.normalize_n r acc_v0)))
{ "end_col": 88, "end_line": 226, "start_col": 48, "start_line": 220 }
FStar.Pervasives.Lemma
val poly_update_nblocks_lemma1: r:pfelem -> b:block_v 1 -> acc_v0:elem 1 -> Lemma (let rw = compute_rw #1 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0))
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let poly_update_nblocks_lemma1 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0
val poly_update_nblocks_lemma1: r:pfelem -> b:block_v 1 -> acc_v0:elem 1 -> Lemma (let rw = compute_rw #1 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma1 r b acc_v0 =
false
null
true
let acc0 = normalize_n r acc_v0 in let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Vec.pfelem", "Hacl.Spec.Poly1305.Equiv.block_v", "Hacl.Spec.Poly1305.Vec.elem", "Lib.LoopCombinators.eq_repeati0", "Spec.Poly1305.felem", "Prims.unit", "Lib.LoopCombinators.unfold_repeati", "Lib.Sequence.lemma_repeat_blocks_multi", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Hacl.Spec.Poly1305.Vec.size_block", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Lib.Sequence.repeat_blocks_f", "Prims.int", "Prims.op_Division", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Spec.Poly1305.poly1305_update1", "Hacl.Spec.Poly1305.Vec.normalize_n" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma2 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1 val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma4 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in FStar.Math.Lemmas.modulo_lemma c1 prime; FStar.Math.Lemmas.modulo_lemma c2 prime; FStar.Math.Lemmas.modulo_lemma c3 prime; let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3 val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma #w b acc0 r = match w with | 1 -> load_acc_lemma1 b acc0 r | 2 -> load_acc_lemma2 b acc0 r | 4 -> load_acc_lemma4 b acc0 r /// /// val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma /// (let rw = compute_rw r in /// normalize_n r (poly_update_nblocks #w rw b acc_v0) == /// repeat_blocks_multi size_block b (poly_update1 r) (normalize_n r acc_v0)) /// val poly_update_nblocks_lemma1: r:pfelem -> b:block_v 1 -> acc_v0:elem 1 -> Lemma (let rw = compute_rw #1 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0))
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val poly_update_nblocks_lemma1: r:pfelem -> b:block_v 1 -> acc_v0:elem 1 -> Lemma (let rw = compute_rw #1 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0))
[]
Hacl.Spec.Poly1305.Equiv.poly_update_nblocks_lemma1
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
r: Hacl.Spec.Poly1305.Vec.pfelem -> b: Hacl.Spec.Poly1305.Equiv.block_v 1 -> acc_v0: Hacl.Spec.Poly1305.Vec.elem 1 -> FStar.Pervasives.Lemma (ensures (let rw = Hacl.Spec.Poly1305.Vec.compute_rw r in Hacl.Spec.Poly1305.Vec.normalize_n r (Hacl.Spec.Poly1305.Vec.poly1305_update_nblocks rw b acc_v0) == Lib.Sequence.repeat_blocks_multi Hacl.Spec.Poly1305.Vec.size_block b (Spec.Poly1305.poly1305_update1 r Hacl.Spec.Poly1305.Vec.size_block) (Hacl.Spec.Poly1305.Vec.normalize_n r acc_v0)))
{ "end_col": 36, "end_line": 125, "start_col": 43, "start_line": 117 }
FStar.Pervasives.Lemma
val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0)
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0
val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r =
false
null
true
let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Equiv.block_v", "Hacl.Spec.Poly1305.Vec.pfelem", "Lib.LoopCombinators.eq_repeati0", "Spec.Poly1305.felem", "Prims.unit", "Lib.LoopCombinators.unfold_repeati", "Lib.Sequence.lemma_repeat_blocks_multi", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Hacl.Spec.Poly1305.Vec.size_block", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Lib.Sequence.repeat_blocks_f", "Prims.int", "Prims.op_Division", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Spec.Poly1305.poly1305_update1" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0)
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0)
[]
Hacl.Spec.Poly1305.Equiv.load_acc_lemma1
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b: Hacl.Spec.Poly1305.Equiv.block_v 1 -> acc0: Hacl.Spec.Poly1305.Vec.pfelem -> r: Hacl.Spec.Poly1305.Vec.pfelem -> FStar.Pervasives.Lemma (ensures Hacl.Spec.Poly1305.Vec.normalize_n r (Hacl.Spec.Poly1305.Vec.load_acc b acc0) == Lib.Sequence.repeat_blocks_multi Hacl.Spec.Poly1305.Vec.size_block b (Spec.Poly1305.poly1305_update1 r Hacl.Spec.Poly1305.Vec.size_block) acc0)
{ "end_col": 36, "end_line": 37, "start_col": 30, "start_line": 30 }
FStar.Pervasives.Lemma
val poly_update_multi_lemma: #w:lanes -> text:bytes{w * size_block <= length text /\ length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc0:pfelem -> r:pfelem -> Lemma (poly1305_update_multi #w text acc0 r == repeat_blocks_multi size_block text (S.poly1305_update1 r size_block) acc0)
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let poly_update_multi_lemma #w text acc0 r = let len = length text in let blocksize_v = w * size_block in let text0 = Seq.slice text 0 blocksize_v in let text1 = Seq.slice text blocksize_v len in FStar.Math.Lemmas.modulo_addition_lemma len blocksize_v (- 1); assert (length text1 % (w * size_block) = 0 /\ length text1 % size_block = 0); let f = S.poly1305_update1 r size_block in let acc_v0 = load_acc #w text0 acc0 in let rp = poly1305_update_multi #w text acc0 r in poly_update_multi_lemma_v #w text1 acc_v0 r; load_acc_lemma #w text0 acc0 r; SeqLemmas.repeat_blocks_multi_split size_block blocksize_v text f acc0
val poly_update_multi_lemma: #w:lanes -> text:bytes{w * size_block <= length text /\ length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc0:pfelem -> r:pfelem -> Lemma (poly1305_update_multi #w text acc0 r == repeat_blocks_multi size_block text (S.poly1305_update1 r size_block) acc0) let poly_update_multi_lemma #w text acc0 r =
false
null
true
let len = length text in let blocksize_v = w * size_block in let text0 = Seq.slice text 0 blocksize_v in let text1 = Seq.slice text blocksize_v len in FStar.Math.Lemmas.modulo_addition_lemma len blocksize_v (- 1); assert (length text1 % (w * size_block) = 0 /\ length text1 % size_block = 0); let f = S.poly1305_update1 r size_block in let acc_v0 = load_acc #w text0 acc0 in let rp = poly1305_update_multi #w text acc0 r in poly_update_multi_lemma_v #w text1 acc_v0 r; load_acc_lemma #w text0 acc0 r; SeqLemmas.repeat_blocks_multi_split size_block blocksize_v text f acc0
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Vec.lanes", "Lib.ByteSequence.bytes", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Hacl.Spec.Poly1305.Vec.size_block", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.op_Equality", "Prims.int", "Prims.op_Modulus", "Hacl.Spec.Poly1305.Vec.pfelem", "Lib.Sequence.Lemmas.repeat_blocks_multi_split", "Spec.Poly1305.felem", "Prims.unit", "Hacl.Spec.Poly1305.Equiv.load_acc_lemma", "Hacl.Spec.Poly1305.Equiv.poly_update_multi_lemma_v", "Hacl.Spec.Poly1305.Vec.poly1305_update_multi", "Hacl.Spec.Poly1305.Vec.elem", "Hacl.Spec.Poly1305.Vec.load_acc", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Spec.Poly1305.poly1305_update1", "Prims._assert", "FStar.Math.Lemmas.modulo_addition_lemma", "Prims.op_Minus", "FStar.Seq.Base.seq", "FStar.Seq.Base.slice", "Prims.nat" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma2 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1 val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma4 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in FStar.Math.Lemmas.modulo_lemma c1 prime; FStar.Math.Lemmas.modulo_lemma c2 prime; FStar.Math.Lemmas.modulo_lemma c3 prime; let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3 val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma #w b acc0 r = match w with | 1 -> load_acc_lemma1 b acc0 r | 2 -> load_acc_lemma2 b acc0 r | 4 -> load_acc_lemma4 b acc0 r /// /// val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma /// (let rw = compute_rw r in /// normalize_n r (poly_update_nblocks #w rw b acc_v0) == /// repeat_blocks_multi size_block b (poly_update1 r) (normalize_n r acc_v0)) /// val poly_update_nblocks_lemma1: r:pfelem -> b:block_v 1 -> acc_v0:elem 1 -> Lemma (let rw = compute_rw #1 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma1 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val poly_update_nblocks_lemma2: r:pfelem -> b:block_v 2 -> acc_v0:elem 2 -> Lemma (let rw = compute_rw #2 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma2 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1; Lemmas.poly_update_repeat_blocks_multi_lemma2_simplify acc_v0.[0] acc_v0.[1] c0 c1 r val poly_update_nblocks_lemma4: r:pfelem -> b:block_v 4 -> acc_v0:elem 4 -> Lemma (let rw = compute_rw #4 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma4 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in let r2 = pfmul r r in let r4 = pfmul r2 r2 in let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_repeat_blocks_multi_lemma4_simplify acc_v0.[0] acc_v0.[1] acc_v0.[2] acc_v0.[3] c0 c1 c2 c3 r r2 r4 val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma #w r b acc_v0 = match w with | 1 -> poly_update_nblocks_lemma1 r b acc_v0 | 2 -> poly_update_nblocks_lemma2 r b acc_v0 | 4 -> poly_update_nblocks_lemma4 r b acc_v0 val repeat_blocks_multi_vec_equiv_pre_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in VecLemmas.repeat_blocks_multi_vec_equiv_pre w size_block f f_v (normalize_n r) b acc_v0) let repeat_blocks_multi_vec_equiv_pre_lemma #w r b acc_v0 = poly_update_nblocks_lemma #w r b acc_v0 val poly_update_multi_lemma_v: #w:lanes -> text:bytes{length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc_v0:elem w -> r:pfelem -> Lemma (let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in normalize_n r (repeat_blocks_multi (w * size_block) text f_v acc_v0) == repeat_blocks_multi size_block text f (normalize_n r acc_v0)) let poly_update_multi_lemma_v #w text acc_v0 r = let rw = compute_rw #w r in let f = S.poly1305_update1 r size_block in let f_v = poly1305_update_nblocks rw in Classical.forall_intro_2 (repeat_blocks_multi_vec_equiv_pre_lemma #w r); VecLemmas.lemma_repeat_blocks_multi_vec w size_block text f f_v (normalize_n r) acc_v0 val poly_update_multi_lemma: #w:lanes -> text:bytes{w * size_block <= length text /\ length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc0:pfelem -> r:pfelem -> Lemma (poly1305_update_multi #w text acc0 r == repeat_blocks_multi size_block text (S.poly1305_update1 r size_block) acc0)
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val poly_update_multi_lemma: #w:lanes -> text:bytes{w * size_block <= length text /\ length text % (w * size_block) = 0 /\ length text % size_block = 0} -> acc0:pfelem -> r:pfelem -> Lemma (poly1305_update_multi #w text acc0 r == repeat_blocks_multi size_block text (S.poly1305_update1 r size_block) acc0)
[]
Hacl.Spec.Poly1305.Equiv.poly_update_multi_lemma
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
text: Lib.ByteSequence.bytes { w * Hacl.Spec.Poly1305.Vec.size_block <= Lib.Sequence.length text /\ Lib.Sequence.length text % (w * Hacl.Spec.Poly1305.Vec.size_block) = 0 /\ Lib.Sequence.length text % Hacl.Spec.Poly1305.Vec.size_block = 0 } -> acc0: Hacl.Spec.Poly1305.Vec.pfelem -> r: Hacl.Spec.Poly1305.Vec.pfelem -> FStar.Pervasives.Lemma (ensures Hacl.Spec.Poly1305.Vec.poly1305_update_multi text acc0 r == Lib.Sequence.repeat_blocks_multi Hacl.Spec.Poly1305.Vec.size_block text (Spec.Poly1305.poly1305_update1 r Hacl.Spec.Poly1305.Vec.size_block) acc0)
{ "end_col": 72, "end_line": 251, "start_col": 44, "start_line": 237 }
FStar.Pervasives.Lemma
val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0)
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let load_acc_lemma2 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1
val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma2 b acc0 r =
false
null
true
let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Equiv.block_v", "Hacl.Spec.Poly1305.Vec.pfelem", "Hacl.Spec.Poly1305.Lemmas.poly_update_multi_lemma_load2_simplify", "Prims.unit", "Lib.LoopCombinators.eq_repeati0", "Spec.Poly1305.felem", "Lib.LoopCombinators.unfold_repeati", "Lib.Sequence.lemma_repeat_blocks_multi", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Hacl.Spec.Poly1305.Vec.size_block", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Lib.Sequence.repeat_blocks_f", "Prims.int", "Prims.op_Division", "FStar.Mul.op_Star", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Spec.Poly1305.poly1305_update1", "FStar.Math.Lemmas.modulo_lemma", "Hacl.Spec.Poly1305.Vec.prime", "Hacl.Spec.Poly1305.Vec.pfadd", "Prims.pow2", "Lib.ByteSequence.nat_from_bytes_le", "FStar.Seq.Base.seq", "FStar.Seq.Base.slice" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0)
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0)
[]
Hacl.Spec.Poly1305.Equiv.load_acc_lemma2
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b: Hacl.Spec.Poly1305.Equiv.block_v 2 -> acc0: Hacl.Spec.Poly1305.Vec.pfelem -> r: Hacl.Spec.Poly1305.Vec.pfelem -> FStar.Pervasives.Lemma (ensures Hacl.Spec.Poly1305.Vec.normalize_n r (Hacl.Spec.Poly1305.Vec.load_acc b acc0) == Lib.Sequence.repeat_blocks_multi Hacl.Spec.Poly1305.Vec.size_block b (Spec.Poly1305.poly1305_update1 r Hacl.Spec.Poly1305.Vec.size_block) acc0)
{ "end_col": 60, "end_line": 60, "start_col": 30, "start_line": 44 }
FStar.Pervasives.Lemma
val poly_update_nblocks_lemma2: r:pfelem -> b:block_v 2 -> acc_v0:elem 2 -> Lemma (let rw = compute_rw #2 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0))
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let poly_update_nblocks_lemma2 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1; Lemmas.poly_update_repeat_blocks_multi_lemma2_simplify acc_v0.[0] acc_v0.[1] c0 c1 r
val poly_update_nblocks_lemma2: r:pfelem -> b:block_v 2 -> acc_v0:elem 2 -> Lemma (let rw = compute_rw #2 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma2 r b acc_v0 =
false
null
true
let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1; Lemmas.poly_update_repeat_blocks_multi_lemma2_simplify acc_v0.[ 0 ] acc_v0.[ 1 ] c0 c1 r
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Vec.pfelem", "Hacl.Spec.Poly1305.Equiv.block_v", "Hacl.Spec.Poly1305.Vec.elem", "Hacl.Spec.Poly1305.Lemmas.poly_update_repeat_blocks_multi_lemma2_simplify", "Lib.Sequence.op_String_Access", "Prims.unit", "Hacl.Spec.Poly1305.Lemmas.poly_update_multi_lemma_load2_simplify", "Lib.LoopCombinators.eq_repeati0", "Spec.Poly1305.felem", "Lib.LoopCombinators.unfold_repeati", "Lib.Sequence.lemma_repeat_blocks_multi", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Hacl.Spec.Poly1305.Vec.size_block", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Lib.Sequence.repeat_blocks_f", "Prims.int", "Prims.op_Division", "FStar.Mul.op_Star", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Spec.Poly1305.poly1305_update1", "Hacl.Spec.Poly1305.Vec.pfadd", "Prims.pow2", "Lib.ByteSequence.nat_from_bytes_le", "FStar.Seq.Base.seq", "FStar.Seq.Base.slice", "Hacl.Spec.Poly1305.Vec.normalize_n" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma2 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1 val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma4 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in FStar.Math.Lemmas.modulo_lemma c1 prime; FStar.Math.Lemmas.modulo_lemma c2 prime; FStar.Math.Lemmas.modulo_lemma c3 prime; let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3 val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma #w b acc0 r = match w with | 1 -> load_acc_lemma1 b acc0 r | 2 -> load_acc_lemma2 b acc0 r | 4 -> load_acc_lemma4 b acc0 r /// /// val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma /// (let rw = compute_rw r in /// normalize_n r (poly_update_nblocks #w rw b acc_v0) == /// repeat_blocks_multi size_block b (poly_update1 r) (normalize_n r acc_v0)) /// val poly_update_nblocks_lemma1: r:pfelem -> b:block_v 1 -> acc_v0:elem 1 -> Lemma (let rw = compute_rw #1 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma1 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val poly_update_nblocks_lemma2: r:pfelem -> b:block_v 2 -> acc_v0:elem 2 -> Lemma (let rw = compute_rw #2 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0))
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val poly_update_nblocks_lemma2: r:pfelem -> b:block_v 2 -> acc_v0:elem 2 -> Lemma (let rw = compute_rw #2 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0))
[]
Hacl.Spec.Poly1305.Equiv.poly_update_nblocks_lemma2
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
r: Hacl.Spec.Poly1305.Vec.pfelem -> b: Hacl.Spec.Poly1305.Equiv.block_v 2 -> acc_v0: Hacl.Spec.Poly1305.Vec.elem 2 -> FStar.Pervasives.Lemma (ensures (let rw = Hacl.Spec.Poly1305.Vec.compute_rw r in Hacl.Spec.Poly1305.Vec.normalize_n r (Hacl.Spec.Poly1305.Vec.poly1305_update_nblocks rw b acc_v0) == Lib.Sequence.repeat_blocks_multi Hacl.Spec.Poly1305.Vec.size_block b (Spec.Poly1305.poly1305_update1 r Hacl.Spec.Poly1305.Vec.size_block) (Hacl.Spec.Poly1305.Vec.normalize_n r acc_v0)))
{ "end_col": 86, "end_line": 149, "start_col": 43, "start_line": 133 }
FStar.Pervasives.Lemma
val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0)
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let load_acc_lemma4 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in FStar.Math.Lemmas.modulo_lemma c1 prime; FStar.Math.Lemmas.modulo_lemma c2 prime; FStar.Math.Lemmas.modulo_lemma c3 prime; let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3
val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma4 b acc0 r =
false
null
true
let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in FStar.Math.Lemmas.modulo_lemma c1 prime; FStar.Math.Lemmas.modulo_lemma c2 prime; FStar.Math.Lemmas.modulo_lemma c3 prime; let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Equiv.block_v", "Hacl.Spec.Poly1305.Vec.pfelem", "Hacl.Spec.Poly1305.Lemmas.poly_update_multi_lemma_load4_simplify", "Prims.unit", "Lib.LoopCombinators.eq_repeati0", "Spec.Poly1305.felem", "Lib.LoopCombinators.unfold_repeati", "Lib.Sequence.lemma_repeat_blocks_multi", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Hacl.Spec.Poly1305.Vec.size_block", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Lib.Sequence.repeat_blocks_f", "Prims.int", "Prims.op_Division", "FStar.Mul.op_Star", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Spec.Poly1305.poly1305_update1", "FStar.Math.Lemmas.modulo_lemma", "Hacl.Spec.Poly1305.Vec.prime", "Hacl.Spec.Poly1305.Vec.pfadd", "Prims.pow2", "Lib.ByteSequence.nat_from_bytes_le", "FStar.Seq.Base.seq", "FStar.Seq.Base.slice" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma2 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1 val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0)
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0)
[]
Hacl.Spec.Poly1305.Equiv.load_acc_lemma4
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b: Hacl.Spec.Poly1305.Equiv.block_v 4 -> acc0: Hacl.Spec.Poly1305.Vec.pfelem -> r: Hacl.Spec.Poly1305.Vec.pfelem -> FStar.Pervasives.Lemma (ensures Hacl.Spec.Poly1305.Vec.normalize_n r (Hacl.Spec.Poly1305.Vec.load_acc b acc0) == Lib.Sequence.repeat_blocks_multi Hacl.Spec.Poly1305.Vec.size_block b (Spec.Poly1305.poly1305_update1 r Hacl.Spec.Poly1305.Vec.size_block) acc0)
{ "end_col": 66, "end_line": 92, "start_col": 30, "start_line": 67 }
FStar.Pervasives.Lemma
val poly_update_nblocks_lemma4: r:pfelem -> b:block_v 4 -> acc_v0:elem 4 -> Lemma (let rw = compute_rw #4 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0))
[ { "abbrev": false, "full_module": "Hacl.Spec.Poly1305.Vec", "short_module": null }, { "abbrev": true, "full_module": "Spec.Poly1305", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Poly1305.Lemmas", "short_module": "Lemmas" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "SeqLemmas" }, { "abbrev": true, "full_module": "Lib.Vec.Lemmas", "short_module": "VecLemmas" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Poly1305", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let poly_update_nblocks_lemma4 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in let r2 = pfmul r r in let r4 = pfmul r2 r2 in let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_repeat_blocks_multi_lemma4_simplify acc_v0.[0] acc_v0.[1] acc_v0.[2] acc_v0.[3] c0 c1 c2 c3 r r2 r4
val poly_update_nblocks_lemma4: r:pfelem -> b:block_v 4 -> acc_v0:elem 4 -> Lemma (let rw = compute_rw #4 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma4 r b acc_v0 =
false
null
true
let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in let r2 = pfmul r r in let r4 = pfmul r2 r2 in let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_repeat_blocks_multi_lemma4_simplify acc_v0.[ 0 ] acc_v0.[ 1 ] acc_v0.[ 2 ] acc_v0.[ 3 ] c0 c1 c2 c3 r r2 r4
{ "checked_file": "Hacl.Spec.Poly1305.Equiv.fst.checked", "dependencies": [ "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Vec.Lemmas.fsti.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Poly1305.Vec.fst.checked", "Hacl.Spec.Poly1305.Lemmas.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Poly1305.Equiv.fst" }
[ "lemma" ]
[ "Hacl.Spec.Poly1305.Vec.pfelem", "Hacl.Spec.Poly1305.Equiv.block_v", "Hacl.Spec.Poly1305.Vec.elem", "Hacl.Spec.Poly1305.Lemmas.poly_update_repeat_blocks_multi_lemma4_simplify", "Lib.Sequence.op_String_Access", "Prims.unit", "Lib.LoopCombinators.eq_repeati0", "Spec.Poly1305.felem", "Lib.LoopCombinators.unfold_repeati", "Lib.Sequence.lemma_repeat_blocks_multi", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Hacl.Spec.Poly1305.Vec.size_block", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Lib.Sequence.repeat_blocks_f", "Prims.int", "Prims.op_Division", "FStar.Mul.op_Star", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Spec.Poly1305.poly1305_update1", "Hacl.Spec.Poly1305.Vec.pfmul", "Hacl.Spec.Poly1305.Vec.pfadd", "Prims.pow2", "Lib.ByteSequence.nat_from_bytes_le", "FStar.Seq.Base.seq", "FStar.Seq.Base.slice", "Hacl.Spec.Poly1305.Vec.normalize_n" ]
[]
module Hacl.Spec.Poly1305.Equiv open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Lib.IntVector module Loops = Lib.LoopCombinators module VecLemmas = Lib.Vec.Lemmas module SeqLemmas = Lib.Sequence.Lemmas module Lemmas = Hacl.Spec.Poly1305.Lemmas module S = Spec.Poly1305 include Hacl.Spec.Poly1305.Vec #set-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let block_v (w:lanes{w * size_block <= max_size_t}) = lbytes (w * size_block) /// /// val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma /// (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) /// val load_acc_lemma1: b:block_v 1 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc #1 b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma1 b acc0 r = let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val load_acc_lemma2: b:block_v 2 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma2 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in FStar.Math.Lemmas.modulo_lemma c1 prime; let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1 val load_acc_lemma4: b:block_v 4 -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma4 b acc0 r = let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let b2 = Seq.slice b (2 * size_block) (3 * size_block) in let b3 = Seq.slice b (3 * size_block) (4 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let c2 = pfadd (pow2 128) (nat_from_bytes_le b2) in let c3 = pfadd (pow2 128) (nat_from_bytes_le b3) in FStar.Math.Lemmas.modulo_lemma c1 prime; FStar.Math.Lemmas.modulo_lemma c2 prime; FStar.Math.Lemmas.modulo_lemma c3 prime; let f = S.poly1305_update1 r size_block in let nb = (4 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 3; Loops.unfold_repeati nb repeat_f acc0 2; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load4_simplify acc0 r c0 c1 c2 c3 val load_acc_lemma: #w:lanes -> b:block_v w -> acc0:pfelem -> r:pfelem -> Lemma (normalize_n r (load_acc b acc0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) acc0) let load_acc_lemma #w b acc0 r = match w with | 1 -> load_acc_lemma1 b acc0 r | 2 -> load_acc_lemma2 b acc0 r | 4 -> load_acc_lemma4 b acc0 r /// /// val poly_update_nblocks_lemma: #w:lanes -> r:pfelem -> b:block_v w -> acc_v0:elem w -> Lemma /// (let rw = compute_rw r in /// normalize_n r (poly_update_nblocks #w rw b acc_v0) == /// repeat_blocks_multi size_block b (poly_update1 r) (normalize_n r acc_v0)) /// val poly_update_nblocks_lemma1: r:pfelem -> b:block_v 1 -> acc_v0:elem 1 -> Lemma (let rw = compute_rw #1 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma1 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let f = S.poly1305_update1 r size_block in let nb = size_block / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0 val poly_update_nblocks_lemma2: r:pfelem -> b:block_v 2 -> acc_v0:elem 2 -> Lemma (let rw = compute_rw #2 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0)) let poly_update_nblocks_lemma2 r b acc_v0 = let acc0 = normalize_n r acc_v0 in let b0 = Seq.slice b 0 size_block in let b1 = Seq.slice b size_block (2 * size_block) in let c0 = pfadd (pow2 128) (nat_from_bytes_le b0) in let c1 = pfadd (pow2 128) (nat_from_bytes_le b1) in let f = S.poly1305_update1 r size_block in let nb = (2 * size_block) / size_block in let repeat_f = repeat_blocks_f size_block b f nb in lemma_repeat_blocks_multi size_block b f acc0; Loops.unfold_repeati nb repeat_f acc0 1; Loops.unfold_repeati nb repeat_f acc0 0; Loops.eq_repeati0 nb repeat_f acc0; Lemmas.poly_update_multi_lemma_load2_simplify acc0 r c0 c1; Lemmas.poly_update_repeat_blocks_multi_lemma2_simplify acc_v0.[0] acc_v0.[1] c0 c1 r val poly_update_nblocks_lemma4: r:pfelem -> b:block_v 4 -> acc_v0:elem 4 -> Lemma (let rw = compute_rw #4 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0))
false
false
Hacl.Spec.Poly1305.Equiv.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val poly_update_nblocks_lemma4: r:pfelem -> b:block_v 4 -> acc_v0:elem 4 -> Lemma (let rw = compute_rw #4 r in normalize_n r (poly1305_update_nblocks rw b acc_v0) == repeat_blocks_multi size_block b (S.poly1305_update1 r size_block) (normalize_n r acc_v0))
[]
Hacl.Spec.Poly1305.Equiv.poly_update_nblocks_lemma4
{ "file_name": "code/poly1305/Hacl.Spec.Poly1305.Equiv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
r: Hacl.Spec.Poly1305.Vec.pfelem -> b: Hacl.Spec.Poly1305.Equiv.block_v 4 -> acc_v0: Hacl.Spec.Poly1305.Vec.elem 4 -> FStar.Pervasives.Lemma (ensures (let rw = Hacl.Spec.Poly1305.Vec.compute_rw r in Hacl.Spec.Poly1305.Vec.normalize_n r (Hacl.Spec.Poly1305.Vec.poly1305_update_nblocks rw b acc_v0) == Lib.Sequence.repeat_blocks_multi Hacl.Spec.Poly1305.Vec.size_block b (Spec.Poly1305.poly1305_update1 r Hacl.Spec.Poly1305.Vec.size_block) (Hacl.Spec.Poly1305.Vec.normalize_n r acc_v0)))
{ "end_col": 67, "end_line": 184, "start_col": 43, "start_line": 157 }
Prims.Tot
val va_codegen_success_ShiftLeft128_1 : va_dummy:unit -> Tot va_pbool
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ())))
val va_codegen_success_ShiftLeft128_1 : va_dummy:unit -> Tot va_pbool let va_codegen_success_ShiftLeft128_1 () =
false
null
false
(va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ())))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Prims.unit", "Vale.PPC64LE.Decls.va_pbool_and", "Vale.PPC64LE.InsVector.va_codegen_success_Vspltisb", "Vale.PPC64LE.Decls.va_op_vec_opr_vec", "Vale.PPC64LE.InsVector.va_codegen_success_Vsl", "Vale.PPC64LE.Decls.va_ttrue", "Vale.PPC64LE.Decls.va_pbool" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr]
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_codegen_success_ShiftLeft128_1 : va_dummy:unit -> Tot va_pbool
[]
Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_ShiftLeft128_1
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool
{ "end_col": 19, "end_line": 34, "start_col": 2, "start_line": 32 }
Prims.Tot
val va_code_ShiftLeft128_1 : va_dummy:unit -> Tot va_code
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ()))))
val va_code_ShiftLeft128_1 : va_dummy:unit -> Tot va_code let va_code_ShiftLeft128_1 () =
false
null
false
(va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ()))))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Prims.unit", "Vale.PPC64LE.Decls.va_Block", "Vale.PPC64LE.Decls.va_CCons", "Vale.PPC64LE.InsVector.va_code_Vspltisb", "Vale.PPC64LE.Decls.va_op_vec_opr_vec", "Vale.PPC64LE.InsVector.va_code_Vsl", "Vale.PPC64LE.Decls.va_CNil", "Vale.PPC64LE.Decls.va_code" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr]
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_code_ShiftLeft128_1 : va_dummy:unit -> Tot va_code
[]
Vale.AES.PPC64LE.GF128_Mul.va_code_ShiftLeft128_1
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code
{ "end_col": 86, "end_line": 28, "start_col": 2, "start_line": 27 }
Prims.Tot
val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ()))))))))))
val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool let va_codegen_success_ShiftLeft2_128_1 () =
false
null
false
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ()))))))))))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Prims.unit", "Vale.PPC64LE.Decls.va_pbool_and", "Vale.PPC64LE.InsVector.va_codegen_success_Vspltisw", "Vale.PPC64LE.Decls.va_op_vec_opr_vec", "Vale.PPC64LE.InsBasic.va_codegen_success_LoadImm64", "Vale.PPC64LE.Decls.va_op_reg_opr_reg", "Vale.PPC64LE.InsVector.va_codegen_success_Mtvsrws", "Vale.PPC64LE.InsVector.va_codegen_success_Vsrw", "Vale.PPC64LE.InsVector.va_codegen_success_Vsldoi", "Vale.PPC64LE.InsVector.va_codegen_success_Vspltisb", "Vale.PPC64LE.InsVector.va_codegen_success_Vsl", "Vale.PPC64LE.InsVector.va_codegen_success_Vxor", "Vale.PPC64LE.Decls.va_ttrue", "Vale.PPC64LE.Decls.va_pbool" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr]
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool
[]
Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_ShiftLeft2_128_1
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool
{ "end_col": 93, "end_line": 100, "start_col": 2, "start_line": 91 }
Prims.Tot
val va_wp_Gf128ModulusRev (dst: va_operand_vec_opr) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_wp_Gf128ModulusRev (dst:va_operand_vec_opr) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_vec_opr dst va_s0 /\ va_get_ok va_s0 /\ dst =!= 3 /\ (forall (va_x_dst:va_value_vec_opr) (va_x_r10:nat64) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_reg 10 va_x_r10 (va_upd_operand_vec_opr dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) /\ Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_eval_vec_opr va_sM dst)) == zero ==> va_k va_sM (())))
val va_wp_Gf128ModulusRev (dst: va_operand_vec_opr) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 let va_wp_Gf128ModulusRev (dst: va_operand_vec_opr) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
false
null
false
(va_is_dst_vec_opr dst va_s0 /\ va_get_ok va_s0 /\ dst =!= 3 /\ (forall (va_x_dst: va_value_vec_opr) (va_x_r10: nat64) (va_x_v3: quad32). let va_sM = va_upd_vec 3 va_x_v3 (va_upd_reg 10 va_x_r10 (va_upd_operand_vec_opr dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) /\ Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_eval_vec_opr va_sM dst)) == zero ==> va_k va_sM (())))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Vale.PPC64LE.Decls.va_operand_vec_opr", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Prims.l_and", "Vale.PPC64LE.Decls.va_is_dst_vec_opr", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Prims.l_not", "Prims.eq2", "Prims.int", "Prims.l_Forall", "Vale.PPC64LE.Decls.va_value_vec_opr", "Vale.PPC64LE.Machine_s.nat64", "Vale.PPC64LE.Machine_s.quad32", "Prims.l_imp", "Vale.Def.Types_s.quad32", "Vale.PPC64LE.Decls.va_eval_vec_opr", "Vale.Math.Poly2.Bits_s.to_quad32", "Vale.Math.Poly2_s.reverse", "Vale.AES.GF128_s.gf128_modulus_low_terms", "Vale.Math.Poly2_s.poly", "Vale.Math.Poly2.Bits_s.of_double32", "Vale.Arch.Types.quad32_double_lo", "Vale.Math.Poly2_s.zero", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.Decls.va_upd_vec", "Vale.PPC64LE.Decls.va_upd_reg", "Vale.PPC64LE.Decls.va_upd_operand_vec_opr" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (()))) val va_wpProof_ShiftLeft2_128_1 : lo:poly -> hi:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ShiftLeft2_128_1 lo hi va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ShiftLeft2_128_1 lo hi va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft2_128_1 (va_code_ShiftLeft2_128_1 ()) va_s0 lo hi in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ShiftLeft2_128_1 (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (va_QProc (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ShiftLeft2_128_1 lo hi) (va_wpProof_ShiftLeft2_128_1 lo hi)) //-- //-- ClmulRev64High val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev64High () = (va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev64High () = (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ShiftLeft128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev64High (va_mods:va_mods_t) (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (va_arg18:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 116 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg18) (let (va_arg17:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 117 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg17) (let (va_arg16:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 118 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg16 64) (let (va_arg15:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 119 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg15 64) (let (va_arg14:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 120 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg14 64) (let (va_arg13:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 121 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg13 64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 122 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 123 column 19 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft128_1 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.reverse a 63) (Vale.Math.Poly2_s.reverse b 63))) (fun (va_s:va_state) _ -> let (va_arg12:Vale.Math.Poly2_s.poly) = b in let (va_arg11:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 125 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg11 va_arg12 63) (va_QEmpty (())))))))))))) val va_lemma_ClmulRev64High : va_b0:va_code -> va_s0:va_state -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ClmulRev64High ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) /\ va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_ClmulRev64High va_b0 va_s0 a b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ClmulRev64High va_mods a b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev64High ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 101 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 114 column 49 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ClmulRev64High (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0) in va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) ==> va_k va_sM (()))) val va_wpProof_ClmulRev64High : a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ClmulRev64High a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev64High a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_ClmulRev64High (va_code_ClmulRev64High ()) va_s0 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev64High (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (va_QProc (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) (va_wp_ClmulRev64High a b) (va_wpProof_ClmulRev64High a b)) //-- //-- High64ToLow [@ "opaque_to_smt"] let va_code_High64ToLow dst src = (va_Block (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_CNil ()))) [@ "opaque_to_smt"] let va_codegen_success_High64ToLow dst src = (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_ttrue ())) [@"opaque_to_smt"] let va_lemma_High64ToLow va_b0 va_s0 dst src a = va_reveal_opaque (`%va_code_High64ToLow) (va_code_High64ToLow dst src); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vsldoi (va_hd va_b1) va_s0 dst (va_op_vec_opr_vec 0) src 8 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_quad32_double_shift a; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_High64ToLow dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_High64ToLow (va_code_High64ToLow dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Low64ToHigh [@ "opaque_to_smt" va_qattr] let va_code_Low64ToHigh dst src = (va_Block (va_CCons (va_code_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_CNil ()))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Low64ToHigh dst src = (va_pbool_and (va_codegen_success_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Low64ToHigh (va_mods:va_mods_t) (dst:vec_opr) (src:vec_opr) (a:poly) : (va_quickCode unit (va_code_Low64ToHigh dst src)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 156 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (fun (va_s:va_state) _ -> let (va_arg4:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 157 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_shift va_arg4) (va_QEmpty (()))))) [@"opaque_to_smt"] let va_lemma_Low64ToHigh va_b0 va_s0 dst src a = let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr dst] in let va_qc = va_qcode_Low64ToHigh va_mods dst src a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Low64ToHigh dst src) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 144 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 154 column 66 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod a (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr dst]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Low64ToHigh dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_Low64ToHigh (va_code_Low64ToHigh dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- AddPoly val va_code_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_AddPoly dst src1 src2 = (va_Block (va_CCons (va_code_Vxor dst src1 src2) (va_CNil ()))) val va_codegen_success_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_AddPoly dst src1 src2 = (va_pbool_and (va_codegen_success_Vxor dst src1 src2) (va_ttrue ())) val va_lemma_AddPoly : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_AddPoly dst src1 src2) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)))) [@"opaque_to_smt"] let va_lemma_AddPoly va_b0 va_s0 dst src1 src2 a b = va_reveal_opaque (`%va_code_AddPoly) (va_code_AddPoly dst src1 src2); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vxor (va_hd va_b1) va_s0 dst src1 src2 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_add128 a b; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b /\ (forall (va_x_dst:va_value_vec_opr) . let va_sM = va_upd_operand_vec_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) ==> va_k va_sM (()))) val va_wpProof_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_AddPoly dst src1 src2 a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_AddPoly dst src1 src2 a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_AddPoly (va_code_AddPoly dst src1 src2) va_s0 dst src1 src2 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) : (va_quickCode unit (va_code_AddPoly dst src1 src2)) = (va_QProc (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) (va_wp_AddPoly dst src1 src2 a b) (va_wpProof_AddPoly dst src1 src2 a b)) //-- //-- Clmul128 val va_code_Clmul128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Clmul128 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CNil ()))))))))))))) val va_codegen_success_Clmul128 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Clmul128 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Clmul128 (va_mods:va_mods_t) (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_Clmul128 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in let (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab n in let (b:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ab n in let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div cd n in let (d:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod cd n in let (ac:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a c in let (ad:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a d in let (bc:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul b c in let (bd:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul b d in let (ab_sw:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap ab 64 in let (ab_hi:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ab n in let (ab_lo:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div ab n) n in let (va_arg77:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 202 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg77) (let (va_arg76:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 203 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg76) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 205 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 206 column 10 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (fun (va_s:va_state) _ -> let (va_arg75:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 207 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg75) (let (va_arg74:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 208 column 29 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg74) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 209 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double ab_sw) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 210 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) ab_sw) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 211 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3) ab_sw) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 212 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 4 va_s == Vale.Math.Poly2.Bits_s.to_quad32 ab_hi) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 213 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 5 va_s == Vale.Math.Poly2.Bits_s.to_quad32 ab_lo) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 215 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 217 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 ab_hi) (let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab_hi n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 218 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg73) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 219 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_hi 64) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 220 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 222 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 ab_lo) (let (va_arg72:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 223 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg72 n) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 224 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_lo 64) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 225 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg71:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 227 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg71) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 228 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_sw 64) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 229 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_sw 64) (let (va_arg70:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 230 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg70 64) (let (va_arg69:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 231 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg69 64) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 232 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s) == Vale.Math.Poly2_s.add ad bc) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 234 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_hi 64) (let (va_arg68:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 235 column 18 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg68 n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 236 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s) == bd) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 238 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_lo 64) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 239 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s) == ac) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 241 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3) (Vale.Math.Poly2_s.add ad bc)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 242 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_distribute ad bc n) (let (va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod bc n in let (va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ad n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 243 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_distribute_left va_arg66 va_arg67 n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 244 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_s == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n))) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 246 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3) (Vale.Math.Poly2_s.add ad bc)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 247 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GHash_BE.lemma_div_distribute ad bc n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 248 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_s == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.div ad n) (Vale.Math.Poly2_s.div bc n))) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 250 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4) (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n)) bd) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 251 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2) ac (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.div ad n) (Vale.Math.Poly2_s.div bc n))) (fun (va_s:va_state) _ -> let (va_arg65:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div bc n in let (va_arg64:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ad n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 253 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg64 va_arg65) (let (va_arg63:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ad n in let (va_arg62:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div bc n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 254 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_associate ac va_arg62 va_arg63) (let (hi:poly) = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.add ac (Vale.Math.Poly2_s.div bc n)) (Vale.Math.Poly2_s.div ad n) in let (va_arg61:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n in let (va_arg60:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 256 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg60 va_arg61) (let (lo:poly) = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n)) bd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 259 column 20 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_gf128_mul a b c d 64) (va_QEmpty ((lo, hi)))))))))))))))))))))))))))))))))))))))))))))))) val va_lemma_Clmul128 : va_b0:va_code -> va_s0:va_state -> ab:poly -> cd:poly -> Ghost (va_state & va_fuel & poly & poly) (requires (va_require_total va_b0 (va_code_Clmul128 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 ab /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 cd)) (ensures (fun (va_sM, va_fM, lo, hi) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))) [@"opaque_to_smt"] let va_lemma_Clmul128 va_b0 va_s0 ab cd = let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok] in let va_qc = va_qcode_Clmul128 va_mods ab cd in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Clmul128 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let (lo, hi) = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree lo <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree hi < 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 186 column 47 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0; let (lo, hi) = va_g in (va_sM, va_fM, lo, hi) [@ va_qattr] let va_wp_Clmul128 (ab:poly) (cd:poly) (va_s0:va_state) (va_k:(va_state -> (poly & poly) -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 ab /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 cd /\ (forall (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (lo:poly) (hi:poly) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 va_s0))))) in va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi ==> va_k va_sM ((lo, hi)))) val va_wpProof_Clmul128 : ab:poly -> cd:poly -> va_s0:va_state -> va_k:(va_state -> (poly & poly) -> Type0) -> Ghost (va_state & va_fuel & (poly & poly)) (requires (va_t_require va_s0 /\ va_wp_Clmul128 ab cd va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Clmul128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Clmul128 ab cd va_s0 va_k = let (va_sM, va_f0, lo, hi) = va_lemma_Clmul128 (va_code_Clmul128 ()) va_s0 ab cd in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0)))))))); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_sM va_s0; let va_g = (lo, hi) in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Clmul128 (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_Clmul128 ())) = (va_QProc (va_code_Clmul128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_Clmul128 ab cd) (va_wpProof_Clmul128 ab cd)) //-- //-- ClmulRev128 val va_code_ClmulRev128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev128 () = (va_Block (va_CCons (va_code_Clmul128 ()) (va_CCons (va_code_ShiftLeft2_128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev128 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev128 () = (va_pbool_and (va_codegen_success_Clmul128 ()) (va_pbool_and (va_codegen_success_ShiftLeft2_128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev128 (va_mods:va_mods_t) (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_ClmulRev128 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 279 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Clmul128 (Vale.Math.Poly2_s.reverse ab 127) (Vale.Math.Poly2_s.reverse cd 127)) (fun (va_s:va_state) va_g -> let (lo, hi) = va_g in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 280 column 21 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft2_128_1 lo hi) (fun (va_s:va_state) _ -> let (m:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) 1 in let (va_arg13:Vale.Math.Poly2_s.poly) = lo in let (va_arg12:Vale.Math.Poly2_s.poly) = hi in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 283 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_combine_define va_arg12 va_arg13 128) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 284 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_split_define m 128) (let (lo:poly) = Vale.Math.Poly2_s.mod m (Vale.Math.Poly2_s.monomial 128) in let (hi:poly) = Vale.Math.Poly2_s.div m (Vale.Math.Poly2_s.monomial 128) in let (va_arg11:Vale.Math.Poly2_s.poly) = cd in let (va_arg10:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 287 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg10 va_arg11 127) (va_QEmpty ((lo, hi))))))))) val va_lemma_ClmulRev128 : va_b0:va_code -> va_s0:va_state -> ab:poly -> cd:poly -> Ghost (va_state & va_fuel & poly & poly) (requires (va_require_total va_b0 (va_code_ClmulRev128 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse ab 127) /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse cd 127))) (ensures (fun (va_sM, va_fM, lo, hi) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi <= 127 /\ Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))) [@"opaque_to_smt"] let va_lemma_ClmulRev128 va_b0 va_s0 ab cd = let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ClmulRev128 va_mods ab cd in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev128 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let (lo, hi) = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 262 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 273 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree lo <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 274 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree hi <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 275 column 61 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 276 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 277 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; let (lo, hi) = va_g in (va_sM, va_fM, lo, hi) [@ va_qattr] let va_wp_ClmulRev128 (ab:poly) (cd:poly) (va_s0:va_state) (va_k:(va_state -> (poly & poly) -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse ab 127) /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse cd 127) /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (lo:poly) (hi:poly) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))))) in va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi <= 127 /\ Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi ==> va_k va_sM ((lo, hi)))) val va_wpProof_ClmulRev128 : ab:poly -> cd:poly -> va_s0:va_state -> va_k:(va_state -> (poly & poly) -> Type0) -> Ghost (va_state & va_fuel & (poly & poly)) (requires (va_t_require va_s0 /\ va_wp_ClmulRev128 ab cd va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev128 ab cd va_s0 va_k = let (va_sM, va_f0, lo, hi) = va_lemma_ClmulRev128 (va_code_ClmulRev128 ()) va_s0 ab cd in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = (lo, hi) in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev128 (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_ClmulRev128 ())) = (va_QProc (va_code_ClmulRev128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ClmulRev128 ab cd) (va_wpProof_ClmulRev128 ab cd)) //-- //-- Gf128ModulusRev val va_code_Gf128ModulusRev : dst:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_Gf128ModulusRev dst = (va_Block (va_CCons (va_code_Vxor dst dst dst) (va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) (-7936)) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 3) dst 12) (va_CNil ())))))) val va_codegen_success_Gf128ModulusRev : dst:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_Gf128ModulusRev dst = (va_pbool_and (va_codegen_success_Vxor dst dst dst) (va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-7936)) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 3) dst 12) (va_ttrue ()))))) val va_lemma_Gf128ModulusRev : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gf128ModulusRev dst) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_get_ok va_s0 /\ dst =!= 3)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) /\ Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_eval_vec_opr va_sM dst)) == zero /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)))))) [@"opaque_to_smt"] let va_lemma_Gf128ModulusRev va_b0 va_s0 dst = va_reveal_opaque (`%va_code_Gf128ModulusRev) (va_code_Gf128ModulusRev dst); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in Vale.AES.GF128.lemma_gf128_constant_rev (va_eval_vec_opr va_s0 dst); let (va_s3, va_fc3) = va_lemma_Vxor (va_hd va_b1) va_s0 dst dst dst in let va_b3 = va_tl va_b1 in let (va_s4, va_fc4) = va_lemma_LoadImmShl64 (va_hd va_b3) va_s3 (va_op_reg_opr_reg 10) (-7936) in let va_b4 = va_tl va_b3 in Vale.AES.Types_helpers.lemma_ishl_64 ((-7936) `op_Modulus` pow2_64) 16; let (va_s6, va_fc6) = va_lemma_Mtvsrws (va_hd va_b4) va_s4 (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10) in let va_b6 = va_tl va_b4 in let (va_s7, va_fc7) = va_lemma_Vsldoi (va_hd va_b6) va_s6 dst (va_op_vec_opr_vec 3) dst 12 in let va_b7 = va_tl va_b6 in Vale.Math.Poly2.Lemmas.lemma_split_define (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) 64; Vale.Math.Poly2.Lemmas.lemma_index_all (); Vale.Math.Poly2.Lemmas.lemma_reverse_define_all (); Vale.Math.Poly2.lemma_equal (Vale.Math.Poly2_s.mod (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) (Vale.Math.Poly2_s.monomial 64)) zero; Vale.Math.Poly2.Bits.lemma_quad32_double (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127); let (va_sM, va_f7) = va_lemma_empty_total va_s7 va_b7 in let va_f6 = va_lemma_merge_total va_b6 va_s6 va_fc7 va_s7 va_f7 va_sM in let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_sM in let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc4 va_s4 va_f4 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_Gf128ModulusRev (dst:va_operand_vec_opr) (va_s0:va_state) (va_k:(va_state -> unit ->
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_wp_Gf128ModulusRev (dst: va_operand_vec_opr) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
[]
Vale.AES.PPC64LE.GF128_Mul.va_wp_Gf128ModulusRev
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
dst: Vale.PPC64LE.Decls.va_operand_vec_opr -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Type0
{ "end_col": 96, "end_line": 936, "start_col": 2, "start_line": 931 }
Prims.Tot
val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_code_ClmulRev64High () = (va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ()))))
val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code let va_code_ClmulRev64High () =
false
null
false
(va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ()))))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Prims.unit", "Vale.PPC64LE.Decls.va_Block", "Vale.PPC64LE.Decls.va_CCons", "Vale.AES.PPC64LE.PolyOps.va_code_VPolyMulHigh", "Vale.PPC64LE.Decls.va_op_vec_opr_vec", "Vale.AES.PPC64LE.GF128_Mul.va_code_ShiftLeft128_1", "Vale.PPC64LE.Decls.va_CNil", "Vale.PPC64LE.Decls.va_code" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (()))) val va_wpProof_ShiftLeft2_128_1 : lo:poly -> hi:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ShiftLeft2_128_1 lo hi va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ShiftLeft2_128_1 lo hi va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft2_128_1 (va_code_ShiftLeft2_128_1 ()) va_s0 lo hi in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ShiftLeft2_128_1 (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (va_QProc (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ShiftLeft2_128_1 lo hi) (va_wpProof_ShiftLeft2_128_1 lo hi)) //-- //-- ClmulRev64High val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr]
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code
[]
Vale.AES.PPC64LE.GF128_Mul.va_code_ClmulRev64High
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code
{ "end_col": 80, "end_line": 235, "start_col": 2, "start_line": 234 }
Prims.Tot
val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_codegen_success_ClmulRev64High () = (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ShiftLeft128_1 ()) (va_ttrue ())))
val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool let va_codegen_success_ClmulRev64High () =
false
null
false
(va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ShiftLeft128_1 ()) (va_ttrue ())))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Prims.unit", "Vale.PPC64LE.Decls.va_pbool_and", "Vale.AES.PPC64LE.PolyOps.va_codegen_success_VPolyMulHigh", "Vale.PPC64LE.Decls.va_op_vec_opr_vec", "Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_ShiftLeft128_1", "Vale.PPC64LE.Decls.va_ttrue", "Vale.PPC64LE.Decls.va_pbool" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (()))) val va_wpProof_ShiftLeft2_128_1 : lo:poly -> hi:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ShiftLeft2_128_1 lo hi va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ShiftLeft2_128_1 lo hi va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft2_128_1 (va_code_ShiftLeft2_128_1 ()) va_s0 lo hi in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ShiftLeft2_128_1 (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (va_QProc (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ShiftLeft2_128_1 lo hi) (va_wpProof_ShiftLeft2_128_1 lo hi)) //-- //-- ClmulRev64High val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev64High () = (va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr]
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool
[]
Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_ClmulRev64High
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool
{ "end_col": 95, "end_line": 241, "start_col": 2, "start_line": 240 }
Prims.Tot
val va_codegen_success_Clmul128 : va_dummy:unit -> Tot va_pbool
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_codegen_success_Clmul128 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_ttrue ()))))))))))))
val va_codegen_success_Clmul128 : va_dummy:unit -> Tot va_pbool let va_codegen_success_Clmul128 () =
false
null
false
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_ttrue ()))))))))))))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Prims.unit", "Vale.PPC64LE.Decls.va_pbool_and", "Vale.PPC64LE.InsVector.va_codegen_success_Vspltisw", "Vale.PPC64LE.Decls.va_op_vec_opr_vec", "Vale.AES.PPC64LE.PolyOps.va_codegen_success_VSwap", "Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_High64ToLow", "Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_Low64ToHigh", "Vale.AES.PPC64LE.PolyOps.va_codegen_success_VPolyMul", "Vale.AES.PPC64LE.PolyOps.va_codegen_success_VPolyMulLow", "Vale.AES.PPC64LE.PolyOps.va_codegen_success_VPolyMulHigh", "Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_AddPoly", "Vale.PPC64LE.Decls.va_ttrue", "Vale.PPC64LE.Decls.va_pbool" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (()))) val va_wpProof_ShiftLeft2_128_1 : lo:poly -> hi:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ShiftLeft2_128_1 lo hi va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ShiftLeft2_128_1 lo hi va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft2_128_1 (va_code_ShiftLeft2_128_1 ()) va_s0 lo hi in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ShiftLeft2_128_1 (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (va_QProc (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ShiftLeft2_128_1 lo hi) (va_wpProof_ShiftLeft2_128_1 lo hi)) //-- //-- ClmulRev64High val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev64High () = (va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev64High () = (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ShiftLeft128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev64High (va_mods:va_mods_t) (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (va_arg18:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 116 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg18) (let (va_arg17:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 117 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg17) (let (va_arg16:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 118 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg16 64) (let (va_arg15:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 119 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg15 64) (let (va_arg14:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 120 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg14 64) (let (va_arg13:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 121 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg13 64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 122 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 123 column 19 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft128_1 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.reverse a 63) (Vale.Math.Poly2_s.reverse b 63))) (fun (va_s:va_state) _ -> let (va_arg12:Vale.Math.Poly2_s.poly) = b in let (va_arg11:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 125 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg11 va_arg12 63) (va_QEmpty (())))))))))))) val va_lemma_ClmulRev64High : va_b0:va_code -> va_s0:va_state -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ClmulRev64High ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) /\ va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_ClmulRev64High va_b0 va_s0 a b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ClmulRev64High va_mods a b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev64High ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 101 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 114 column 49 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ClmulRev64High (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0) in va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) ==> va_k va_sM (()))) val va_wpProof_ClmulRev64High : a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ClmulRev64High a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev64High a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_ClmulRev64High (va_code_ClmulRev64High ()) va_s0 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev64High (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (va_QProc (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) (va_wp_ClmulRev64High a b) (va_wpProof_ClmulRev64High a b)) //-- //-- High64ToLow [@ "opaque_to_smt"] let va_code_High64ToLow dst src = (va_Block (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_CNil ()))) [@ "opaque_to_smt"] let va_codegen_success_High64ToLow dst src = (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_ttrue ())) [@"opaque_to_smt"] let va_lemma_High64ToLow va_b0 va_s0 dst src a = va_reveal_opaque (`%va_code_High64ToLow) (va_code_High64ToLow dst src); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vsldoi (va_hd va_b1) va_s0 dst (va_op_vec_opr_vec 0) src 8 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_quad32_double_shift a; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_High64ToLow dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_High64ToLow (va_code_High64ToLow dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Low64ToHigh [@ "opaque_to_smt" va_qattr] let va_code_Low64ToHigh dst src = (va_Block (va_CCons (va_code_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_CNil ()))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Low64ToHigh dst src = (va_pbool_and (va_codegen_success_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Low64ToHigh (va_mods:va_mods_t) (dst:vec_opr) (src:vec_opr) (a:poly) : (va_quickCode unit (va_code_Low64ToHigh dst src)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 156 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (fun (va_s:va_state) _ -> let (va_arg4:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 157 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_shift va_arg4) (va_QEmpty (()))))) [@"opaque_to_smt"] let va_lemma_Low64ToHigh va_b0 va_s0 dst src a = let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr dst] in let va_qc = va_qcode_Low64ToHigh va_mods dst src a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Low64ToHigh dst src) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 144 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 154 column 66 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod a (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr dst]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Low64ToHigh dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_Low64ToHigh (va_code_Low64ToHigh dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- AddPoly val va_code_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_AddPoly dst src1 src2 = (va_Block (va_CCons (va_code_Vxor dst src1 src2) (va_CNil ()))) val va_codegen_success_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_AddPoly dst src1 src2 = (va_pbool_and (va_codegen_success_Vxor dst src1 src2) (va_ttrue ())) val va_lemma_AddPoly : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_AddPoly dst src1 src2) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)))) [@"opaque_to_smt"] let va_lemma_AddPoly va_b0 va_s0 dst src1 src2 a b = va_reveal_opaque (`%va_code_AddPoly) (va_code_AddPoly dst src1 src2); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vxor (va_hd va_b1) va_s0 dst src1 src2 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_add128 a b; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b /\ (forall (va_x_dst:va_value_vec_opr) . let va_sM = va_upd_operand_vec_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) ==> va_k va_sM (()))) val va_wpProof_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_AddPoly dst src1 src2 a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_AddPoly dst src1 src2 a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_AddPoly (va_code_AddPoly dst src1 src2) va_s0 dst src1 src2 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) : (va_quickCode unit (va_code_AddPoly dst src1 src2)) = (va_QProc (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) (va_wp_AddPoly dst src1 src2 a b) (va_wpProof_AddPoly dst src1 src2 a b)) //-- //-- Clmul128 val va_code_Clmul128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Clmul128 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CNil ()))))))))))))) val va_codegen_success_Clmul128 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr]
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_codegen_success_Clmul128 : va_dummy:unit -> Tot va_pbool
[]
Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_Clmul128
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool
{ "end_col": 28, "end_line": 530, "start_col": 2, "start_line": 518 }
Prims.Tot
val va_wp_ShiftLeft2_128_1 (lo hi: poly) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (())))
val va_wp_ShiftLeft2_128_1 (lo hi: poly) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 let va_wp_ShiftLeft2_128_1 (lo hi: poly) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
false
null
false
(va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10: nat64) (va_x_v0: quad32) (va_x_v1: quad32) (va_x_v2: quad32) (va_x_v3: quad32). let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (())))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Vale.Math.Poly2_s.poly", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Prims.l_and", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Prims.op_LessThan", "Vale.Math.Poly2_s.degree", "Prims.op_LessThanOrEqual", "Prims.eq2", "Vale.Def.Types_s.quad32", "Vale.PPC64LE.Decls.va_get_vec", "Vale.Math.Poly2.Bits_s.to_quad32", "Prims.l_Forall", "Vale.PPC64LE.Machine_s.nat64", "Vale.PPC64LE.Machine_s.quad32", "Prims.l_imp", "Vale.Math.Poly2_s.mod", "Vale.Math.Poly2_s.div", "Vale.Math.Poly2_s.shift", "Vale.Math.Poly2_s.add", "Vale.Math.Poly2_s.mul", "Vale.Math.Poly2_s.monomial", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.Decls.va_upd_vec", "Vale.PPC64LE.Decls.va_upd_reg" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_wp_ShiftLeft2_128_1 (lo hi: poly) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
[]
Vale.AES.PPC64LE.GF128_Mul.va_wp_ShiftLeft2_128_1
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
lo: Vale.Math.Poly2_s.poly -> hi: Vale.Math.Poly2_s.poly -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Type0
{ "end_col": 16, "end_line": 203, "start_col": 2, "start_line": 194 }
Prims.Tot
val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ())))))))))))
val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code let va_code_ShiftLeft2_128_1 () =
false
null
false
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ())))))))))))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Prims.unit", "Vale.PPC64LE.Decls.va_Block", "Vale.PPC64LE.Decls.va_CCons", "Vale.PPC64LE.InsVector.va_code_Vspltisw", "Vale.PPC64LE.Decls.va_op_vec_opr_vec", "Vale.PPC64LE.InsBasic.va_code_LoadImm64", "Vale.PPC64LE.Decls.va_op_reg_opr_reg", "Vale.PPC64LE.InsVector.va_code_Mtvsrws", "Vale.PPC64LE.InsVector.va_code_Vsrw", "Vale.PPC64LE.InsVector.va_code_Vsldoi", "Vale.PPC64LE.InsVector.va_code_Vspltisb", "Vale.PPC64LE.InsVector.va_code_Vsl", "Vale.PPC64LE.InsVector.va_code_Vxor", "Vale.PPC64LE.Decls.va_CNil", "Vale.PPC64LE.Decls.va_code" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr]
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code
[]
Vale.AES.PPC64LE.GF128_Mul.va_code_ShiftLeft2_128_1
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code
{ "end_col": 71, "end_line": 86, "start_col": 2, "start_line": 79 }
Prims.Tot
val va_codegen_success_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_pbool
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_codegen_success_AddPoly dst src1 src2 = (va_pbool_and (va_codegen_success_Vxor dst src1 src2) (va_ttrue ()))
val va_codegen_success_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_pbool let va_codegen_success_AddPoly dst src1 src2 =
false
null
false
(va_pbool_and (va_codegen_success_Vxor dst src1 src2) (va_ttrue ()))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Vale.PPC64LE.Decls.va_operand_vec_opr", "Vale.PPC64LE.Decls.va_pbool_and", "Vale.PPC64LE.InsVector.va_codegen_success_Vxor", "Vale.PPC64LE.Decls.va_ttrue", "Vale.PPC64LE.Decls.va_pbool" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (()))) val va_wpProof_ShiftLeft2_128_1 : lo:poly -> hi:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ShiftLeft2_128_1 lo hi va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ShiftLeft2_128_1 lo hi va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft2_128_1 (va_code_ShiftLeft2_128_1 ()) va_s0 lo hi in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ShiftLeft2_128_1 (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (va_QProc (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ShiftLeft2_128_1 lo hi) (va_wpProof_ShiftLeft2_128_1 lo hi)) //-- //-- ClmulRev64High val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev64High () = (va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev64High () = (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ShiftLeft128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev64High (va_mods:va_mods_t) (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (va_arg18:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 116 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg18) (let (va_arg17:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 117 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg17) (let (va_arg16:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 118 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg16 64) (let (va_arg15:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 119 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg15 64) (let (va_arg14:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 120 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg14 64) (let (va_arg13:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 121 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg13 64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 122 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 123 column 19 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft128_1 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.reverse a 63) (Vale.Math.Poly2_s.reverse b 63))) (fun (va_s:va_state) _ -> let (va_arg12:Vale.Math.Poly2_s.poly) = b in let (va_arg11:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 125 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg11 va_arg12 63) (va_QEmpty (())))))))))))) val va_lemma_ClmulRev64High : va_b0:va_code -> va_s0:va_state -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ClmulRev64High ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) /\ va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_ClmulRev64High va_b0 va_s0 a b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ClmulRev64High va_mods a b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev64High ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 101 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 114 column 49 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ClmulRev64High (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0) in va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) ==> va_k va_sM (()))) val va_wpProof_ClmulRev64High : a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ClmulRev64High a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev64High a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_ClmulRev64High (va_code_ClmulRev64High ()) va_s0 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev64High (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (va_QProc (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) (va_wp_ClmulRev64High a b) (va_wpProof_ClmulRev64High a b)) //-- //-- High64ToLow [@ "opaque_to_smt"] let va_code_High64ToLow dst src = (va_Block (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_CNil ()))) [@ "opaque_to_smt"] let va_codegen_success_High64ToLow dst src = (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_ttrue ())) [@"opaque_to_smt"] let va_lemma_High64ToLow va_b0 va_s0 dst src a = va_reveal_opaque (`%va_code_High64ToLow) (va_code_High64ToLow dst src); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vsldoi (va_hd va_b1) va_s0 dst (va_op_vec_opr_vec 0) src 8 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_quad32_double_shift a; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_High64ToLow dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_High64ToLow (va_code_High64ToLow dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Low64ToHigh [@ "opaque_to_smt" va_qattr] let va_code_Low64ToHigh dst src = (va_Block (va_CCons (va_code_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_CNil ()))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Low64ToHigh dst src = (va_pbool_and (va_codegen_success_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Low64ToHigh (va_mods:va_mods_t) (dst:vec_opr) (src:vec_opr) (a:poly) : (va_quickCode unit (va_code_Low64ToHigh dst src)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 156 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (fun (va_s:va_state) _ -> let (va_arg4:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 157 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_shift va_arg4) (va_QEmpty (()))))) [@"opaque_to_smt"] let va_lemma_Low64ToHigh va_b0 va_s0 dst src a = let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr dst] in let va_qc = va_qcode_Low64ToHigh va_mods dst src a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Low64ToHigh dst src) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 144 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 154 column 66 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod a (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr dst]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Low64ToHigh dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_Low64ToHigh (va_code_Low64ToHigh dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- AddPoly val va_code_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_AddPoly dst src1 src2 = (va_Block (va_CCons (va_code_Vxor dst src1 src2) (va_CNil ()))) val va_codegen_success_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"]
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_codegen_success_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_pbool
[]
Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_AddPoly
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
dst: Vale.PPC64LE.Decls.va_operand_vec_opr -> src1: Vale.PPC64LE.Decls.va_operand_vec_opr -> src2: Vale.PPC64LE.Decls.va_operand_vec_opr -> Vale.PPC64LE.Decls.va_pbool
{ "end_col": 70, "end_line": 440, "start_col": 2, "start_line": 440 }
Prims.Tot
val va_wp_AddPoly (dst src1 src2: va_operand_vec_opr) (a b: poly) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_wp_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b /\ (forall (va_x_dst:va_value_vec_opr) . let va_sM = va_upd_operand_vec_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) ==> va_k va_sM (())))
val va_wp_AddPoly (dst src1 src2: va_operand_vec_opr) (a b: poly) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 let va_wp_AddPoly (dst src1 src2: va_operand_vec_opr) (a b: poly) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
false
null
false
(va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b /\ (forall (va_x_dst: va_value_vec_opr). let va_sM = va_upd_operand_vec_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) ==> va_k va_sM (())))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Vale.PPC64LE.Decls.va_operand_vec_opr", "Vale.Math.Poly2_s.poly", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Prims.l_and", "Vale.PPC64LE.Decls.va_is_dst_vec_opr", "Vale.PPC64LE.Decls.va_is_src_vec_opr", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Prims.op_LessThanOrEqual", "Vale.Math.Poly2_s.degree", "Prims.eq2", "Vale.Def.Types_s.quad32", "Vale.PPC64LE.Decls.va_eval_vec_opr", "Vale.Math.Poly2.Bits_s.to_quad32", "Prims.l_Forall", "Vale.PPC64LE.Decls.va_value_vec_opr", "Prims.l_imp", "Vale.Math.Poly2_s.add", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.Decls.va_upd_operand_vec_opr" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (()))) val va_wpProof_ShiftLeft2_128_1 : lo:poly -> hi:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ShiftLeft2_128_1 lo hi va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ShiftLeft2_128_1 lo hi va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft2_128_1 (va_code_ShiftLeft2_128_1 ()) va_s0 lo hi in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ShiftLeft2_128_1 (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (va_QProc (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ShiftLeft2_128_1 lo hi) (va_wpProof_ShiftLeft2_128_1 lo hi)) //-- //-- ClmulRev64High val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev64High () = (va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev64High () = (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ShiftLeft128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev64High (va_mods:va_mods_t) (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (va_arg18:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 116 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg18) (let (va_arg17:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 117 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg17) (let (va_arg16:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 118 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg16 64) (let (va_arg15:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 119 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg15 64) (let (va_arg14:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 120 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg14 64) (let (va_arg13:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 121 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg13 64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 122 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 123 column 19 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft128_1 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.reverse a 63) (Vale.Math.Poly2_s.reverse b 63))) (fun (va_s:va_state) _ -> let (va_arg12:Vale.Math.Poly2_s.poly) = b in let (va_arg11:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 125 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg11 va_arg12 63) (va_QEmpty (())))))))))))) val va_lemma_ClmulRev64High : va_b0:va_code -> va_s0:va_state -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ClmulRev64High ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) /\ va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_ClmulRev64High va_b0 va_s0 a b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ClmulRev64High va_mods a b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev64High ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 101 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 114 column 49 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ClmulRev64High (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0) in va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) ==> va_k va_sM (()))) val va_wpProof_ClmulRev64High : a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ClmulRev64High a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev64High a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_ClmulRev64High (va_code_ClmulRev64High ()) va_s0 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev64High (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (va_QProc (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) (va_wp_ClmulRev64High a b) (va_wpProof_ClmulRev64High a b)) //-- //-- High64ToLow [@ "opaque_to_smt"] let va_code_High64ToLow dst src = (va_Block (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_CNil ()))) [@ "opaque_to_smt"] let va_codegen_success_High64ToLow dst src = (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_ttrue ())) [@"opaque_to_smt"] let va_lemma_High64ToLow va_b0 va_s0 dst src a = va_reveal_opaque (`%va_code_High64ToLow) (va_code_High64ToLow dst src); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vsldoi (va_hd va_b1) va_s0 dst (va_op_vec_opr_vec 0) src 8 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_quad32_double_shift a; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_High64ToLow dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_High64ToLow (va_code_High64ToLow dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Low64ToHigh [@ "opaque_to_smt" va_qattr] let va_code_Low64ToHigh dst src = (va_Block (va_CCons (va_code_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_CNil ()))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Low64ToHigh dst src = (va_pbool_and (va_codegen_success_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Low64ToHigh (va_mods:va_mods_t) (dst:vec_opr) (src:vec_opr) (a:poly) : (va_quickCode unit (va_code_Low64ToHigh dst src)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 156 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (fun (va_s:va_state) _ -> let (va_arg4:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 157 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_shift va_arg4) (va_QEmpty (()))))) [@"opaque_to_smt"] let va_lemma_Low64ToHigh va_b0 va_s0 dst src a = let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr dst] in let va_qc = va_qcode_Low64ToHigh va_mods dst src a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Low64ToHigh dst src) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 144 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 154 column 66 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod a (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr dst]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Low64ToHigh dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_Low64ToHigh (va_code_Low64ToHigh dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- AddPoly val va_code_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_AddPoly dst src1 src2 = (va_Block (va_CCons (va_code_Vxor dst src1 src2) (va_CNil ()))) val va_codegen_success_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_AddPoly dst src1 src2 = (va_pbool_and (va_codegen_success_Vxor dst src1 src2) (va_ttrue ())) val va_lemma_AddPoly : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_AddPoly dst src1 src2) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)))) [@"opaque_to_smt"] let va_lemma_AddPoly va_b0 va_s0 dst src1 src2 a b = va_reveal_opaque (`%va_code_AddPoly) (va_code_AddPoly dst src1 src2); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vxor (va_hd va_b1) va_s0 dst src1 src2 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_add128 a b; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr)
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_wp_AddPoly (dst src1 src2: va_operand_vec_opr) (a b: poly) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
[]
Vale.AES.PPC64LE.GF128_Mul.va_wp_AddPoly
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
dst: Vale.PPC64LE.Decls.va_operand_vec_opr -> src1: Vale.PPC64LE.Decls.va_operand_vec_opr -> src2: Vale.PPC64LE.Decls.va_operand_vec_opr -> a: Vale.Math.Poly2_s.poly -> b: Vale.Math.Poly2_s.poly -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Type0
{ "end_col": 86, "end_line": 474, "start_col": 2, "start_line": 469 }
Prims.Tot
val va_codegen_success_Gf128ModulusRev : dst:va_operand_vec_opr -> Tot va_pbool
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_codegen_success_Gf128ModulusRev dst = (va_pbool_and (va_codegen_success_Vxor dst dst dst) (va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-7936)) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 3) dst 12) (va_ttrue ())))))
val va_codegen_success_Gf128ModulusRev : dst:va_operand_vec_opr -> Tot va_pbool let va_codegen_success_Gf128ModulusRev dst =
false
null
false
(va_pbool_and (va_codegen_success_Vxor dst dst dst) (va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (- 7936)) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 3) dst 12) (va_ttrue ()) ))))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Vale.PPC64LE.Decls.va_operand_vec_opr", "Vale.PPC64LE.Decls.va_pbool_and", "Vale.PPC64LE.InsVector.va_codegen_success_Vxor", "Vale.PPC64LE.InsBasic.va_codegen_success_LoadImmShl64", "Vale.PPC64LE.Decls.va_op_reg_opr_reg", "Prims.op_Minus", "Vale.PPC64LE.InsVector.va_codegen_success_Mtvsrws", "Vale.PPC64LE.Decls.va_op_vec_opr_vec", "Vale.PPC64LE.InsVector.va_codegen_success_Vsldoi", "Vale.PPC64LE.Decls.va_ttrue", "Vale.PPC64LE.Decls.va_pbool" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (()))) val va_wpProof_ShiftLeft2_128_1 : lo:poly -> hi:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ShiftLeft2_128_1 lo hi va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ShiftLeft2_128_1 lo hi va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft2_128_1 (va_code_ShiftLeft2_128_1 ()) va_s0 lo hi in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ShiftLeft2_128_1 (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (va_QProc (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ShiftLeft2_128_1 lo hi) (va_wpProof_ShiftLeft2_128_1 lo hi)) //-- //-- ClmulRev64High val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev64High () = (va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev64High () = (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ShiftLeft128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev64High (va_mods:va_mods_t) (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (va_arg18:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 116 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg18) (let (va_arg17:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 117 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg17) (let (va_arg16:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 118 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg16 64) (let (va_arg15:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 119 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg15 64) (let (va_arg14:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 120 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg14 64) (let (va_arg13:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 121 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg13 64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 122 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 123 column 19 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft128_1 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.reverse a 63) (Vale.Math.Poly2_s.reverse b 63))) (fun (va_s:va_state) _ -> let (va_arg12:Vale.Math.Poly2_s.poly) = b in let (va_arg11:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 125 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg11 va_arg12 63) (va_QEmpty (())))))))))))) val va_lemma_ClmulRev64High : va_b0:va_code -> va_s0:va_state -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ClmulRev64High ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) /\ va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_ClmulRev64High va_b0 va_s0 a b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ClmulRev64High va_mods a b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev64High ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 101 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 114 column 49 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ClmulRev64High (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0) in va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) ==> va_k va_sM (()))) val va_wpProof_ClmulRev64High : a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ClmulRev64High a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev64High a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_ClmulRev64High (va_code_ClmulRev64High ()) va_s0 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev64High (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (va_QProc (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) (va_wp_ClmulRev64High a b) (va_wpProof_ClmulRev64High a b)) //-- //-- High64ToLow [@ "opaque_to_smt"] let va_code_High64ToLow dst src = (va_Block (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_CNil ()))) [@ "opaque_to_smt"] let va_codegen_success_High64ToLow dst src = (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_ttrue ())) [@"opaque_to_smt"] let va_lemma_High64ToLow va_b0 va_s0 dst src a = va_reveal_opaque (`%va_code_High64ToLow) (va_code_High64ToLow dst src); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vsldoi (va_hd va_b1) va_s0 dst (va_op_vec_opr_vec 0) src 8 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_quad32_double_shift a; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_High64ToLow dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_High64ToLow (va_code_High64ToLow dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Low64ToHigh [@ "opaque_to_smt" va_qattr] let va_code_Low64ToHigh dst src = (va_Block (va_CCons (va_code_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_CNil ()))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Low64ToHigh dst src = (va_pbool_and (va_codegen_success_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Low64ToHigh (va_mods:va_mods_t) (dst:vec_opr) (src:vec_opr) (a:poly) : (va_quickCode unit (va_code_Low64ToHigh dst src)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 156 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (fun (va_s:va_state) _ -> let (va_arg4:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 157 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_shift va_arg4) (va_QEmpty (()))))) [@"opaque_to_smt"] let va_lemma_Low64ToHigh va_b0 va_s0 dst src a = let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr dst] in let va_qc = va_qcode_Low64ToHigh va_mods dst src a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Low64ToHigh dst src) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 144 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 154 column 66 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod a (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr dst]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Low64ToHigh dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_Low64ToHigh (va_code_Low64ToHigh dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- AddPoly val va_code_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_AddPoly dst src1 src2 = (va_Block (va_CCons (va_code_Vxor dst src1 src2) (va_CNil ()))) val va_codegen_success_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_AddPoly dst src1 src2 = (va_pbool_and (va_codegen_success_Vxor dst src1 src2) (va_ttrue ())) val va_lemma_AddPoly : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_AddPoly dst src1 src2) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)))) [@"opaque_to_smt"] let va_lemma_AddPoly va_b0 va_s0 dst src1 src2 a b = va_reveal_opaque (`%va_code_AddPoly) (va_code_AddPoly dst src1 src2); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vxor (va_hd va_b1) va_s0 dst src1 src2 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_add128 a b; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b /\ (forall (va_x_dst:va_value_vec_opr) . let va_sM = va_upd_operand_vec_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) ==> va_k va_sM (()))) val va_wpProof_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_AddPoly dst src1 src2 a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_AddPoly dst src1 src2 a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_AddPoly (va_code_AddPoly dst src1 src2) va_s0 dst src1 src2 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) : (va_quickCode unit (va_code_AddPoly dst src1 src2)) = (va_QProc (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) (va_wp_AddPoly dst src1 src2 a b) (va_wpProof_AddPoly dst src1 src2 a b)) //-- //-- Clmul128 val va_code_Clmul128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Clmul128 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CNil ()))))))))))))) val va_codegen_success_Clmul128 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Clmul128 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Clmul128 (va_mods:va_mods_t) (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_Clmul128 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in let (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab n in let (b:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ab n in let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div cd n in let (d:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod cd n in let (ac:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a c in let (ad:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a d in let (bc:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul b c in let (bd:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul b d in let (ab_sw:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap ab 64 in let (ab_hi:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ab n in let (ab_lo:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div ab n) n in let (va_arg77:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 202 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg77) (let (va_arg76:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 203 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg76) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 205 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 206 column 10 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (fun (va_s:va_state) _ -> let (va_arg75:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 207 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg75) (let (va_arg74:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 208 column 29 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg74) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 209 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double ab_sw) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 210 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) ab_sw) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 211 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3) ab_sw) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 212 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 4 va_s == Vale.Math.Poly2.Bits_s.to_quad32 ab_hi) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 213 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 5 va_s == Vale.Math.Poly2.Bits_s.to_quad32 ab_lo) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 215 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 217 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 ab_hi) (let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab_hi n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 218 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg73) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 219 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_hi 64) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 220 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 222 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 ab_lo) (let (va_arg72:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 223 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg72 n) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 224 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_lo 64) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 225 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg71:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 227 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg71) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 228 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_sw 64) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 229 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_sw 64) (let (va_arg70:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 230 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg70 64) (let (va_arg69:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 231 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg69 64) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 232 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s) == Vale.Math.Poly2_s.add ad bc) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 234 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_hi 64) (let (va_arg68:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 235 column 18 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg68 n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 236 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s) == bd) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 238 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_lo 64) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 239 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s) == ac) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 241 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3) (Vale.Math.Poly2_s.add ad bc)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 242 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_distribute ad bc n) (let (va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod bc n in let (va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ad n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 243 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_distribute_left va_arg66 va_arg67 n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 244 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_s == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n))) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 246 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3) (Vale.Math.Poly2_s.add ad bc)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 247 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GHash_BE.lemma_div_distribute ad bc n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 248 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_s == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.div ad n) (Vale.Math.Poly2_s.div bc n))) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 250 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4) (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n)) bd) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 251 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2) ac (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.div ad n) (Vale.Math.Poly2_s.div bc n))) (fun (va_s:va_state) _ -> let (va_arg65:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div bc n in let (va_arg64:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ad n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 253 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg64 va_arg65) (let (va_arg63:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ad n in let (va_arg62:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div bc n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 254 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_associate ac va_arg62 va_arg63) (let (hi:poly) = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.add ac (Vale.Math.Poly2_s.div bc n)) (Vale.Math.Poly2_s.div ad n) in let (va_arg61:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n in let (va_arg60:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 256 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg60 va_arg61) (let (lo:poly) = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n)) bd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 259 column 20 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_gf128_mul a b c d 64) (va_QEmpty ((lo, hi)))))))))))))))))))))))))))))))))))))))))))))))) val va_lemma_Clmul128 : va_b0:va_code -> va_s0:va_state -> ab:poly -> cd:poly -> Ghost (va_state & va_fuel & poly & poly) (requires (va_require_total va_b0 (va_code_Clmul128 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 ab /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 cd)) (ensures (fun (va_sM, va_fM, lo, hi) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))) [@"opaque_to_smt"] let va_lemma_Clmul128 va_b0 va_s0 ab cd = let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok] in let va_qc = va_qcode_Clmul128 va_mods ab cd in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Clmul128 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let (lo, hi) = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree lo <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree hi < 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 186 column 47 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0; let (lo, hi) = va_g in (va_sM, va_fM, lo, hi) [@ va_qattr] let va_wp_Clmul128 (ab:poly) (cd:poly) (va_s0:va_state) (va_k:(va_state -> (poly & poly) -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 ab /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 cd /\ (forall (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (lo:poly) (hi:poly) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 va_s0))))) in va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi ==> va_k va_sM ((lo, hi)))) val va_wpProof_Clmul128 : ab:poly -> cd:poly -> va_s0:va_state -> va_k:(va_state -> (poly & poly) -> Type0) -> Ghost (va_state & va_fuel & (poly & poly)) (requires (va_t_require va_s0 /\ va_wp_Clmul128 ab cd va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Clmul128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Clmul128 ab cd va_s0 va_k = let (va_sM, va_f0, lo, hi) = va_lemma_Clmul128 (va_code_Clmul128 ()) va_s0 ab cd in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0)))))))); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_sM va_s0; let va_g = (lo, hi) in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Clmul128 (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_Clmul128 ())) = (va_QProc (va_code_Clmul128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_Clmul128 ab cd) (va_wpProof_Clmul128 ab cd)) //-- //-- ClmulRev128 val va_code_ClmulRev128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev128 () = (va_Block (va_CCons (va_code_Clmul128 ()) (va_CCons (va_code_ShiftLeft2_128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev128 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev128 () = (va_pbool_and (va_codegen_success_Clmul128 ()) (va_pbool_and (va_codegen_success_ShiftLeft2_128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev128 (va_mods:va_mods_t) (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_ClmulRev128 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 279 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Clmul128 (Vale.Math.Poly2_s.reverse ab 127) (Vale.Math.Poly2_s.reverse cd 127)) (fun (va_s:va_state) va_g -> let (lo, hi) = va_g in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 280 column 21 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft2_128_1 lo hi) (fun (va_s:va_state) _ -> let (m:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) 1 in let (va_arg13:Vale.Math.Poly2_s.poly) = lo in let (va_arg12:Vale.Math.Poly2_s.poly) = hi in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 283 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_combine_define va_arg12 va_arg13 128) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 284 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_split_define m 128) (let (lo:poly) = Vale.Math.Poly2_s.mod m (Vale.Math.Poly2_s.monomial 128) in let (hi:poly) = Vale.Math.Poly2_s.div m (Vale.Math.Poly2_s.monomial 128) in let (va_arg11:Vale.Math.Poly2_s.poly) = cd in let (va_arg10:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 287 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg10 va_arg11 127) (va_QEmpty ((lo, hi))))))))) val va_lemma_ClmulRev128 : va_b0:va_code -> va_s0:va_state -> ab:poly -> cd:poly -> Ghost (va_state & va_fuel & poly & poly) (requires (va_require_total va_b0 (va_code_ClmulRev128 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse ab 127) /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse cd 127))) (ensures (fun (va_sM, va_fM, lo, hi) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi <= 127 /\ Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))) [@"opaque_to_smt"] let va_lemma_ClmulRev128 va_b0 va_s0 ab cd = let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ClmulRev128 va_mods ab cd in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev128 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let (lo, hi) = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 262 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 273 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree lo <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 274 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree hi <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 275 column 61 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 276 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 277 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; let (lo, hi) = va_g in (va_sM, va_fM, lo, hi) [@ va_qattr] let va_wp_ClmulRev128 (ab:poly) (cd:poly) (va_s0:va_state) (va_k:(va_state -> (poly & poly) -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse ab 127) /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse cd 127) /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (lo:poly) (hi:poly) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))))) in va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi <= 127 /\ Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi ==> va_k va_sM ((lo, hi)))) val va_wpProof_ClmulRev128 : ab:poly -> cd:poly -> va_s0:va_state -> va_k:(va_state -> (poly & poly) -> Type0) -> Ghost (va_state & va_fuel & (poly & poly)) (requires (va_t_require va_s0 /\ va_wp_ClmulRev128 ab cd va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev128 ab cd va_s0 va_k = let (va_sM, va_f0, lo, hi) = va_lemma_ClmulRev128 (va_code_ClmulRev128 ()) va_s0 ab cd in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = (lo, hi) in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev128 (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_ClmulRev128 ())) = (va_QProc (va_code_ClmulRev128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ClmulRev128 ab cd) (va_wpProof_ClmulRev128 ab cd)) //-- //-- Gf128ModulusRev val va_code_Gf128ModulusRev : dst:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_Gf128ModulusRev dst = (va_Block (va_CCons (va_code_Vxor dst dst dst) (va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) (-7936)) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 3) dst 12) (va_CNil ())))))) val va_codegen_success_Gf128ModulusRev : dst:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"]
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_codegen_success_Gf128ModulusRev : dst:va_operand_vec_opr -> Tot va_pbool
[]
Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_Gf128ModulusRev
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
dst: Vale.PPC64LE.Decls.va_operand_vec_opr -> Vale.PPC64LE.Decls.va_pbool
{ "end_col": 82, "end_line": 885, "start_col": 2, "start_line": 882 }
Prims.Tot
val va_wp_ClmulRev64High (a b: poly) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_wp_ClmulRev64High (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0) in va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) ==> va_k va_sM (())))
val va_wp_ClmulRev64High (a b: poly) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 let va_wp_ClmulRev64High (a b: poly) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
false
null
false
(va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero) /\ (forall (va_x_v1: quad32) (va_x_v2: quad32). let va_sM = va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0) in va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) ==> va_k va_sM (())))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Vale.Math.Poly2_s.poly", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Prims.l_and", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Prims.op_LessThanOrEqual", "Vale.Math.Poly2_s.degree", "Prims.eq2", "Vale.Math.Poly2_s.reverse", "Vale.Math.Poly2.Bits_s.of_double32", "Vale.Arch.Types.quad32_double_hi", "Vale.PPC64LE.Decls.va_get_vec", "Prims.l_or", "Vale.Arch.Types.quad32_double_lo", "Vale.Math.Poly2_s.zero", "Prims.l_Forall", "Vale.PPC64LE.Machine_s.quad32", "Prims.l_imp", "Vale.Def.Types_s.quad32", "Vale.Math.Poly2.Bits_s.to_quad32", "Vale.Math.Poly2_s.mul", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.Decls.va_upd_vec" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (()))) val va_wpProof_ShiftLeft2_128_1 : lo:poly -> hi:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ShiftLeft2_128_1 lo hi va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ShiftLeft2_128_1 lo hi va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft2_128_1 (va_code_ShiftLeft2_128_1 ()) va_s0 lo hi in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ShiftLeft2_128_1 (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (va_QProc (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ShiftLeft2_128_1 lo hi) (va_wpProof_ShiftLeft2_128_1 lo hi)) //-- //-- ClmulRev64High val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev64High () = (va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev64High () = (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ShiftLeft128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev64High (va_mods:va_mods_t) (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (va_arg18:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 116 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg18) (let (va_arg17:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 117 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg17) (let (va_arg16:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 118 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg16 64) (let (va_arg15:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 119 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg15 64) (let (va_arg14:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 120 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg14 64) (let (va_arg13:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 121 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg13 64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 122 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 123 column 19 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft128_1 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.reverse a 63) (Vale.Math.Poly2_s.reverse b 63))) (fun (va_s:va_state) _ -> let (va_arg12:Vale.Math.Poly2_s.poly) = b in let (va_arg11:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 125 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg11 va_arg12 63) (va_QEmpty (())))))))))))) val va_lemma_ClmulRev64High : va_b0:va_code -> va_s0:va_state -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ClmulRev64High ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) /\ va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_ClmulRev64High va_b0 va_s0 a b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ClmulRev64High va_mods a b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev64High ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 101 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 114 column 49 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ClmulRev64High (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_wp_ClmulRev64High (a b: poly) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0
[]
Vale.AES.PPC64LE.GF128_Mul.va_wp_ClmulRev64High
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Vale.Math.Poly2_s.poly -> b: Vale.Math.Poly2_s.poly -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Type0
{ "end_col": 25, "end_line": 325, "start_col": 2, "start_line": 316 }
Prims.Tot
val va_codegen_success_ReduceMulRev128 : va_dummy:unit -> Tot va_pbool
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_codegen_success_ReduceMulRev128 () = (va_pbool_and (va_codegen_success_ClmulRev128 ()) (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Gf128ModulusRev (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ClmulRev128 ()) (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Gf128ModulusRev (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ClmulRev64High ()) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_ttrue ()))))))))))
val va_codegen_success_ReduceMulRev128 : va_dummy:unit -> Tot va_pbool let va_codegen_success_ReduceMulRev128 () =
false
null
false
(va_pbool_and (va_codegen_success_ClmulRev128 ()) (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Gf128ModulusRev (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ClmulRev128 ()) (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Gf128ModulusRev (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ClmulRev64High ()) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_ttrue ()))))))))))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Prims.unit", "Vale.PPC64LE.Decls.va_pbool_and", "Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_ClmulRev128", "Vale.PPC64LE.InsVector.va_codegen_success_Vmr", "Vale.PPC64LE.Decls.va_op_vec_opr_vec", "Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_Gf128ModulusRev", "Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_ClmulRev64High", "Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_AddPoly", "Vale.PPC64LE.Decls.va_ttrue", "Vale.PPC64LE.Decls.va_pbool" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (()))) val va_wpProof_ShiftLeft2_128_1 : lo:poly -> hi:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ShiftLeft2_128_1 lo hi va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ShiftLeft2_128_1 lo hi va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft2_128_1 (va_code_ShiftLeft2_128_1 ()) va_s0 lo hi in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ShiftLeft2_128_1 (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (va_QProc (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ShiftLeft2_128_1 lo hi) (va_wpProof_ShiftLeft2_128_1 lo hi)) //-- //-- ClmulRev64High val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev64High () = (va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev64High () = (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ShiftLeft128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev64High (va_mods:va_mods_t) (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (va_arg18:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 116 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg18) (let (va_arg17:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 117 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg17) (let (va_arg16:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 118 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg16 64) (let (va_arg15:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 119 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg15 64) (let (va_arg14:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 120 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg14 64) (let (va_arg13:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 121 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg13 64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 122 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 123 column 19 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft128_1 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.reverse a 63) (Vale.Math.Poly2_s.reverse b 63))) (fun (va_s:va_state) _ -> let (va_arg12:Vale.Math.Poly2_s.poly) = b in let (va_arg11:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 125 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg11 va_arg12 63) (va_QEmpty (())))))))))))) val va_lemma_ClmulRev64High : va_b0:va_code -> va_s0:va_state -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ClmulRev64High ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) /\ va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_ClmulRev64High va_b0 va_s0 a b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ClmulRev64High va_mods a b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev64High ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 101 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 114 column 49 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ClmulRev64High (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0) in va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) ==> va_k va_sM (()))) val va_wpProof_ClmulRev64High : a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ClmulRev64High a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev64High a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_ClmulRev64High (va_code_ClmulRev64High ()) va_s0 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev64High (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (va_QProc (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) (va_wp_ClmulRev64High a b) (va_wpProof_ClmulRev64High a b)) //-- //-- High64ToLow [@ "opaque_to_smt"] let va_code_High64ToLow dst src = (va_Block (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_CNil ()))) [@ "opaque_to_smt"] let va_codegen_success_High64ToLow dst src = (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_ttrue ())) [@"opaque_to_smt"] let va_lemma_High64ToLow va_b0 va_s0 dst src a = va_reveal_opaque (`%va_code_High64ToLow) (va_code_High64ToLow dst src); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vsldoi (va_hd va_b1) va_s0 dst (va_op_vec_opr_vec 0) src 8 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_quad32_double_shift a; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_High64ToLow dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_High64ToLow (va_code_High64ToLow dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Low64ToHigh [@ "opaque_to_smt" va_qattr] let va_code_Low64ToHigh dst src = (va_Block (va_CCons (va_code_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_CNil ()))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Low64ToHigh dst src = (va_pbool_and (va_codegen_success_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Low64ToHigh (va_mods:va_mods_t) (dst:vec_opr) (src:vec_opr) (a:poly) : (va_quickCode unit (va_code_Low64ToHigh dst src)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 156 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (fun (va_s:va_state) _ -> let (va_arg4:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 157 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_shift va_arg4) (va_QEmpty (()))))) [@"opaque_to_smt"] let va_lemma_Low64ToHigh va_b0 va_s0 dst src a = let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr dst] in let va_qc = va_qcode_Low64ToHigh va_mods dst src a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Low64ToHigh dst src) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 144 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 154 column 66 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod a (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr dst]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Low64ToHigh dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_Low64ToHigh (va_code_Low64ToHigh dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- AddPoly val va_code_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_AddPoly dst src1 src2 = (va_Block (va_CCons (va_code_Vxor dst src1 src2) (va_CNil ()))) val va_codegen_success_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_AddPoly dst src1 src2 = (va_pbool_and (va_codegen_success_Vxor dst src1 src2) (va_ttrue ())) val va_lemma_AddPoly : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_AddPoly dst src1 src2) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)))) [@"opaque_to_smt"] let va_lemma_AddPoly va_b0 va_s0 dst src1 src2 a b = va_reveal_opaque (`%va_code_AddPoly) (va_code_AddPoly dst src1 src2); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vxor (va_hd va_b1) va_s0 dst src1 src2 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_add128 a b; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b /\ (forall (va_x_dst:va_value_vec_opr) . let va_sM = va_upd_operand_vec_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) ==> va_k va_sM (()))) val va_wpProof_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_AddPoly dst src1 src2 a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_AddPoly dst src1 src2 a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_AddPoly (va_code_AddPoly dst src1 src2) va_s0 dst src1 src2 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) : (va_quickCode unit (va_code_AddPoly dst src1 src2)) = (va_QProc (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) (va_wp_AddPoly dst src1 src2 a b) (va_wpProof_AddPoly dst src1 src2 a b)) //-- //-- Clmul128 val va_code_Clmul128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Clmul128 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CNil ()))))))))))))) val va_codegen_success_Clmul128 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Clmul128 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Clmul128 (va_mods:va_mods_t) (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_Clmul128 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in let (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab n in let (b:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ab n in let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div cd n in let (d:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod cd n in let (ac:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a c in let (ad:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a d in let (bc:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul b c in let (bd:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul b d in let (ab_sw:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap ab 64 in let (ab_hi:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ab n in let (ab_lo:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div ab n) n in let (va_arg77:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 202 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg77) (let (va_arg76:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 203 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg76) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 205 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 206 column 10 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (fun (va_s:va_state) _ -> let (va_arg75:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 207 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg75) (let (va_arg74:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 208 column 29 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg74) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 209 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double ab_sw) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 210 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) ab_sw) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 211 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3) ab_sw) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 212 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 4 va_s == Vale.Math.Poly2.Bits_s.to_quad32 ab_hi) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 213 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 5 va_s == Vale.Math.Poly2.Bits_s.to_quad32 ab_lo) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 215 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 217 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 ab_hi) (let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab_hi n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 218 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg73) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 219 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_hi 64) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 220 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 222 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 ab_lo) (let (va_arg72:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 223 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg72 n) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 224 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_lo 64) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 225 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg71:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 227 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg71) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 228 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_sw 64) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 229 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_sw 64) (let (va_arg70:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 230 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg70 64) (let (va_arg69:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 231 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg69 64) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 232 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s) == Vale.Math.Poly2_s.add ad bc) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 234 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_hi 64) (let (va_arg68:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 235 column 18 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg68 n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 236 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s) == bd) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 238 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_lo 64) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 239 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s) == ac) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 241 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3) (Vale.Math.Poly2_s.add ad bc)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 242 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_distribute ad bc n) (let (va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod bc n in let (va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ad n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 243 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_distribute_left va_arg66 va_arg67 n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 244 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_s == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n))) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 246 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3) (Vale.Math.Poly2_s.add ad bc)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 247 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GHash_BE.lemma_div_distribute ad bc n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 248 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_s == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.div ad n) (Vale.Math.Poly2_s.div bc n))) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 250 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4) (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n)) bd) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 251 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2) ac (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.div ad n) (Vale.Math.Poly2_s.div bc n))) (fun (va_s:va_state) _ -> let (va_arg65:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div bc n in let (va_arg64:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ad n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 253 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg64 va_arg65) (let (va_arg63:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ad n in let (va_arg62:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div bc n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 254 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_associate ac va_arg62 va_arg63) (let (hi:poly) = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.add ac (Vale.Math.Poly2_s.div bc n)) (Vale.Math.Poly2_s.div ad n) in let (va_arg61:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n in let (va_arg60:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 256 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg60 va_arg61) (let (lo:poly) = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n)) bd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 259 column 20 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_gf128_mul a b c d 64) (va_QEmpty ((lo, hi)))))))))))))))))))))))))))))))))))))))))))))))) val va_lemma_Clmul128 : va_b0:va_code -> va_s0:va_state -> ab:poly -> cd:poly -> Ghost (va_state & va_fuel & poly & poly) (requires (va_require_total va_b0 (va_code_Clmul128 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 ab /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 cd)) (ensures (fun (va_sM, va_fM, lo, hi) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))) [@"opaque_to_smt"] let va_lemma_Clmul128 va_b0 va_s0 ab cd = let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok] in let va_qc = va_qcode_Clmul128 va_mods ab cd in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Clmul128 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let (lo, hi) = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree lo <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree hi < 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 186 column 47 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0; let (lo, hi) = va_g in (va_sM, va_fM, lo, hi) [@ va_qattr] let va_wp_Clmul128 (ab:poly) (cd:poly) (va_s0:va_state) (va_k:(va_state -> (poly & poly) -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 ab /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 cd /\ (forall (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (lo:poly) (hi:poly) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 va_s0))))) in va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi ==> va_k va_sM ((lo, hi)))) val va_wpProof_Clmul128 : ab:poly -> cd:poly -> va_s0:va_state -> va_k:(va_state -> (poly & poly) -> Type0) -> Ghost (va_state & va_fuel & (poly & poly)) (requires (va_t_require va_s0 /\ va_wp_Clmul128 ab cd va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Clmul128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Clmul128 ab cd va_s0 va_k = let (va_sM, va_f0, lo, hi) = va_lemma_Clmul128 (va_code_Clmul128 ()) va_s0 ab cd in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0)))))))); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_sM va_s0; let va_g = (lo, hi) in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Clmul128 (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_Clmul128 ())) = (va_QProc (va_code_Clmul128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_Clmul128 ab cd) (va_wpProof_Clmul128 ab cd)) //-- //-- ClmulRev128 val va_code_ClmulRev128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev128 () = (va_Block (va_CCons (va_code_Clmul128 ()) (va_CCons (va_code_ShiftLeft2_128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev128 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev128 () = (va_pbool_and (va_codegen_success_Clmul128 ()) (va_pbool_and (va_codegen_success_ShiftLeft2_128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev128 (va_mods:va_mods_t) (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_ClmulRev128 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 279 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Clmul128 (Vale.Math.Poly2_s.reverse ab 127) (Vale.Math.Poly2_s.reverse cd 127)) (fun (va_s:va_state) va_g -> let (lo, hi) = va_g in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 280 column 21 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft2_128_1 lo hi) (fun (va_s:va_state) _ -> let (m:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) 1 in let (va_arg13:Vale.Math.Poly2_s.poly) = lo in let (va_arg12:Vale.Math.Poly2_s.poly) = hi in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 283 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_combine_define va_arg12 va_arg13 128) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 284 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_split_define m 128) (let (lo:poly) = Vale.Math.Poly2_s.mod m (Vale.Math.Poly2_s.monomial 128) in let (hi:poly) = Vale.Math.Poly2_s.div m (Vale.Math.Poly2_s.monomial 128) in let (va_arg11:Vale.Math.Poly2_s.poly) = cd in let (va_arg10:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 287 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg10 va_arg11 127) (va_QEmpty ((lo, hi))))))))) val va_lemma_ClmulRev128 : va_b0:va_code -> va_s0:va_state -> ab:poly -> cd:poly -> Ghost (va_state & va_fuel & poly & poly) (requires (va_require_total va_b0 (va_code_ClmulRev128 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse ab 127) /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse cd 127))) (ensures (fun (va_sM, va_fM, lo, hi) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi <= 127 /\ Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))) [@"opaque_to_smt"] let va_lemma_ClmulRev128 va_b0 va_s0 ab cd = let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ClmulRev128 va_mods ab cd in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev128 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let (lo, hi) = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 262 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 273 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree lo <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 274 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree hi <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 275 column 61 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 276 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 277 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; let (lo, hi) = va_g in (va_sM, va_fM, lo, hi) [@ va_qattr] let va_wp_ClmulRev128 (ab:poly) (cd:poly) (va_s0:va_state) (va_k:(va_state -> (poly & poly) -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse ab 127) /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse cd 127) /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (lo:poly) (hi:poly) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))))) in va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi <= 127 /\ Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi ==> va_k va_sM ((lo, hi)))) val va_wpProof_ClmulRev128 : ab:poly -> cd:poly -> va_s0:va_state -> va_k:(va_state -> (poly & poly) -> Type0) -> Ghost (va_state & va_fuel & (poly & poly)) (requires (va_t_require va_s0 /\ va_wp_ClmulRev128 ab cd va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev128 ab cd va_s0 va_k = let (va_sM, va_f0, lo, hi) = va_lemma_ClmulRev128 (va_code_ClmulRev128 ()) va_s0 ab cd in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = (lo, hi) in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev128 (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_ClmulRev128 ())) = (va_QProc (va_code_ClmulRev128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ClmulRev128 ab cd) (va_wpProof_ClmulRev128 ab cd)) //-- //-- Gf128ModulusRev val va_code_Gf128ModulusRev : dst:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_Gf128ModulusRev dst = (va_Block (va_CCons (va_code_Vxor dst dst dst) (va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) (-7936)) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 3) dst 12) (va_CNil ())))))) val va_codegen_success_Gf128ModulusRev : dst:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_Gf128ModulusRev dst = (va_pbool_and (va_codegen_success_Vxor dst dst dst) (va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-7936)) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 3) dst 12) (va_ttrue ()))))) val va_lemma_Gf128ModulusRev : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gf128ModulusRev dst) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_get_ok va_s0 /\ dst =!= 3)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) /\ Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_eval_vec_opr va_sM dst)) == zero /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)))))) [@"opaque_to_smt"] let va_lemma_Gf128ModulusRev va_b0 va_s0 dst = va_reveal_opaque (`%va_code_Gf128ModulusRev) (va_code_Gf128ModulusRev dst); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in Vale.AES.GF128.lemma_gf128_constant_rev (va_eval_vec_opr va_s0 dst); let (va_s3, va_fc3) = va_lemma_Vxor (va_hd va_b1) va_s0 dst dst dst in let va_b3 = va_tl va_b1 in let (va_s4, va_fc4) = va_lemma_LoadImmShl64 (va_hd va_b3) va_s3 (va_op_reg_opr_reg 10) (-7936) in let va_b4 = va_tl va_b3 in Vale.AES.Types_helpers.lemma_ishl_64 ((-7936) `op_Modulus` pow2_64) 16; let (va_s6, va_fc6) = va_lemma_Mtvsrws (va_hd va_b4) va_s4 (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10) in let va_b6 = va_tl va_b4 in let (va_s7, va_fc7) = va_lemma_Vsldoi (va_hd va_b6) va_s6 dst (va_op_vec_opr_vec 3) dst 12 in let va_b7 = va_tl va_b6 in Vale.Math.Poly2.Lemmas.lemma_split_define (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) 64; Vale.Math.Poly2.Lemmas.lemma_index_all (); Vale.Math.Poly2.Lemmas.lemma_reverse_define_all (); Vale.Math.Poly2.lemma_equal (Vale.Math.Poly2_s.mod (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) (Vale.Math.Poly2_s.monomial 64)) zero; Vale.Math.Poly2.Bits.lemma_quad32_double (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127); let (va_sM, va_f7) = va_lemma_empty_total va_s7 va_b7 in let va_f6 = va_lemma_merge_total va_b6 va_s6 va_fc7 va_s7 va_f7 va_sM in let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_sM in let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc4 va_s4 va_f4 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_Gf128ModulusRev (dst:va_operand_vec_opr) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_vec_opr dst va_s0 /\ va_get_ok va_s0 /\ dst =!= 3 /\ (forall (va_x_dst:va_value_vec_opr) (va_x_r10:nat64) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_reg 10 va_x_r10 (va_upd_operand_vec_opr dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) /\ Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_eval_vec_opr va_sM dst)) == zero ==> va_k va_sM (()))) val va_wpProof_Gf128ModulusRev : dst:va_operand_vec_opr -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Gf128ModulusRev dst va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gf128ModulusRev dst) ([va_Mod_vec 3; va_Mod_reg 10; va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gf128ModulusRev dst va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gf128ModulusRev (va_code_Gf128ModulusRev dst) va_s0 dst in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_reg 10; va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gf128ModulusRev (dst:va_operand_vec_opr) : (va_quickCode unit (va_code_Gf128ModulusRev dst)) = (va_QProc (va_code_Gf128ModulusRev dst) ([va_Mod_vec 3; va_Mod_reg 10; va_mod_vec_opr dst]) (va_wp_Gf128ModulusRev dst) (va_wpProof_Gf128ModulusRev dst)) //-- //-- ReduceMulRev128 [@ "opaque_to_smt" va_qattr] let va_code_ReduceMulRev128 () = (va_Block (va_CCons (va_code_ClmulRev128 ()) (va_CCons (va_code_Vmr (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Gf128ModulusRev (va_op_vec_opr_vec 2)) (va_CCons (va_code_ClmulRev128 ()) (va_CCons (va_code_Vmr (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Gf128ModulusRev (va_op_vec_opr_vec 2)) (va_CCons (va_code_ClmulRev64High ()) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 5)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_CNil ()))))))))))) [@ "opaque_to_smt" va_qattr]
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_codegen_success_ReduceMulRev128 : va_dummy:unit -> Tot va_pbool
[]
Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_ReduceMulRev128
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool
{ "end_col": 26, "end_line": 983, "start_col": 2, "start_line": 975 }
Prims.Tot
val va_codegen_success_Gf128MulRev128 : va_dummy:unit -> Tot va_pbool
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_codegen_success_Gf128MulRev128 () = (va_pbool_and (va_codegen_success_ReduceMulRev128 ()) (va_ttrue ()))
val va_codegen_success_Gf128MulRev128 : va_dummy:unit -> Tot va_pbool let va_codegen_success_Gf128MulRev128 () =
false
null
false
(va_pbool_and (va_codegen_success_ReduceMulRev128 ()) (va_ttrue ()))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Prims.unit", "Vale.PPC64LE.Decls.va_pbool_and", "Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_ReduceMulRev128", "Vale.PPC64LE.Decls.va_ttrue", "Vale.PPC64LE.Decls.va_pbool" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (()))) val va_wpProof_ShiftLeft2_128_1 : lo:poly -> hi:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ShiftLeft2_128_1 lo hi va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ShiftLeft2_128_1 lo hi va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft2_128_1 (va_code_ShiftLeft2_128_1 ()) va_s0 lo hi in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ShiftLeft2_128_1 (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (va_QProc (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ShiftLeft2_128_1 lo hi) (va_wpProof_ShiftLeft2_128_1 lo hi)) //-- //-- ClmulRev64High val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev64High () = (va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev64High () = (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ShiftLeft128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev64High (va_mods:va_mods_t) (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (va_arg18:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 116 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg18) (let (va_arg17:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 117 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg17) (let (va_arg16:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 118 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg16 64) (let (va_arg15:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 119 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg15 64) (let (va_arg14:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 120 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg14 64) (let (va_arg13:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 121 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg13 64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 122 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 123 column 19 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft128_1 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.reverse a 63) (Vale.Math.Poly2_s.reverse b 63))) (fun (va_s:va_state) _ -> let (va_arg12:Vale.Math.Poly2_s.poly) = b in let (va_arg11:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 125 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg11 va_arg12 63) (va_QEmpty (())))))))))))) val va_lemma_ClmulRev64High : va_b0:va_code -> va_s0:va_state -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ClmulRev64High ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) /\ va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_ClmulRev64High va_b0 va_s0 a b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ClmulRev64High va_mods a b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev64High ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 101 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 114 column 49 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ClmulRev64High (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0) in va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) ==> va_k va_sM (()))) val va_wpProof_ClmulRev64High : a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ClmulRev64High a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev64High a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_ClmulRev64High (va_code_ClmulRev64High ()) va_s0 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev64High (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (va_QProc (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) (va_wp_ClmulRev64High a b) (va_wpProof_ClmulRev64High a b)) //-- //-- High64ToLow [@ "opaque_to_smt"] let va_code_High64ToLow dst src = (va_Block (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_CNil ()))) [@ "opaque_to_smt"] let va_codegen_success_High64ToLow dst src = (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_ttrue ())) [@"opaque_to_smt"] let va_lemma_High64ToLow va_b0 va_s0 dst src a = va_reveal_opaque (`%va_code_High64ToLow) (va_code_High64ToLow dst src); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vsldoi (va_hd va_b1) va_s0 dst (va_op_vec_opr_vec 0) src 8 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_quad32_double_shift a; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_High64ToLow dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_High64ToLow (va_code_High64ToLow dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Low64ToHigh [@ "opaque_to_smt" va_qattr] let va_code_Low64ToHigh dst src = (va_Block (va_CCons (va_code_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_CNil ()))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Low64ToHigh dst src = (va_pbool_and (va_codegen_success_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Low64ToHigh (va_mods:va_mods_t) (dst:vec_opr) (src:vec_opr) (a:poly) : (va_quickCode unit (va_code_Low64ToHigh dst src)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 156 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (fun (va_s:va_state) _ -> let (va_arg4:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 157 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_shift va_arg4) (va_QEmpty (()))))) [@"opaque_to_smt"] let va_lemma_Low64ToHigh va_b0 va_s0 dst src a = let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr dst] in let va_qc = va_qcode_Low64ToHigh va_mods dst src a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Low64ToHigh dst src) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 144 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 154 column 66 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod a (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr dst]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Low64ToHigh dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_Low64ToHigh (va_code_Low64ToHigh dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- AddPoly val va_code_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_AddPoly dst src1 src2 = (va_Block (va_CCons (va_code_Vxor dst src1 src2) (va_CNil ()))) val va_codegen_success_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_AddPoly dst src1 src2 = (va_pbool_and (va_codegen_success_Vxor dst src1 src2) (va_ttrue ())) val va_lemma_AddPoly : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_AddPoly dst src1 src2) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)))) [@"opaque_to_smt"] let va_lemma_AddPoly va_b0 va_s0 dst src1 src2 a b = va_reveal_opaque (`%va_code_AddPoly) (va_code_AddPoly dst src1 src2); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vxor (va_hd va_b1) va_s0 dst src1 src2 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_add128 a b; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b /\ (forall (va_x_dst:va_value_vec_opr) . let va_sM = va_upd_operand_vec_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) ==> va_k va_sM (()))) val va_wpProof_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_AddPoly dst src1 src2 a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_AddPoly dst src1 src2 a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_AddPoly (va_code_AddPoly dst src1 src2) va_s0 dst src1 src2 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) : (va_quickCode unit (va_code_AddPoly dst src1 src2)) = (va_QProc (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) (va_wp_AddPoly dst src1 src2 a b) (va_wpProof_AddPoly dst src1 src2 a b)) //-- //-- Clmul128 val va_code_Clmul128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Clmul128 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CNil ()))))))))))))) val va_codegen_success_Clmul128 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Clmul128 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Clmul128 (va_mods:va_mods_t) (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_Clmul128 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in let (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab n in let (b:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ab n in let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div cd n in let (d:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod cd n in let (ac:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a c in let (ad:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a d in let (bc:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul b c in let (bd:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul b d in let (ab_sw:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap ab 64 in let (ab_hi:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ab n in let (ab_lo:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div ab n) n in let (va_arg77:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 202 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg77) (let (va_arg76:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 203 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg76) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 205 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 206 column 10 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (fun (va_s:va_state) _ -> let (va_arg75:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 207 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg75) (let (va_arg74:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 208 column 29 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg74) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 209 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double ab_sw) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 210 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) ab_sw) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 211 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3) ab_sw) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 212 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 4 va_s == Vale.Math.Poly2.Bits_s.to_quad32 ab_hi) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 213 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 5 va_s == Vale.Math.Poly2.Bits_s.to_quad32 ab_lo) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 215 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 217 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 ab_hi) (let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab_hi n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 218 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg73) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 219 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_hi 64) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 220 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 222 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 ab_lo) (let (va_arg72:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 223 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg72 n) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 224 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_lo 64) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 225 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg71:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 227 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg71) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 228 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_sw 64) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 229 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_sw 64) (let (va_arg70:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 230 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg70 64) (let (va_arg69:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 231 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg69 64) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 232 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s) == Vale.Math.Poly2_s.add ad bc) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 234 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_hi 64) (let (va_arg68:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 235 column 18 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg68 n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 236 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s) == bd) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 238 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_lo 64) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 239 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s) == ac) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 241 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3) (Vale.Math.Poly2_s.add ad bc)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 242 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_distribute ad bc n) (let (va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod bc n in let (va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ad n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 243 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_distribute_left va_arg66 va_arg67 n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 244 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_s == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n))) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 246 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3) (Vale.Math.Poly2_s.add ad bc)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 247 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GHash_BE.lemma_div_distribute ad bc n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 248 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_s == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.div ad n) (Vale.Math.Poly2_s.div bc n))) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 250 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4) (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n)) bd) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 251 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2) ac (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.div ad n) (Vale.Math.Poly2_s.div bc n))) (fun (va_s:va_state) _ -> let (va_arg65:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div bc n in let (va_arg64:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ad n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 253 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg64 va_arg65) (let (va_arg63:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ad n in let (va_arg62:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div bc n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 254 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_associate ac va_arg62 va_arg63) (let (hi:poly) = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.add ac (Vale.Math.Poly2_s.div bc n)) (Vale.Math.Poly2_s.div ad n) in let (va_arg61:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n in let (va_arg60:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 256 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg60 va_arg61) (let (lo:poly) = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n)) bd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 259 column 20 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_gf128_mul a b c d 64) (va_QEmpty ((lo, hi)))))))))))))))))))))))))))))))))))))))))))))))) val va_lemma_Clmul128 : va_b0:va_code -> va_s0:va_state -> ab:poly -> cd:poly -> Ghost (va_state & va_fuel & poly & poly) (requires (va_require_total va_b0 (va_code_Clmul128 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 ab /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 cd)) (ensures (fun (va_sM, va_fM, lo, hi) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))) [@"opaque_to_smt"] let va_lemma_Clmul128 va_b0 va_s0 ab cd = let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok] in let va_qc = va_qcode_Clmul128 va_mods ab cd in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Clmul128 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let (lo, hi) = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree lo <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree hi < 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 186 column 47 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0; let (lo, hi) = va_g in (va_sM, va_fM, lo, hi) [@ va_qattr] let va_wp_Clmul128 (ab:poly) (cd:poly) (va_s0:va_state) (va_k:(va_state -> (poly & poly) -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 ab /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 cd /\ (forall (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (lo:poly) (hi:poly) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 va_s0))))) in va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi ==> va_k va_sM ((lo, hi)))) val va_wpProof_Clmul128 : ab:poly -> cd:poly -> va_s0:va_state -> va_k:(va_state -> (poly & poly) -> Type0) -> Ghost (va_state & va_fuel & (poly & poly)) (requires (va_t_require va_s0 /\ va_wp_Clmul128 ab cd va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Clmul128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Clmul128 ab cd va_s0 va_k = let (va_sM, va_f0, lo, hi) = va_lemma_Clmul128 (va_code_Clmul128 ()) va_s0 ab cd in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0)))))))); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_sM va_s0; let va_g = (lo, hi) in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Clmul128 (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_Clmul128 ())) = (va_QProc (va_code_Clmul128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_Clmul128 ab cd) (va_wpProof_Clmul128 ab cd)) //-- //-- ClmulRev128 val va_code_ClmulRev128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev128 () = (va_Block (va_CCons (va_code_Clmul128 ()) (va_CCons (va_code_ShiftLeft2_128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev128 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev128 () = (va_pbool_and (va_codegen_success_Clmul128 ()) (va_pbool_and (va_codegen_success_ShiftLeft2_128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev128 (va_mods:va_mods_t) (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_ClmulRev128 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 279 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Clmul128 (Vale.Math.Poly2_s.reverse ab 127) (Vale.Math.Poly2_s.reverse cd 127)) (fun (va_s:va_state) va_g -> let (lo, hi) = va_g in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 280 column 21 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft2_128_1 lo hi) (fun (va_s:va_state) _ -> let (m:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) 1 in let (va_arg13:Vale.Math.Poly2_s.poly) = lo in let (va_arg12:Vale.Math.Poly2_s.poly) = hi in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 283 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_combine_define va_arg12 va_arg13 128) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 284 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_split_define m 128) (let (lo:poly) = Vale.Math.Poly2_s.mod m (Vale.Math.Poly2_s.monomial 128) in let (hi:poly) = Vale.Math.Poly2_s.div m (Vale.Math.Poly2_s.monomial 128) in let (va_arg11:Vale.Math.Poly2_s.poly) = cd in let (va_arg10:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 287 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg10 va_arg11 127) (va_QEmpty ((lo, hi))))))))) val va_lemma_ClmulRev128 : va_b0:va_code -> va_s0:va_state -> ab:poly -> cd:poly -> Ghost (va_state & va_fuel & poly & poly) (requires (va_require_total va_b0 (va_code_ClmulRev128 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse ab 127) /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse cd 127))) (ensures (fun (va_sM, va_fM, lo, hi) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi <= 127 /\ Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))) [@"opaque_to_smt"] let va_lemma_ClmulRev128 va_b0 va_s0 ab cd = let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ClmulRev128 va_mods ab cd in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev128 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let (lo, hi) = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 262 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 273 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree lo <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 274 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree hi <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 275 column 61 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 276 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 277 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; let (lo, hi) = va_g in (va_sM, va_fM, lo, hi) [@ va_qattr] let va_wp_ClmulRev128 (ab:poly) (cd:poly) (va_s0:va_state) (va_k:(va_state -> (poly & poly) -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse ab 127) /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse cd 127) /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (lo:poly) (hi:poly) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))))) in va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi <= 127 /\ Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi ==> va_k va_sM ((lo, hi)))) val va_wpProof_ClmulRev128 : ab:poly -> cd:poly -> va_s0:va_state -> va_k:(va_state -> (poly & poly) -> Type0) -> Ghost (va_state & va_fuel & (poly & poly)) (requires (va_t_require va_s0 /\ va_wp_ClmulRev128 ab cd va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev128 ab cd va_s0 va_k = let (va_sM, va_f0, lo, hi) = va_lemma_ClmulRev128 (va_code_ClmulRev128 ()) va_s0 ab cd in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = (lo, hi) in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev128 (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_ClmulRev128 ())) = (va_QProc (va_code_ClmulRev128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ClmulRev128 ab cd) (va_wpProof_ClmulRev128 ab cd)) //-- //-- Gf128ModulusRev val va_code_Gf128ModulusRev : dst:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_Gf128ModulusRev dst = (va_Block (va_CCons (va_code_Vxor dst dst dst) (va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) (-7936)) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 3) dst 12) (va_CNil ())))))) val va_codegen_success_Gf128ModulusRev : dst:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_Gf128ModulusRev dst = (va_pbool_and (va_codegen_success_Vxor dst dst dst) (va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) (-7936)) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 3) dst 12) (va_ttrue ()))))) val va_lemma_Gf128ModulusRev : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gf128ModulusRev dst) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_get_ok va_s0 /\ dst =!= 3)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) /\ Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_eval_vec_opr va_sM dst)) == zero /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)))))) [@"opaque_to_smt"] let va_lemma_Gf128ModulusRev va_b0 va_s0 dst = va_reveal_opaque (`%va_code_Gf128ModulusRev) (va_code_Gf128ModulusRev dst); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in Vale.AES.GF128.lemma_gf128_constant_rev (va_eval_vec_opr va_s0 dst); let (va_s3, va_fc3) = va_lemma_Vxor (va_hd va_b1) va_s0 dst dst dst in let va_b3 = va_tl va_b1 in let (va_s4, va_fc4) = va_lemma_LoadImmShl64 (va_hd va_b3) va_s3 (va_op_reg_opr_reg 10) (-7936) in let va_b4 = va_tl va_b3 in Vale.AES.Types_helpers.lemma_ishl_64 ((-7936) `op_Modulus` pow2_64) 16; let (va_s6, va_fc6) = va_lemma_Mtvsrws (va_hd va_b4) va_s4 (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10) in let va_b6 = va_tl va_b4 in let (va_s7, va_fc7) = va_lemma_Vsldoi (va_hd va_b6) va_s6 dst (va_op_vec_opr_vec 3) dst 12 in let va_b7 = va_tl va_b6 in Vale.Math.Poly2.Lemmas.lemma_split_define (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) 64; Vale.Math.Poly2.Lemmas.lemma_index_all (); Vale.Math.Poly2.Lemmas.lemma_reverse_define_all (); Vale.Math.Poly2.lemma_equal (Vale.Math.Poly2_s.mod (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) (Vale.Math.Poly2_s.monomial 64)) zero; Vale.Math.Poly2.Bits.lemma_quad32_double (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127); let (va_sM, va_f7) = va_lemma_empty_total va_s7 va_b7 in let va_f6 = va_lemma_merge_total va_b6 va_s6 va_fc7 va_s7 va_f7 va_sM in let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_sM in let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc4 va_s4 va_f4 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_Gf128ModulusRev (dst:va_operand_vec_opr) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_vec_opr dst va_s0 /\ va_get_ok va_s0 /\ dst =!= 3 /\ (forall (va_x_dst:va_value_vec_opr) (va_x_r10:nat64) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_reg 10 va_x_r10 (va_upd_operand_vec_opr dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse gf128_modulus_low_terms 127) /\ Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_eval_vec_opr va_sM dst)) == zero ==> va_k va_sM (()))) val va_wpProof_Gf128ModulusRev : dst:va_operand_vec_opr -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Gf128ModulusRev dst va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gf128ModulusRev dst) ([va_Mod_vec 3; va_Mod_reg 10; va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gf128ModulusRev dst va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gf128ModulusRev (va_code_Gf128ModulusRev dst) va_s0 dst in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_reg 10; va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gf128ModulusRev (dst:va_operand_vec_opr) : (va_quickCode unit (va_code_Gf128ModulusRev dst)) = (va_QProc (va_code_Gf128ModulusRev dst) ([va_Mod_vec 3; va_Mod_reg 10; va_mod_vec_opr dst]) (va_wp_Gf128ModulusRev dst) (va_wpProof_Gf128ModulusRev dst)) //-- //-- ReduceMulRev128 [@ "opaque_to_smt" va_qattr] let va_code_ReduceMulRev128 () = (va_Block (va_CCons (va_code_ClmulRev128 ()) (va_CCons (va_code_Vmr (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Gf128ModulusRev (va_op_vec_opr_vec 2)) (va_CCons (va_code_ClmulRev128 ()) (va_CCons (va_code_Vmr (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Gf128ModulusRev (va_op_vec_opr_vec 2)) (va_CCons (va_code_ClmulRev64High ()) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 5)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_CNil ()))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ReduceMulRev128 () = (va_pbool_and (va_codegen_success_ClmulRev128 ()) (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Gf128ModulusRev (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ClmulRev128 ()) (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Gf128ModulusRev (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ClmulRev64High ()) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ReduceMulRev128 (va_mods:va_mods_t) (a:poly) (b:poly) : (va_quickCode unit (va_code_ReduceMulRev128 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 329 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_gf128_degree ()) (let (va_arg31:Vale.Math.Poly2_s.poly) = b in let (va_arg30:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 330 column 27 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_gf128_reduce_rev va_arg30 va_arg31 gf128_modulus_low_terms 128) (let (m:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 128 in let (h:Vale.Math.Poly2_s.poly) = gf128_modulus_low_terms in let (ab:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a b in let (rh:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse h 127 in let (rab:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse ab 255 in let (rd:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod rab m in let (rdh:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.reverse rd 127) h) 255 in let (rdhL:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod rdh m in let (rdhLh:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.reverse rdhL 127) h) 127 in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 341 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ClmulRev128 a b) (fun (va_s:va_state) va_g -> let ((lo1:poly), (hi1:poly)) = va_g in let (va_arg29:Vale.Math.Poly2_s.poly) = lo1 in let (va_arg28:Vale.Math.Poly2_s.poly) = hi1 in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 342 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_combine_define va_arg28 va_arg29 128) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vmr (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 20 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Gf128ModulusRev (va_op_vec_opr_vec 2)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 346 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ClmulRev128 (Vale.Math.Poly2_s.reverse rd 127) h) (fun (va_s:va_state) va_g -> let ((lo2:poly), (hi2:poly)) = va_g in let (va_arg27:Vale.Math.Poly2_s.poly) = lo2 in let (va_arg26:Vale.Math.Poly2_s.poly) = hi2 in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 347 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_combine_define va_arg26 va_arg27 128) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 348 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vmr (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 350 column 20 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Gf128ModulusRev (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 352 column 31 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_quad32_double_hi_rev rdhL) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 353 column 31 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_quad32_double_hi_rev rh) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 354 column 19 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ClmulRev64High (Vale.Math.Poly2_s.reverse rdhL 127) h) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 356 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 5) rdhLh (Vale.Math.Poly2_s.div rdh m)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 357 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6) (Vale.Math.Poly2_s.add rdhLh (Vale.Math.Poly2_s.div rdh m)) (Vale.Math.Poly2_s.div rab m)) (va_QEmpty (())))))))))))))))))) [@"opaque_to_smt"] let va_lemma_ReduceMulRev128 va_b0 va_s0 a b = let (va_mods:va_mods_t) = [va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ReduceMulRev128 va_mods a b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ReduceMulRev128 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 315 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 327 column 55 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.AES.GF128_s.gf128_mul a b) 127))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ReduceMulRev128 a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_ReduceMulRev128 (va_code_ReduceMulRev128 ()) va_s0 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))); va_lemma_norm_mods ([va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Gf128MulRev128 [@ "opaque_to_smt" va_qattr] let va_code_Gf128MulRev128 () = (va_Block (va_CCons (va_code_ReduceMulRev128 ()) (va_CNil ()))) [@ "opaque_to_smt" va_qattr]
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_codegen_success_Gf128MulRev128 : va_dummy:unit -> Tot va_pbool
[]
Vale.AES.PPC64LE.GF128_Mul.va_codegen_success_Gf128MulRev128
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool
{ "end_col": 70, "end_line": 1078, "start_col": 2, "start_line": 1078 }
Prims.Tot
val va_code_ClmulRev128 : va_dummy:unit -> Tot va_code
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_code_ClmulRev128 () = (va_Block (va_CCons (va_code_Clmul128 ()) (va_CCons (va_code_ShiftLeft2_128_1 ()) (va_CNil ()))))
val va_code_ClmulRev128 : va_dummy:unit -> Tot va_code let va_code_ClmulRev128 () =
false
null
false
(va_Block (va_CCons (va_code_Clmul128 ()) (va_CCons (va_code_ShiftLeft2_128_1 ()) (va_CNil ()))))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Prims.unit", "Vale.PPC64LE.Decls.va_Block", "Vale.PPC64LE.Decls.va_CCons", "Vale.AES.PPC64LE.GF128_Mul.va_code_Clmul128", "Vale.AES.PPC64LE.GF128_Mul.va_code_ShiftLeft2_128_1", "Vale.PPC64LE.Decls.va_CNil", "Vale.PPC64LE.Decls.va_code" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (()))) val va_wpProof_ShiftLeft2_128_1 : lo:poly -> hi:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ShiftLeft2_128_1 lo hi va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ShiftLeft2_128_1 lo hi va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft2_128_1 (va_code_ShiftLeft2_128_1 ()) va_s0 lo hi in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ShiftLeft2_128_1 (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (va_QProc (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ShiftLeft2_128_1 lo hi) (va_wpProof_ShiftLeft2_128_1 lo hi)) //-- //-- ClmulRev64High val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev64High () = (va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev64High () = (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ShiftLeft128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev64High (va_mods:va_mods_t) (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (va_arg18:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 116 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg18) (let (va_arg17:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 117 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg17) (let (va_arg16:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 118 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg16 64) (let (va_arg15:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 119 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg15 64) (let (va_arg14:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 120 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg14 64) (let (va_arg13:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 121 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg13 64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 122 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 123 column 19 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft128_1 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.reverse a 63) (Vale.Math.Poly2_s.reverse b 63))) (fun (va_s:va_state) _ -> let (va_arg12:Vale.Math.Poly2_s.poly) = b in let (va_arg11:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 125 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg11 va_arg12 63) (va_QEmpty (())))))))))))) val va_lemma_ClmulRev64High : va_b0:va_code -> va_s0:va_state -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ClmulRev64High ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) /\ va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_ClmulRev64High va_b0 va_s0 a b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ClmulRev64High va_mods a b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev64High ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 101 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 114 column 49 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ClmulRev64High (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0) in va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) ==> va_k va_sM (()))) val va_wpProof_ClmulRev64High : a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ClmulRev64High a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev64High a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_ClmulRev64High (va_code_ClmulRev64High ()) va_s0 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev64High (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (va_QProc (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) (va_wp_ClmulRev64High a b) (va_wpProof_ClmulRev64High a b)) //-- //-- High64ToLow [@ "opaque_to_smt"] let va_code_High64ToLow dst src = (va_Block (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_CNil ()))) [@ "opaque_to_smt"] let va_codegen_success_High64ToLow dst src = (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_ttrue ())) [@"opaque_to_smt"] let va_lemma_High64ToLow va_b0 va_s0 dst src a = va_reveal_opaque (`%va_code_High64ToLow) (va_code_High64ToLow dst src); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vsldoi (va_hd va_b1) va_s0 dst (va_op_vec_opr_vec 0) src 8 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_quad32_double_shift a; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_High64ToLow dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_High64ToLow (va_code_High64ToLow dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Low64ToHigh [@ "opaque_to_smt" va_qattr] let va_code_Low64ToHigh dst src = (va_Block (va_CCons (va_code_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_CNil ()))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Low64ToHigh dst src = (va_pbool_and (va_codegen_success_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Low64ToHigh (va_mods:va_mods_t) (dst:vec_opr) (src:vec_opr) (a:poly) : (va_quickCode unit (va_code_Low64ToHigh dst src)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 156 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (fun (va_s:va_state) _ -> let (va_arg4:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 157 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_shift va_arg4) (va_QEmpty (()))))) [@"opaque_to_smt"] let va_lemma_Low64ToHigh va_b0 va_s0 dst src a = let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr dst] in let va_qc = va_qcode_Low64ToHigh va_mods dst src a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Low64ToHigh dst src) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 144 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 154 column 66 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod a (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr dst]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Low64ToHigh dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_Low64ToHigh (va_code_Low64ToHigh dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- AddPoly val va_code_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_AddPoly dst src1 src2 = (va_Block (va_CCons (va_code_Vxor dst src1 src2) (va_CNil ()))) val va_codegen_success_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_AddPoly dst src1 src2 = (va_pbool_and (va_codegen_success_Vxor dst src1 src2) (va_ttrue ())) val va_lemma_AddPoly : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_AddPoly dst src1 src2) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)))) [@"opaque_to_smt"] let va_lemma_AddPoly va_b0 va_s0 dst src1 src2 a b = va_reveal_opaque (`%va_code_AddPoly) (va_code_AddPoly dst src1 src2); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vxor (va_hd va_b1) va_s0 dst src1 src2 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_add128 a b; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b /\ (forall (va_x_dst:va_value_vec_opr) . let va_sM = va_upd_operand_vec_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) ==> va_k va_sM (()))) val va_wpProof_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_AddPoly dst src1 src2 a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_AddPoly dst src1 src2 a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_AddPoly (va_code_AddPoly dst src1 src2) va_s0 dst src1 src2 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) : (va_quickCode unit (va_code_AddPoly dst src1 src2)) = (va_QProc (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) (va_wp_AddPoly dst src1 src2 a b) (va_wpProof_AddPoly dst src1 src2 a b)) //-- //-- Clmul128 val va_code_Clmul128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Clmul128 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CNil ()))))))))))))) val va_codegen_success_Clmul128 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Clmul128 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Clmul128 (va_mods:va_mods_t) (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_Clmul128 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in let (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab n in let (b:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ab n in let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div cd n in let (d:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod cd n in let (ac:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a c in let (ad:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a d in let (bc:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul b c in let (bd:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul b d in let (ab_sw:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap ab 64 in let (ab_hi:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ab n in let (ab_lo:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div ab n) n in let (va_arg77:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 202 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg77) (let (va_arg76:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 203 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg76) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 205 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 206 column 10 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (fun (va_s:va_state) _ -> let (va_arg75:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 207 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg75) (let (va_arg74:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 208 column 29 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg74) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 209 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double ab_sw) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 210 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) ab_sw) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 211 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3) ab_sw) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 212 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 4 va_s == Vale.Math.Poly2.Bits_s.to_quad32 ab_hi) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 213 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 5 va_s == Vale.Math.Poly2.Bits_s.to_quad32 ab_lo) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 215 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 217 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 ab_hi) (let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab_hi n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 218 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg73) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 219 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_hi 64) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 220 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 222 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 ab_lo) (let (va_arg72:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 223 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg72 n) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 224 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_lo 64) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 225 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg71:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 227 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg71) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 228 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_sw 64) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 229 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_sw 64) (let (va_arg70:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 230 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg70 64) (let (va_arg69:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 231 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg69 64) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 232 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s) == Vale.Math.Poly2_s.add ad bc) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 234 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_hi 64) (let (va_arg68:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 235 column 18 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg68 n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 236 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s) == bd) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 238 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_lo 64) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 239 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s) == ac) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 241 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3) (Vale.Math.Poly2_s.add ad bc)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 242 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_distribute ad bc n) (let (va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod bc n in let (va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ad n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 243 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_distribute_left va_arg66 va_arg67 n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 244 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_s == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n))) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 246 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3) (Vale.Math.Poly2_s.add ad bc)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 247 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GHash_BE.lemma_div_distribute ad bc n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 248 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_s == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.div ad n) (Vale.Math.Poly2_s.div bc n))) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 250 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4) (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n)) bd) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 251 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2) ac (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.div ad n) (Vale.Math.Poly2_s.div bc n))) (fun (va_s:va_state) _ -> let (va_arg65:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div bc n in let (va_arg64:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ad n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 253 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg64 va_arg65) (let (va_arg63:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ad n in let (va_arg62:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div bc n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 254 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_associate ac va_arg62 va_arg63) (let (hi:poly) = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.add ac (Vale.Math.Poly2_s.div bc n)) (Vale.Math.Poly2_s.div ad n) in let (va_arg61:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n in let (va_arg60:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 256 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg60 va_arg61) (let (lo:poly) = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n)) bd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 259 column 20 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_gf128_mul a b c d 64) (va_QEmpty ((lo, hi)))))))))))))))))))))))))))))))))))))))))))))))) val va_lemma_Clmul128 : va_b0:va_code -> va_s0:va_state -> ab:poly -> cd:poly -> Ghost (va_state & va_fuel & poly & poly) (requires (va_require_total va_b0 (va_code_Clmul128 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 ab /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 cd)) (ensures (fun (va_sM, va_fM, lo, hi) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))) [@"opaque_to_smt"] let va_lemma_Clmul128 va_b0 va_s0 ab cd = let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok] in let va_qc = va_qcode_Clmul128 va_mods ab cd in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Clmul128 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let (lo, hi) = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree lo <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree hi < 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 186 column 47 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0; let (lo, hi) = va_g in (va_sM, va_fM, lo, hi) [@ va_qattr] let va_wp_Clmul128 (ab:poly) (cd:poly) (va_s0:va_state) (va_k:(va_state -> (poly & poly) -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 ab /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 cd /\ (forall (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (lo:poly) (hi:poly) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 va_s0))))) in va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi ==> va_k va_sM ((lo, hi)))) val va_wpProof_Clmul128 : ab:poly -> cd:poly -> va_s0:va_state -> va_k:(va_state -> (poly & poly) -> Type0) -> Ghost (va_state & va_fuel & (poly & poly)) (requires (va_t_require va_s0 /\ va_wp_Clmul128 ab cd va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Clmul128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Clmul128 ab cd va_s0 va_k = let (va_sM, va_f0, lo, hi) = va_lemma_Clmul128 (va_code_Clmul128 ()) va_s0 ab cd in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0)))))))); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_sM va_s0; let va_g = (lo, hi) in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Clmul128 (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_Clmul128 ())) = (va_QProc (va_code_Clmul128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_Clmul128 ab cd) (va_wpProof_Clmul128 ab cd)) //-- //-- ClmulRev128 val va_code_ClmulRev128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr]
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_code_ClmulRev128 : va_dummy:unit -> Tot va_code
[]
Vale.AES.PPC64LE.GF128_Mul.va_code_ClmulRev128
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code
{ "end_col": 99, "end_line": 754, "start_col": 2, "start_line": 754 }
Prims.Tot
val va_wp_ClmulRev128 (ab cd: poly) (va_s0: va_state) (va_k: (va_state -> (poly & poly) -> Type0)) : Type0
[ { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.PolyOps", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let va_wp_ClmulRev128 (ab:poly) (cd:poly) (va_s0:va_state) (va_k:(va_state -> (poly & poly) -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse ab 127) /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse cd 127) /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (lo:poly) (hi:poly) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))))) in va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi <= 127 /\ Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi ==> va_k va_sM ((lo, hi))))
val va_wp_ClmulRev128 (ab cd: poly) (va_s0: va_state) (va_k: (va_state -> (poly & poly) -> Type0)) : Type0 let va_wp_ClmulRev128 (ab cd: poly) (va_s0: va_state) (va_k: (va_state -> (poly & poly) -> Type0)) : Type0 =
false
null
false
(va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse ab 127) /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse cd 127) /\ (forall (va_x_r10: nat64) (va_x_v0: quad32) (va_x_v1: quad32) (va_x_v2: quad32) (va_x_v3: quad32) (va_x_v4: quad32) (va_x_v5: quad32) (lo: poly) (hi: poly). let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0))))) ) in va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi <= 127 /\ Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi ==> va_k va_sM ((lo, hi))))
{ "checked_file": "Vale.AES.PPC64LE.GF128_Mul.fst.checked", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Words.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.PolyOps.fsti.checked", "Vale.AES.GHash_BE.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GF128_Mul.fst" }
[ "total" ]
[ "Vale.Math.Poly2_s.poly", "Vale.PPC64LE.Decls.va_state", "FStar.Pervasives.Native.tuple2", "Prims.l_and", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Prims.op_LessThanOrEqual", "Vale.Math.Poly2_s.degree", "Prims.eq2", "Vale.Def.Types_s.quad32", "Vale.PPC64LE.Decls.va_get_vec", "Vale.Math.Poly2.Bits_s.to_quad32", "Vale.Math.Poly2_s.reverse", "Prims.l_Forall", "Vale.PPC64LE.Machine_s.nat64", "Vale.PPC64LE.Machine_s.quad32", "Prims.l_imp", "Vale.Math.Poly2_s.mul", "Vale.Math.Poly2_s.add", "Vale.Math.Poly2_s.shift", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.Decls.va_upd_vec", "Vale.PPC64LE.Decls.va_upd_reg" ]
[]
module Vale.AES.PPC64LE.GF128_Mul open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Math.Poly2_s open Vale.Math.Poly2 open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2.Bits open Vale.Math.Poly2.Lemmas open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.PPC64LE.Machine_s open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.PPC64LE.PolyOps open Vale.AES.Types_helpers open Vale.AES.GHash_BE //-- ShiftLeft128_1 [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft128_1 () = (va_Block (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 2) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CNil ())))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft128_1 () = (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 2) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft128_1 (va_mods:va_mods_t) (a:poly) : (va_quickCode unit (va_code_ShiftLeft128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 60 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 2) 1) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 61 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg5:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 63 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_left_1 va_arg5) (va_QEmpty (())))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft128_1 va_b0 va_s0 a = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft128_1 va_mods a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 49 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 58 column 37 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.shift a 1))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_ShiftLeft128_1 a va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft128_1 (va_code_ShiftLeft128_1 ()) va_s0 a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- ShiftLeft2_128_1 val va_code_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ShiftLeft2_128_1 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_Vspltisb (va_op_vec_opr_vec 0) 1) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CNil ()))))))))))) val va_codegen_success_ShiftLeft2_128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ShiftLeft2_128_1 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_Vspltisb (va_op_vec_opr_vec 0) 1) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_ttrue ())))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_ShiftLeft2_128_1 (va_mods:va_mods_t) (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 83 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 14 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) 31) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 85 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Mtvsrws (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 86 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsrw (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 88 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisb (va_op_vec_opr_vec 0) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 89 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 90 column 8 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsl (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 91 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (fun (va_s:va_state) _ -> let (l:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishl32 i 1) (va_get_vec 2 va_old_s) in let (r:(Vale.Def.Words_s.four Vale.Def.Words_s.nat32)) = Vale.Def.Words.Four_s.four_map #nat32 #Vale.Def.Words_s.nat32 (fun (i:nat32) -> Vale.Arch.Types.ishr32 i 31) (va_get_vec 2 va_old_s) in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg21:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 95 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes va_arg21 va_arg22) (let (va_arg20:Vale.Def.Types_s.quad32) = va_get_vec 3 va_s in let (va_arg19:Vale.Def.Types_s.quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 (Vale.Def.Words_s.__proj__Mkfour__item__lo0 r) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 r) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 r) in let (va_arg18:Vale.Def.Types_s.quad32) = l in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 96 column 32 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_associates va_arg18 va_arg19 va_arg20) (let (va_arg17:Vale.Math.Poly2_s.poly) = hi in let (va_arg16:Vale.Math.Poly2_s.poly) = lo in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 98 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_shift_2_left_1 va_arg16 va_arg17) (va_QEmpty (()))))))))))))))) val va_lemma_ShiftLeft2_128_1 : va_b0:va_code -> va_s0:va_state -> lo:poly -> hi:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ShiftLeft2_128_1 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) /\ va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_ShiftLeft2_128_1 va_b0 va_s0 lo hi = let (va_mods:va_mods_t) = [va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ShiftLeft2_128_1 va_mods lo hi in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftLeft2_128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 66 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 77 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let n = Vale.Math.Poly2_s.monomial 128 in label va_range1 "***** POSTCONDITION NOT MET AT line 78 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in label va_range1 "***** POSTCONDITION NOT MET AT line 79 column 9 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (let b = Vale.Math.Poly2_s.shift a 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 81 column 35 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ShiftLeft2_128_1 (lo:poly) (hi:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))) in va_get_ok va_sM /\ (let n = Vale.Math.Poly2_s.monomial 128 in let a = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul hi n) lo in let b = Vale.Math.Poly2_s.shift a 1 in va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mod b n) /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.div b n)) ==> va_k va_sM (()))) val va_wpProof_ShiftLeft2_128_1 : lo:poly -> hi:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ShiftLeft2_128_1 lo hi va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ShiftLeft2_128_1 lo hi va_s0 va_k = let (va_sM, va_f0) = va_lemma_ShiftLeft2_128_1 (va_code_ShiftLeft2_128_1 ()) va_s0 lo hi in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ShiftLeft2_128_1 (lo:poly) (hi:poly) : (va_quickCode unit (va_code_ShiftLeft2_128_1 ())) = (va_QProc (va_code_ShiftLeft2_128_1 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) (va_wp_ShiftLeft2_128_1 lo hi) (va_wpProof_ShiftLeft2_128_1 lo hi)) //-- //-- ClmulRev64High val va_code_ClmulRev64High : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev64High () = (va_Block (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_CCons (va_code_ShiftLeft128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev64High : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev64High () = (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_ShiftLeft128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev64High (va_mods:va_mods_t) (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (va_arg18:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 116 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg18) (let (va_arg17:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 117 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg17) (let (va_arg16:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 118 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg16 64) (let (va_arg15:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 119 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg15 64) (let (va_arg14:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 120 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg14 64) (let (va_arg13:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 121 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg13 64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 122 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 123 column 19 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft128_1 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.reverse a 63) (Vale.Math.Poly2_s.reverse b 63))) (fun (va_s:va_state) _ -> let (va_arg12:Vale.Math.Poly2_s.poly) = b in let (va_arg11:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 125 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg11 va_arg12 63) (va_QEmpty (())))))))))))) val va_lemma_ClmulRev64High : va_b0:va_code -> va_s0:va_state -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_ClmulRev64High ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) /\ va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_ClmulRev64High va_b0 va_s0 a b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok] in let va_qc = va_qcode_ClmulRev64High va_mods a b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev64High ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 101 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 114 column 49 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_ClmulRev64High (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 63 /\ Vale.Math.Poly2_s.degree b <= 63 /\ Vale.Math.Poly2_s.reverse a 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 1 va_s0)) /\ Vale.Math.Poly2_s.reverse b 63 == Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_hi (va_get_vec 2 va_s0)) /\ l_or (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 1 va_s0)) == zero) (Vale.Math.Poly2.Bits_s.of_double32 (Vale.Arch.Types.quad32_double_lo (va_get_vec 2 va_s0)) == zero) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0) in va_get_ok va_sM /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul a b) 127) ==> va_k va_sM (()))) val va_wpProof_ClmulRev64High : a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_ClmulRev64High a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_ClmulRev64High a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_ClmulRev64High (va_code_ClmulRev64High ()) va_s0 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_ClmulRev64High (a:poly) (b:poly) : (va_quickCode unit (va_code_ClmulRev64High ())) = (va_QProc (va_code_ClmulRev64High ()) ([va_Mod_vec 2; va_Mod_vec 1]) (va_wp_ClmulRev64High a b) (va_wpProof_ClmulRev64High a b)) //-- //-- High64ToLow [@ "opaque_to_smt"] let va_code_High64ToLow dst src = (va_Block (va_CCons (va_code_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_CNil ()))) [@ "opaque_to_smt"] let va_codegen_success_High64ToLow dst src = (va_pbool_and (va_codegen_success_Vsldoi dst (va_op_vec_opr_vec 0) src 8) (va_ttrue ())) [@"opaque_to_smt"] let va_lemma_High64ToLow va_b0 va_s0 dst src a = va_reveal_opaque (`%va_code_High64ToLow) (va_code_High64ToLow dst src); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vsldoi (va_hd va_b1) va_s0 dst (va_op_vec_opr_vec 0) src 8 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_quad32_double_shift a; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_High64ToLow dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_High64ToLow (va_code_High64ToLow dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Low64ToHigh [@ "opaque_to_smt" va_qattr] let va_code_Low64ToHigh dst src = (va_Block (va_CCons (va_code_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_CNil ()))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Low64ToHigh dst src = (va_pbool_and (va_codegen_success_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Low64ToHigh (va_mods:va_mods_t) (dst:vec_opr) (src:vec_opr) (a:poly) : (va_quickCode unit (va_code_Low64ToHigh dst src)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 156 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vsldoi dst src (va_op_vec_opr_vec 0) 8) (fun (va_s:va_state) _ -> let (va_arg4:Vale.Math.Poly2_s.poly) = a in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 157 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_shift va_arg4) (va_QEmpty (()))))) [@"opaque_to_smt"] let va_lemma_Low64ToHigh va_b0 va_s0 dst src a = let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr dst] in let va_qc = va_qcode_Low64ToHigh va_mods dst src a in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Low64ToHigh dst src) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 144 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 154 column 66 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod a (Vale.Math.Poly2_s.monomial 64)) (Vale.Math.Poly2_s.monomial 64)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr dst]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Low64ToHigh dst src a va_s0 va_k = let (va_sM, va_f0) = va_lemma_Low64ToHigh (va_code_Low64ToHigh dst src) va_s0 dst src a in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- AddPoly val va_code_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_code [@ "opaque_to_smt"] let va_code_AddPoly dst src1 src2 = (va_Block (va_CCons (va_code_Vxor dst src1 src2) (va_CNil ()))) val va_codegen_success_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_AddPoly dst src1 src2 = (va_pbool_and (va_codegen_success_Vxor dst src1 src2) (va_ttrue ())) val va_lemma_AddPoly : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_AddPoly dst src1 src2) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)))) [@"opaque_to_smt"] let va_lemma_AddPoly va_b0 va_s0 dst src1 src2 a b = va_reveal_opaque (`%va_code_AddPoly) (va_code_AddPoly dst src1 src2); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s2, va_fc2) = va_lemma_Vxor (va_hd va_b1) va_s0 dst src1 src2 in let va_b2 = va_tl va_b1 in Vale.Math.Poly2.Words.lemma_add128 a b; let (va_sM, va_f2) = va_lemma_empty_total va_s2 va_b2 in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc2 va_s2 va_f2 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_vec_opr dst va_s0 /\ va_is_src_vec_opr src1 va_s0 /\ va_is_src_vec_opr src2 va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree a <= 127 /\ Vale.Math.Poly2_s.degree b <= 127 /\ va_eval_vec_opr va_s0 src1 == Vale.Math.Poly2.Bits_s.to_quad32 a /\ va_eval_vec_opr va_s0 src2 == Vale.Math.Poly2.Bits_s.to_quad32 b /\ (forall (va_x_dst:va_value_vec_opr) . let va_sM = va_upd_operand_vec_opr dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add a b) ==> va_k va_sM (()))) val va_wpProof_AddPoly : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr -> a:poly -> b:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_AddPoly dst src1 src2 a b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_AddPoly dst src1 src2 a b va_s0 va_k = let (va_sM, va_f0) = va_lemma_AddPoly (va_code_AddPoly dst src1 src2) va_s0 dst src1 src2 a b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_AddPoly (dst:va_operand_vec_opr) (src1:va_operand_vec_opr) (src2:va_operand_vec_opr) (a:poly) (b:poly) : (va_quickCode unit (va_code_AddPoly dst src1 src2)) = (va_QProc (va_code_AddPoly dst src1 src2) ([va_mod_vec_opr dst]) (va_wp_AddPoly dst src1 src2 a b) (va_wpProof_AddPoly dst src1 src2 a b)) //-- //-- Clmul128 val va_code_Clmul128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Clmul128 () = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_CCons (va_code_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_CCons (va_code_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_CCons (va_code_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_CCons (va_code_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_CNil ()))))))))))))) val va_codegen_success_Clmul128 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Clmul128 () = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and (va_codegen_success_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Clmul128 (va_mods:va_mods_t) (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_Clmul128 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (n:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.monomial 64 in let (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab n in let (b:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ab n in let (c:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div cd n in let (d:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod cd n in let (ac:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a c in let (ad:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul a d in let (bc:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul b c in let (bd:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul b d in let (ab_sw:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.swap ab 64 in let (ab_hi:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ab n in let (ab_lo:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div ab n) n in let (va_arg77:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 202 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg77) (let (va_arg76:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 203 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double va_arg76) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 205 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 206 column 10 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VSwap (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 1)) (fun (va_s:va_state) _ -> let (va_arg75:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 207 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg75) (let (va_arg74:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 208 column 29 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_double_swap va_arg74) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 209 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_quad32_double ab_sw) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 210 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_High64ToLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) ab_sw) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 211 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Low64ToHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 3) ab_sw) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 212 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 4 va_s == Vale.Math.Poly2.Bits_s.to_quad32 ab_hi) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 213 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 5 va_s == Vale.Math.Poly2.Bits_s.to_quad32 ab_lo) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 215 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMul (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 217 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 ab_hi) (let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab_hi n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 218 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_degree_negative va_arg73) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 219 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_hi 64) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 220 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulLow (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 222 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 ab_lo) (let (va_arg72:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ab n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 223 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_div_mod_exact va_arg72 n) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 224 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_lo 64) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 225 column 17 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_VPolyMulHigh (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2)) (fun (va_s:va_state) _ -> let (va_arg71:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 227 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 va_arg71) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 228 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_sw 64) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 229 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_sw 64) (let (va_arg70:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 230 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod va_arg70 64) (let (va_arg69:Vale.Math.Poly2_s.poly) = cd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 231 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div va_arg69 64) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 232 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s) == Vale.Math.Poly2_s.add ad bc) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 234 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mask_is_mod ab_hi 64) (let (va_arg68:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 235 column 18 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_mod va_arg68 n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 236 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s) == bd) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 238 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_shift_is_div ab_lo 64) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 239 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s) == ac) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 241 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Low64ToHigh (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 3) (Vale.Math.Poly2_s.add ad bc)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 242 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mod_distribute ad bc n) (let (va_arg67:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod bc n in let (va_arg66:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mod ad n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 243 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_distribute_left va_arg66 va_arg67 n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 244 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_s == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n))) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 246 column 16 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_High64ToLow (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3) (Vale.Math.Poly2_s.add ad bc)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 247 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GHash_BE.lemma_div_distribute ad bc n) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 248 column 5 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_s == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.div ad n) (Vale.Math.Poly2_s.div bc n))) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 250 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4) (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n)) bd) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 251 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_AddPoly (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 2) ac (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.div ad n) (Vale.Math.Poly2_s.div bc n))) (fun (va_s:va_state) _ -> let (va_arg65:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div bc n in let (va_arg64:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ad n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 253 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg64 va_arg65) (let (va_arg63:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div ad n in let (va_arg62:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.div bc n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 254 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_associate ac va_arg62 va_arg63) (let (hi:poly) = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.add ac (Vale.Math.Poly2_s.div bc n)) (Vale.Math.Poly2_s.div ad n) in let (va_arg61:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n in let (va_arg60:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 256 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.lemma_add_commute va_arg60 va_arg61) (let (lo:poly) = Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod bc n) n) (Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.mod ad n) n)) bd in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 259 column 20 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.AES.GF128.lemma_gf128_mul a b c d 64) (va_QEmpty ((lo, hi)))))))))))))))))))))))))))))))))))))))))))))))) val va_lemma_Clmul128 : va_b0:va_code -> va_s0:va_state -> ab:poly -> cd:poly -> Ghost (va_state & va_fuel & poly & poly) (requires (va_require_total va_b0 (va_code_Clmul128 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 ab /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 cd)) (ensures (fun (va_sM, va_fM, lo, hi) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0))))))))) [@"opaque_to_smt"] let va_lemma_Clmul128 va_b0 va_s0 ab cd = let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok] in let va_qc = va_qcode_Clmul128 va_mods ab cd in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Clmul128 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let (lo, hi) = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 184 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree lo <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 185 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree hi < 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 186 column 47 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 187 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 188 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_ok]) va_sM va_s0; let (lo, hi) = va_g in (va_sM, va_fM, lo, hi) [@ va_qattr] let va_wp_Clmul128 (ab:poly) (cd:poly) (va_s0:va_state) (va_k:(va_state -> (poly & poly) -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 ab /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 cd /\ (forall (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (lo:poly) (hi:poly) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 va_s0))))) in va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.mul ab cd == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi ==> va_k va_sM ((lo, hi)))) val va_wpProof_Clmul128 : ab:poly -> cd:poly -> va_s0:va_state -> va_k:(va_state -> (poly & poly) -> Type0) -> Ghost (va_state & va_fuel & (poly & poly)) (requires (va_t_require va_s0 /\ va_wp_Clmul128 ab cd va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Clmul128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Clmul128 ab cd va_s0 va_k = let (va_sM, va_f0, lo, hi) = va_lemma_Clmul128 (va_code_Clmul128 ()) va_s0 ab cd in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0)))))))); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) va_sM va_s0; let va_g = (lo, hi) in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Clmul128 (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_Clmul128 ())) = (va_QProc (va_code_Clmul128 ()) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_Clmul128 ab cd) (va_wpProof_Clmul128 ab cd)) //-- //-- ClmulRev128 val va_code_ClmulRev128 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_ClmulRev128 () = (va_Block (va_CCons (va_code_Clmul128 ()) (va_CCons (va_code_ShiftLeft2_128_1 ()) (va_CNil ())))) val va_codegen_success_ClmulRev128 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_ClmulRev128 () = (va_pbool_and (va_codegen_success_Clmul128 ()) (va_pbool_and (va_codegen_success_ShiftLeft2_128_1 ()) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_ClmulRev128 (va_mods:va_mods_t) (ab:poly) (cd:poly) : (va_quickCode (poly & poly) (va_code_ClmulRev128 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 279 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_Clmul128 (Vale.Math.Poly2_s.reverse ab 127) (Vale.Math.Poly2_s.reverse cd 127)) (fun (va_s:va_state) va_g -> let (lo, hi) = va_g in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 280 column 21 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_quick_ShiftLeft2_128_1 lo hi) (fun (va_s:va_state) _ -> let (m:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) 1 in let (va_arg13:Vale.Math.Poly2_s.poly) = lo in let (va_arg12:Vale.Math.Poly2_s.poly) = hi in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 283 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_combine_define va_arg12 va_arg13 128) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 284 column 23 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_split_define m 128) (let (lo:poly) = Vale.Math.Poly2_s.mod m (Vale.Math.Poly2_s.monomial 128) in let (hi:poly) = Vale.Math.Poly2_s.div m (Vale.Math.Poly2_s.monomial 128) in let (va_arg11:Vale.Math.Poly2_s.poly) = cd in let (va_arg10:Vale.Math.Poly2_s.poly) = ab in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 287 column 30 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_mul_reverse_shift_1 va_arg10 va_arg11 127) (va_QEmpty ((lo, hi))))))))) val va_lemma_ClmulRev128 : va_b0:va_code -> va_s0:va_state -> ab:poly -> cd:poly -> Ghost (va_state & va_fuel & poly & poly) (requires (va_require_total va_b0 (va_code_ClmulRev128 ()) va_s0 /\ va_get_ok va_s0 /\ Vale.Math.Poly2_s.degree ab <= 127 /\ Vale.Math.Poly2_s.degree cd <= 127 /\ va_get_vec 1 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse ab 127) /\ va_get_vec 2 va_s0 == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.reverse cd 127))) (ensures (fun (va_sM, va_fM, lo, hi) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.Math.Poly2_s.degree lo <= 127 /\ Vale.Math.Poly2_s.degree hi <= 127 /\ Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo /\ va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo /\ va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi /\ va_state_eq va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))) [@"opaque_to_smt"] let va_lemma_ClmulRev128 va_b0 va_s0 ab cd = let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_ClmulRev128 va_mods ab cd in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ClmulRev128 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let (lo, hi) = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 262 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 273 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree lo <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 274 column 26 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.degree hi <= 127) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 275 column 61 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.mul ab cd) 255 == Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.shift hi 128) lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 276 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 1 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 lo) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 277 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GF128_Mul.vaf *****" (va_get_vec 2 va_sM == Vale.Math.Poly2.Bits_s.to_quad32 hi)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; let (lo, hi) = va_g in (va_sM, va_fM, lo, hi) [@ va_qattr] let va_wp_ClmulRev128 (ab:poly) (cd:poly) (va_s0:va_state) (va_k:(va_state -> (poly & poly) ->
false
true
Vale.AES.PPC64LE.GF128_Mul.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val va_wp_ClmulRev128 (ab cd: poly) (va_s0: va_state) (va_k: (va_state -> (poly & poly) -> Type0)) : Type0
[]
Vale.AES.PPC64LE.GF128_Mul.va_wp_ClmulRev128
{ "file_name": "obj/Vale.AES.PPC64LE.GF128_Mul.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
ab: Vale.Math.Poly2_s.poly -> cd: Vale.Math.Poly2_s.poly -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: (Vale.Math.Poly2_s.poly * Vale.Math.Poly2_s.poly) -> Type0) -> Type0
{ "end_col": 95, "end_line": 841, "start_col": 2, "start_line": 831 }